[kde-doc-english] [labplot/frameworks] /: Merge branch 'master' into frameworks
Garvit Khatri
garvitdelhi at gmail.com
Sat Feb 27 11:28:26 UTC 2016
Git commit fa0b313d864f960fcc3280d1ff114a8fcd57706b by Garvit Khatri.
Committed on 27/02/2016 at 11:27.
Pushed by garvitkhatri into branch 'frameworks'.
Merge branch 'master' into frameworks
M +144 -35 doc/index.docbook
R +3 -0 org.kde.labplot.appdata.xml
M +3 -4 src/CMakeLists.txt
M +1 -1 src/backend/core/AbstractAspect.cpp
M +34 -0 src/backend/core/Workbook.cpp
M +92 -536 src/backend/datapicker/DatapickerPoint.cpp
M +565 -563 src/backend/gsl/ExpressionParser.cpp
M +96 -52 src/backend/matrix/Matrix.cpp
M +40 -2 src/backend/spreadsheet/Spreadsheet.cpp
M +4 -0 src/backend/spreadsheet/Spreadsheet.h
M +42 -2 src/backend/worksheet/Worksheet.cpp
M +4 -0 src/backend/worksheet/Worksheet.h
M +1 -1 src/backend/worksheet/plots/cartesian/Axis.cpp
M +1 -2 src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
M +4 -0 src/backend/worksheet/plots/cartesian/XYCurve.cpp
M +90 -83 src/commonfrontend/ProjectExplorer.cpp
M +92 -60 src/commonfrontend/datapicker/DatapickerImageView.cpp
M +3 -6 src/commonfrontend/datapicker/DatapickerImageView.h
M +70 -13 src/commonfrontend/matrix/MatrixView.cpp
M +1 -0 src/commonfrontend/matrix/MatrixView.h
M +218 -174 src/commonfrontend/worksheet/WorksheetView.cpp
M +16 -7 src/commonfrontend/worksheet/WorksheetView.h
M +2 -19 src/kdefrontend/GuiObserver.cpp
M +3 -0 src/kdefrontend/GuiTools.cpp
M +28 -155 src/kdefrontend/MainWin.cpp
M +2 -4 src/kdefrontend/MainWin.h
M +46 -45 src/kdefrontend/SettingsDialog.cpp
M +10 -10 src/kdefrontend/SettingsDialog.h
M +30 -34 src/kdefrontend/datasources/ImportFileDialog.cpp
M +1 -1 src/kdefrontend/datasources/ImportFileDialog.h
M +11 -2 src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
M +10 -2 src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp
M +7 -1 src/kdefrontend/dockwidgets/MatrixDock.cpp
M +2 -4 src/kdefrontend/dockwidgets/MatrixDock.h
M +10 -2 src/kdefrontend/dockwidgets/WorksheetDock.cpp
M +19 -14 src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp
M +350 -16 src/kdefrontend/widgets/DatapickerCurveWidget.cpp
M +877 -0 src/kdefrontend/widgets/DatapickerImageWidget.cpp
M +33 -28 src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
http://commits.kde.org/labplot/fa0b313d864f960fcc3280d1ff114a8fcd57706b
diff --cc src/backend/spreadsheet/Spreadsheet.cpp
index e47543c,9cc9678..bf4aa1d
--- a/src/backend/spreadsheet/Spreadsheet.cpp
+++ b/src/backend/spreadsheet/Spreadsheet.cpp
@@@ -31,8 -31,13 +31,13 @@@
#include "backend/core/AspectPrivate.h"
#include "backend/core/AbstractAspect.h"
#include "commonfrontend/spreadsheet/SpreadsheetView.h"
+ #include "kdefrontend/spreadsheet/ExportSpreadsheetDialog.h"
+
+ #include <QPrinter>
+ #include <QPrintDialog>
+ #include <QPrintPreviewDialog>
-#include <KIcon>
+#include <QIcon>
#include <KConfigGroup>
#include <KLocale>
diff --cc src/backend/worksheet/Worksheet.cpp
index 473afb5,ac280dd..898c67b
--- a/src/backend/worksheet/Worksheet.cpp
+++ b/src/backend/worksheet/Worksheet.cpp
@@@ -34,9 -34,14 +34,14 @@@
#include "backend/worksheet/TextLabel.h"
#include "backend/lib/commandtemplates.h"
#include "backend/lib/XmlStreamReader.h"
+ #include "kdefrontend/worksheet/ExportWorksheetDialog.h"
#include <math.h>
- #include <QIcon>
+ #include <QPrinter>
+ #include <QPrintDialog>
+ #include <QPrintPreviewDialog>
+
-#include "KIcon"
++#include "QIcon"
#include <KConfigGroup>
#include <KLocale>
#include <QDebug>
diff --cc src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
index a7617ac,9420f96..5a8e561
--- a/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
+++ b/src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
@@@ -342,13 -341,13 +341,13 @@@ void CartesianPlot::initDefault(Type ty
void CartesianPlot::initActions(){
//"add new" actions
- addCurveAction = new KAction(KIcon("labplot-xy-curve"), i18n("xy-curve"), this);
- addEquationCurveAction = new KAction(KIcon("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), this);
- addFitCurveAction = new KAction(KIcon("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), this);
- addLegendAction = new KAction(KIcon("text-field"), i18n("legend"), this);
- addHorizontalAxisAction = new KAction(KIcon("labplot-axis-horizontal"), i18n("horizontal axis"), this);
- addVerticalAxisAction = new KAction(KIcon("labplot-axis-vertical"), i18n("vertical axis"), this);
- addCustomPointAction = new KAction(KIcon("draw-cross"), i18n("custom point"), this);
+ addCurveAction = new QAction(QIcon::fromTheme("labplot-xy-curve"), i18n("xy-curve"), this);
+ addEquationCurveAction = new QAction(QIcon::fromTheme("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), this);
+ addFitCurveAction = new QAction(QIcon::fromTheme("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), this);
+ addLegendAction = new QAction(QIcon::fromTheme("text-field"), i18n("legend"), this);
+ addHorizontalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-horizontal"), i18n("horizontal axis"), this);
+ addVerticalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-vertical"), i18n("vertical axis"), this);
- addCustomPointAction = new QAction(QIcon::fromTheme("labplot-custom-point"), i18n("custom point"), this);
++ addCustomPointAction = new QAction(QIcon::fromTheme("draw-cross"), i18n("custom point"), this);
connect(addCurveAction, SIGNAL(triggered()), SLOT(addCurve()));
connect(addEquationCurveAction, SIGNAL(triggered()), SLOT(addEquationCurve()));
diff --cc src/commonfrontend/datapicker/DatapickerImageView.cpp
index 05757bb,01e2154..de3407e
--- a/src/commonfrontend/datapicker/DatapickerImageView.cpp
+++ b/src/commonfrontend/datapicker/DatapickerImageView.cpp
@@@ -109,68 -116,68 +116,68 @@@ void DatapickerImageView::initActions(
magnificationActionGroup = new QActionGroup(this);
//Zoom actions
- zoomInViewAction = new KAction(QIcon::fromTheme("zoom-in"), i18n("Zoom in"), zoomActionGroup);
- zoomInViewAction = new KAction(KIcon("zoom-in"), i18n("Zoom in"), zoomActionGroup);
++ zoomInViewAction = new QAction(QIcon::fromTheme("zoom-in"), i18n("Zoom in"), zoomActionGroup);
zoomInViewAction->setShortcut(Qt::CTRL+Qt::Key_Plus);
- zoomOutViewAction = new KAction(QIcon::fromTheme("zoom-out"), i18n("Zoom out"), zoomActionGroup);
- zoomOutViewAction = new KAction(KIcon("zoom-out"), i18n("Zoom out"), zoomActionGroup);
++ zoomOutViewAction = new QAction(QIcon::fromTheme("zoom-out"), i18n("Zoom out"), zoomActionGroup);
zoomOutViewAction->setShortcut(Qt::CTRL+Qt::Key_Minus);
- zoomOriginAction = new KAction(QIcon::fromTheme("zoom-original"), i18n("Original size"), zoomActionGroup);
- zoomOriginAction = new KAction(KIcon("zoom-original"), i18n("Original size"), zoomActionGroup);
++ zoomOriginAction = new QAction(QIcon::fromTheme("zoom-original"), i18n("Original size"), zoomActionGroup);
zoomOriginAction->setShortcut(Qt::CTRL+Qt::Key_1);
- zoomFitPageHeightAction = new KAction(QIcon::fromTheme("zoom-fit-height"), i18n("Fit to height"), zoomActionGroup);
- zoomFitPageWidthAction = new KAction(QIcon::fromTheme("zoom-fit-width"), i18n("Fit to width"), zoomActionGroup);
- zoomFitPageHeightAction = new KAction(KIcon("zoom-fit-height"), i18n("Fit to height"), zoomActionGroup);
- zoomFitPageWidthAction = new KAction(KIcon("zoom-fit-width"), i18n("Fit to width"), zoomActionGroup);
++ zoomFitPageHeightAction = new QAction(QIcon::fromTheme("zoom-fit-height"), i18n("Fit to height"), zoomActionGroup);
++ zoomFitPageWidthAction = new QAction(QIcon::fromTheme("zoom-fit-width"), i18n("Fit to width"), zoomActionGroup);
// Mouse mode actions
- selectAndEditModeAction = new KAction(QIcon::fromTheme("labplot-cursor-arrow"), i18n("Select and Edit"), mouseModeActionGroup);
- selectAndEditModeAction = new KAction(KIcon("labplot-cursor-arrow"), i18n("Select and Edit"), mouseModeActionGroup);
++ selectAndEditModeAction = new QAction(QIcon::fromTheme("labplot-cursor-arrow"), i18n("Select and Edit"), mouseModeActionGroup);
selectAndEditModeAction->setCheckable(true);
- navigationModeAction = new KAction(QIcon::fromTheme("input-mouse"), i18n("Navigate"), mouseModeActionGroup);
- navigationModeAction = new KAction(KIcon("input-mouse"), i18n("Navigate"), mouseModeActionGroup);
++ navigationModeAction = new QAction(QIcon::fromTheme("input-mouse"), i18n("Navigate"), mouseModeActionGroup);
navigationModeAction->setCheckable(true);
- zoomSelectionModeAction = new KAction(QIcon::fromTheme("page-zoom"), i18n("Select and Zoom"), mouseModeActionGroup);
- zoomSelectionModeAction = new KAction(KIcon("page-zoom"), i18n("Select and Zoom"), mouseModeActionGroup);
++ zoomSelectionModeAction = new QAction(QIcon::fromTheme("page-zoom"), i18n("Select and Zoom"), mouseModeActionGroup);
zoomSelectionModeAction->setCheckable(true);
- selectAndMoveModeAction = new KAction(QIcon::fromTheme("labplot-cursor-arrow"), i18n("Select and Move"), mouseModeActionGroup);
- selectAndMoveModeAction = new KAction(KIcon("labplot-cursor-arrow"), i18n("Select and Move"), mouseModeActionGroup);
++ selectAndMoveModeAction = new QAction(QIcon::fromTheme("labplot-cursor-arrow"), i18n("Select and Move"), mouseModeActionGroup);
selectAndMoveModeAction->setCheckable(true);
- setAxisPointsAction = new KAction(QIcon::fromTheme("labplot-plot-axis-points"), i18n("Set Axis Points"), plotPointsTypeActionGroup);
- setAxisPointsAction = new KAction(KIcon("labplot-plot-axis-points"), i18n("Set Axis Points"), plotPointsTypeActionGroup);
++ setAxisPointsAction = new QAction(QIcon::fromTheme("labplot-plot-axis-points"), i18n("Set Axis Points"), plotPointsTypeActionGroup);
setAxisPointsAction->setCheckable(true);
- setCurvePointsAction = new KAction(QIcon::fromTheme("labplot-xy-curve-points"), i18n("Set Curve Points"), plotPointsTypeActionGroup);
- setCurvePointsAction = new KAction(KIcon("labplot-xy-curve-points"), i18n("Set Curve Points"), plotPointsTypeActionGroup);
++ setCurvePointsAction = new QAction(QIcon::fromTheme("labplot-xy-curve-points"), i18n("Set Curve Points"), plotPointsTypeActionGroup);
setCurvePointsAction->setCheckable(true);
- selectSegmentAction = new KAction(QIcon::fromTheme("labplot-xy-curve-segments"), i18n("Select Curve Segments"), plotPointsTypeActionGroup);
- selectSegmentAction = new KAction(KIcon("labplot-xy-curve-segments"), i18n("Select Curve Segments"), plotPointsTypeActionGroup);
++ selectSegmentAction = new QAction(QIcon::fromTheme("labplot-xy-curve-segments"), i18n("Select Curve Segments"), plotPointsTypeActionGroup);
selectSegmentAction->setCheckable(true);
- addCurveAction = new KAction(QIcon::fromTheme("labplot-xy-curve"), i18n("New Curve"), this);
- addCurveAction = new KAction(KIcon("labplot-xy-curve"), i18n("New Curve"), this);
++ addCurveAction = new QAction(QIcon::fromTheme("labplot-xy-curve"), i18n("New Curve"), this);
- shiftLeftAction = new KAction(QIcon::fromTheme("labplot-shift-left-x"), i18n("Shift Left"), navigationActionGroup);
- shiftLeftAction = new KAction(KIcon("labplot-shift-left-x"), i18n("Shift Left"), navigationActionGroup);
++ shiftLeftAction = new QAction(QIcon::fromTheme("labplot-shift-left-x"), i18n("Shift Left"), navigationActionGroup);
shiftLeftAction->setShortcut(Qt::Key_Right);
- shiftRightAction = new KAction(QIcon::fromTheme("labplot-shift-right-x"), i18n("Shift Right"), navigationActionGroup);
- shiftRightAction = new KAction(KIcon("labplot-shift-right-x"), i18n("Shift Right"), navigationActionGroup);
++ shiftRightAction = new QAction(QIcon::fromTheme("labplot-shift-right-x"), i18n("Shift Right"), navigationActionGroup);
shiftRightAction->setShortcut(Qt::Key_Left);
- shiftUpAction = new KAction(QIcon::fromTheme("labplot-shift-down-y"), i18n("Shift Up"), navigationActionGroup);
- shiftUpAction = new KAction(KIcon("labplot-shift-down-y"), i18n("Shift Up"), navigationActionGroup);
++ shiftUpAction = new QAction(QIcon::fromTheme("labplot-shift-down-y"), i18n("Shift Up"), navigationActionGroup);
shiftUpAction->setShortcut(Qt::Key_Up);
- shiftDownAction = new KAction(QIcon::fromTheme("labplot-shift-up-y"), i18n("Shift Down"), navigationActionGroup);
- shiftDownAction = new KAction(KIcon("labplot-shift-up-y"), i18n("Shift Down"), navigationActionGroup);
++ shiftDownAction = new QAction(QIcon::fromTheme("labplot-shift-up-y"), i18n("Shift Down"), navigationActionGroup);
shiftDownAction->setShortcut(Qt::Key_Down);
- noMagnificationAction = new KAction(QIcon::fromTheme("labplot-1-to-1-zoom"), i18n("No Magnification"), magnificationActionGroup);
- noMagnificationAction = new KAction(KIcon("labplot-1x-zoom"), i18n("No Magnification"), magnificationActionGroup);
++ noMagnificationAction = new QAction(QIcon::fromTheme("labplot-1x-zoom"), i18n("No Magnification"), magnificationActionGroup);
noMagnificationAction->setCheckable(true);
noMagnificationAction->setChecked(true);
- twoTimesMagnificationAction = new KAction(QIcon::fromTheme("labplot-1-to-2-zoom"), i18n("2x Magnification"), magnificationActionGroup);
- twoTimesMagnificationAction = new KAction(KIcon("labplot-2x-zoom"), i18n("2x Magnification"), magnificationActionGroup);
++ twoTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-2x-zoom"), i18n("2x Magnification"), magnificationActionGroup);
twoTimesMagnificationAction->setCheckable(true);
- threeTimesMagnificationAction = new KAction(QIcon::fromTheme("labplot-1-to-3-zoom"), i18n("3x Magnification"), magnificationActionGroup);
- threeTimesMagnificationAction = new KAction(KIcon("labplot-3x-zoom"), i18n("3x Magnification"), magnificationActionGroup);
++ threeTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-3x-zoom"), i18n("3x Magnification"), magnificationActionGroup);
threeTimesMagnificationAction->setCheckable(true);
- fourTimesMagnificationAction = new KAction(QIcon::fromTheme("labplot-1-to-4-zoom"), i18n("4x Magnification"), magnificationActionGroup);
- fourTimesMagnificationAction = new KAction(KIcon("labplot-4x-zoom"), i18n("4x Magnification"), magnificationActionGroup);
++ fourTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-4x-zoom"), i18n("4x Magnification"), magnificationActionGroup);
fourTimesMagnificationAction->setCheckable(true);
- fiveTimesMagnificationAction = new KAction(QIcon::fromTheme("labplot-1-to-5-zoom"), i18n("5x Magnification"), magnificationActionGroup);
- fiveTimesMagnificationAction = new KAction(KIcon("labplot-5x-zoom"), i18n("5x Magnification"), magnificationActionGroup);
++ fiveTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-5x-zoom"), i18n("5x Magnification"), magnificationActionGroup);
fiveTimesMagnificationAction->setCheckable(true);
connect( mouseModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(mouseModeChanged(QAction*)) );
@@@ -195,8 -201,8 +201,8 @@@ void DatapickerImageView::initMenus()
m_viewImageMenu->addAction(setCurvePointsAction);
m_viewImageMenu->addAction(selectSegmentAction);
- m_zoomMenu = new QMenu(i18n("Zoom"));
+ m_zoomMenu = new QMenu(i18n("Zoom View"));
- m_zoomMenu->setIcon(KIcon("zoom-draw"));
+ m_zoomMenu->setIcon(QIcon::fromTheme("zoom-draw"));
m_zoomMenu->addAction(zoomInViewAction);
m_zoomMenu->addAction(zoomOutViewAction);
m_zoomMenu->addAction(zoomOriginAction);
@@@ -211,7 -216,7 +216,7 @@@
m_navigationMenu->addAction(shiftDownAction);
m_magnificationMenu = new QMenu(i18n("Magnification"));
- //m_viewImageMenu->setIcon();
- m_magnificationMenu->setIcon(KIcon("labplot-zoom"));
++ m_magnificationMenu->setIcon(QIcon::fromTheme("labplot-zoom"));
m_magnificationMenu->addAction(noMagnificationAction);
m_magnificationMenu->addAction(twoTimesMagnificationAction);
m_magnificationMenu->addAction(threeTimesMagnificationAction);
@@@ -691,13 -690,12 +692,13 @@@ void DatapickerImageView::exportToFile(
sourceRect = scene()->sceneRect();
//print
- if (format==DatapickerImageView::Pdf || format==DatapickerImageView::Eps) {
+ if (format==WorksheetView::Pdf || format==WorksheetView::Eps) {
QPrinter printer(QPrinter::HighResolution);
- if (format==DatapickerImageView::Pdf)
+ if (format==WorksheetView::Pdf)
printer.setOutputFormat(QPrinter::PdfFormat);
else
- printer.setOutputFormat(QPrinter::PostScriptFormat);
+// printer.setOutputFormat(QPrinter::PostScriptFormat);
+ printer.setOutputFormat(QPrinter::NativeFormat);
printer.setOutputFileName(path);
int w = Worksheet::convertFromSceneUnits(sourceRect.width(), Worksheet::Millimeter);
diff --cc src/commonfrontend/matrix/MatrixView.cpp
index 5ea745f,0b0764f..b2a7aa2
--- a/src/commonfrontend/matrix/MatrixView.cpp
+++ b/src/commonfrontend/matrix/MatrixView.cpp
@@@ -50,9 -53,10 +53,10 @@@
#include <KLocale>
#include <KAction>
-#include <KIcon>
+#include <QIcon>
#include <float.h>
+ #include "math.h"
MatrixView::MatrixView(Matrix* matrix) : QWidget(),
m_stackedWidget(new QStackedWidget(this)),
diff --cc src/commonfrontend/worksheet/WorksheetView.cpp
index 7f9015a,91ff80d..9a81408
--- a/src/commonfrontend/worksheet/WorksheetView.cpp
+++ b/src/commonfrontend/worksheet/WorksheetView.cpp
@@@ -59,47 -61,51 +61,51 @@@
Creates a view for the Worksheet \c worksheet and initializes the internal model.
*/
WorksheetView::WorksheetView(Worksheet* worksheet) : QGraphicsView(),
- m_worksheet(worksheet),
- m_mouseMode(SelectionMode),
- m_cartesianPlotActionMode(ApplyActionToSelection),
- m_cartesianPlotMouseMode(CartesianPlot::SelectionMode),
- m_selectionBandIsShown(false),
- m_suppressSelectionChangedEvent(false),
- lastAddedWorksheetElement(0),
- m_fadeInTimeLine(0),
- m_fadeOutTimeLine(0),
- tbNewCartesianPlot(0),
- tbZoom(0) {
+ m_worksheet(worksheet),
+ m_mouseMode(SelectionMode),
+ m_cartesianPlotActionMode(ApplyActionToSelection),
+ m_cartesianPlotMouseMode(CartesianPlot::SelectionMode),
+ m_selectionBandIsShown(false),
+ magnificationFactor(0),
+ m_magnificationWindow(0),
+ m_suppressSelectionChangedEvent(false),
+ lastAddedWorksheetElement(0),
+ m_fadeInTimeLine(0),
+ m_fadeOutTimeLine(0),
+ tbNewCartesianPlot(0),
+ tbZoom(0) {
- setScene(m_worksheet->scene());
+ setScene(m_worksheet->scene());
- setRenderHint(QPainter::Antialiasing);
- setRubberBandSelectionMode(Qt::ContainsItemBoundingRect);
- setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
- setResizeAnchor(QGraphicsView::AnchorViewCenter);
- setMinimumSize(16, 16);
- setFocusPolicy(Qt::StrongFocus);
+ setRenderHint(QPainter::Antialiasing);
+ setRubberBandSelectionMode(Qt::ContainsItemBoundingRect);
+ setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ setResizeAnchor(QGraphicsView::AnchorViewCenter);
+ setMinimumSize(16, 16);
+ setFocusPolicy(Qt::StrongFocus);
- if (m_worksheet->useViewSize()) {
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- }
+ if (m_worksheet->useViewSize()) {
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ }
- viewport()->setAttribute( Qt::WA_OpaquePaintEvent );
- viewport()->setAttribute( Qt::WA_NoSystemBackground );
+ viewport()->setAttribute( Qt::WA_OpaquePaintEvent );
+ viewport()->setAttribute( Qt::WA_NoSystemBackground );
// setAcceptDrops( true );
- setCacheMode(QGraphicsView::CacheBackground);
+ setCacheMode(QGraphicsView::CacheBackground);
- m_gridSettings.style = WorksheetView::NoGrid;
+ m_gridSettings.style = WorksheetView::NoGrid;
- initActions();
- initMenus();
- selectionModeAction->setChecked(true);
- handleCartesianPlotActions();
+ initActions();
+ initMenus();
+ selectionModeAction->setChecked(true);
+ handleCartesianPlotActions();
- changeZoom(zoomOriginAction);
- currentZoomAction=zoomInViewAction;
+ changeZoom(zoomOriginAction);
+ currentZoomAction=zoomInViewAction;
+ currentMagnificationAction = noMagnificationAction;
+
//signal/slot connections
connect(m_worksheet, SIGNAL(requestProjectContextMenu(QMenu*)), this, SLOT(createContextMenu(QMenu*)));
connect(m_worksheet, SIGNAL(itemSelected(QGraphicsItem*)), this, SLOT(selectItem(QGraphicsItem*)) );
@@@ -112,54 -118,72 +118,72 @@@
}
void WorksheetView::initActions(){
- QActionGroup* addNewActionGroup = new QActionGroup(this);
- QActionGroup* zoomActionGroup = new QActionGroup(this);
- QActionGroup* mouseModeActionGroup = new QActionGroup(this);
- QActionGroup* layoutActionGroup = new QActionGroup(this);
- QActionGroup* gridActionGroup = new QActionGroup(this);
- gridActionGroup->setExclusive(true);
+ QActionGroup* addNewActionGroup = new QActionGroup(this);
+ QActionGroup* zoomActionGroup = new QActionGroup(this);
+ QActionGroup* mouseModeActionGroup = new QActionGroup(this);
+ QActionGroup* layoutActionGroup = new QActionGroup(this);
+ QActionGroup* gridActionGroup = new QActionGroup(this);
+ gridActionGroup->setExclusive(true);
+ QActionGroup* magnificationActionGroup = new QActionGroup(this);
- selectAllAction = new KAction(KIcon("edit-select-all"), i18n("Select all"), this);
- selectAllAction->setShortcut(Qt::CTRL+Qt::Key_A);
- this->addAction(selectAllAction);
- connect(selectAllAction, SIGNAL(triggered()), SLOT(selectAllElements()));
+ selectAllAction = new QAction(QIcon::fromTheme("edit-select-all"), i18n("Select all"), this);
+ selectAllAction->setShortcut(Qt::CTRL+Qt::Key_A);
+ this->addAction(selectAllAction);
+ connect(selectAllAction, SIGNAL(triggered()), SLOT(selectAllElements()));
- deleteAction = new KAction(KIcon("edit-delete"), i18n("Delete"), this);
- deleteAction->setShortcut(Qt::Key_Delete);
- this->addAction(deleteAction);
- connect(deleteAction, SIGNAL(triggered()), SLOT(deleteElement()));
+ deleteAction = new QAction(QIcon::fromTheme("edit-delete"), i18n("Delete"), this);
+ deleteAction->setShortcut(Qt::Key_Delete);
+ this->addAction(deleteAction);
+ connect(deleteAction, SIGNAL(triggered()), SLOT(deleteElement()));
- backspaceAction = new KAction(this);
- backspaceAction->setShortcut(Qt::Key_Backspace);
- this->addAction(backspaceAction);
- connect(backspaceAction, SIGNAL(triggered()), SLOT(deleteElement()));
+ backspaceAction = new QAction(this);
+ backspaceAction->setShortcut(Qt::Key_Backspace);
+ this->addAction(backspaceAction);
+ connect(backspaceAction, SIGNAL(triggered()), SLOT(deleteElement()));
- //Zoom actions
- zoomInViewAction = new KAction(KIcon("zoom-in"), i18n("Zoom in"), zoomActionGroup);
- zoomInViewAction->setShortcut(Qt::CTRL+Qt::Key_Plus);
+ //Zoom actions
+ zoomInViewAction = new QAction(QIcon::fromTheme("zoom-in"), i18n("Zoom in"), zoomActionGroup);
+ zoomInViewAction->setShortcut(Qt::CTRL+Qt::Key_Plus);
- zoomOutViewAction = new KAction(KIcon("zoom-out"), i18n("Zoom out"), zoomActionGroup);
- zoomOutViewAction->setShortcut(Qt::CTRL+Qt::Key_Minus);
+ zoomOutViewAction = new QAction(QIcon::fromTheme("zoom-out"), i18n("Zoom out"), zoomActionGroup);
+ zoomOutViewAction->setShortcut(Qt::CTRL+Qt::Key_Minus);
- zoomOriginAction = new KAction(KIcon("zoom-original"), i18n("Original size"), zoomActionGroup);
- zoomOriginAction->setShortcut(Qt::CTRL+Qt::Key_1);
+ zoomOriginAction = new QAction(QIcon::fromTheme("zoom-original"), i18n("Original size"), zoomActionGroup);
+ zoomOriginAction->setShortcut(Qt::CTRL+Qt::Key_1);
- zoomFitPageHeightAction = new KAction(KIcon("zoom-fit-height"), i18n("Fit to height"), zoomActionGroup);
- zoomFitPageWidthAction = new KAction(KIcon("zoom-fit-width"), i18n("Fit to width"), zoomActionGroup);
- zoomFitSelectionAction = new KAction(i18n("Fit to selection"), zoomActionGroup);
+ zoomFitPageHeightAction = new QAction(QIcon::fromTheme("zoom-fit-height"), i18n("Fit to height"), zoomActionGroup);
+ zoomFitPageWidthAction = new QAction(QIcon::fromTheme("zoom-fit-width"), i18n("Fit to width"), zoomActionGroup);
+ zoomFitSelectionAction = new QAction(i18n("Fit to selection"), zoomActionGroup);
// Mouse mode actions
- selectionModeAction = new KAction(KIcon("labplot-cursor-arrow"), i18n("Select and Edit"), mouseModeActionGroup);
+ selectionModeAction = new QAction(QIcon::fromTheme("labplot-cursor-arrow"), i18n("Select and Edit"), mouseModeActionGroup);
selectionModeAction->setCheckable(true);
- navigationModeAction = new KAction(KIcon("input-mouse"), i18n("Navigate"), mouseModeActionGroup);
- navigationModeAction->setCheckable(true);
+ navigationModeAction = new QAction(QIcon::fromTheme("input-mouse"), i18n("Navigate"), mouseModeActionGroup);
+ navigationModeAction->setCheckable(true);
- zoomSelectionModeAction = new KAction(KIcon("page-zoom"), i18n("Select and Zoom"), mouseModeActionGroup);
- zoomSelectionModeAction->setCheckable(true);
+ zoomSelectionModeAction = new QAction(QIcon::fromTheme("page-zoom"), i18n("Select and Zoom"), mouseModeActionGroup);
+ zoomSelectionModeAction->setCheckable(true);
- //TODO implement later "group selection action" where multiple objects can be selected by drawing a rectangular
+ //Magnification actions
- noMagnificationAction = new KAction(KIcon("labplot-1x-zoom"), i18n("No Magnification"), magnificationActionGroup);
++ noMagnificationAction = new QAction(QIcon::fromTheme("labplot-1x-zoom"), i18n("No Magnification"), magnificationActionGroup);
+ noMagnificationAction->setCheckable(true);
+ noMagnificationAction->setChecked(true);
+
- twoTimesMagnificationAction = new KAction(KIcon("labplot-2x-zoom"), i18n("2x Magnification"), magnificationActionGroup);
++ twoTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-2x-zoom"), i18n("2x Magnification"), magnificationActionGroup);
+ twoTimesMagnificationAction->setCheckable(true);
+
- threeTimesMagnificationAction = new KAction(KIcon("labplot-3x-zoom"), i18n("3x Magnification"), magnificationActionGroup);
++ threeTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-3x-zoom"), i18n("3x Magnification"), magnificationActionGroup);
+ threeTimesMagnificationAction->setCheckable(true);
+
- fourTimesMagnificationAction = new KAction(KIcon("labplot-4x-zoom"), i18n("4x Magnification"), magnificationActionGroup);
++ fourTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-4x-zoom"), i18n("4x Magnification"), magnificationActionGroup);
+ fourTimesMagnificationAction->setCheckable(true);
+
- fiveTimesMagnificationAction = new KAction(KIcon("labplot-5x-zoom"), i18n("5x Magnification"), magnificationActionGroup);
++ fiveTimesMagnificationAction = new QAction(QIcon::fromTheme("labplot-5x-zoom"), i18n("5x Magnification"), magnificationActionGroup);
+ fiveTimesMagnificationAction->setCheckable(true);
+
+ //TODO implement later "group selection action" where multiple objects can be selected by drawing a rectangular
-// selectionModeAction = new KAction(KIcon("select-rectangular"), i18n("Selection"), mouseModeActionGroup);
+// selectionModeAction = new QAction(QIcon::fromTheme("select-rectangular"), i18n("Selection"), mouseModeActionGroup);
// selectionModeAction->setCheckable(true);
//"Add new" related actions
@@@ -187,55 -211,56 +211,56 @@@
breakLayoutAction->setEnabled(false);
//Grid actions
- noGridAction = new KAction(i18n("no grid"), gridActionGroup);
- noGridAction->setObjectName("noGridAction");
- noGridAction->setCheckable(true);
- noGridAction->setChecked(true);
- noGridAction->setData(WorksheetView::NoGrid);
+ noGridAction = new QAction(i18n("no grid"), gridActionGroup);
+ noGridAction->setObjectName("noGridAction");
+ noGridAction->setCheckable(true);
+ noGridAction->setChecked(true);
+ noGridAction->setData(WorksheetView::NoGrid);
- denseLineGridAction = new KAction(i18n("dense line grid"), gridActionGroup);
- denseLineGridAction->setObjectName("denseLineGridAction");
- denseLineGridAction->setCheckable(true);
+ denseLineGridAction = new QAction(i18n("dense line grid"), gridActionGroup);
+ denseLineGridAction->setObjectName("denseLineGridAction");
+ denseLineGridAction->setCheckable(true);
- sparseLineGridAction = new KAction(i18n("sparse line grid"), gridActionGroup);
- sparseLineGridAction->setObjectName("sparseLineGridAction");
- sparseLineGridAction->setCheckable(true);
+ sparseLineGridAction = new QAction(i18n("sparse line grid"), gridActionGroup);
+ sparseLineGridAction->setObjectName("sparseLineGridAction");
+ sparseLineGridAction->setCheckable(true);
- denseDotGridAction = new KAction(i18n("dense dot grid"), gridActionGroup);
- denseDotGridAction->setObjectName("denseDotGridAction");
- denseDotGridAction->setCheckable(true);
+ denseDotGridAction = new QAction(i18n("dense dot grid"), gridActionGroup);
+ denseDotGridAction->setObjectName("denseDotGridAction");
+ denseDotGridAction->setCheckable(true);
- sparseDotGridAction = new KAction(i18n("sparse dot grid"), gridActionGroup);
- sparseDotGridAction->setObjectName("sparseDotGridAction");
- sparseDotGridAction->setCheckable(true);
+ sparseDotGridAction = new QAction(i18n("sparse dot grid"), gridActionGroup);
+ sparseDotGridAction->setObjectName("sparseDotGridAction");
+ sparseDotGridAction->setCheckable(true);
- customGridAction = new KAction(i18n("custom grid"), gridActionGroup);
- customGridAction->setObjectName("customGridAction");
- customGridAction->setCheckable(true);
+ customGridAction = new QAction(i18n("custom grid"), gridActionGroup);
+ customGridAction->setObjectName("customGridAction");
+ customGridAction->setCheckable(true);
- snapToGridAction = new KAction(i18n("snap to grid"), this);
- snapToGridAction->setCheckable(true);
+ snapToGridAction = new QAction(i18n("snap to grid"), this);
+ snapToGridAction->setCheckable(true);
- //check the action corresponding to the currently active layout in worksheet
- this->layoutChanged(m_worksheet->layout());
+ //check the action corresponding to the currently active layout in worksheet
+ this->layoutChanged(m_worksheet->layout());
- connect(addNewActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(addNew(QAction*)));
- connect(mouseModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(mouseModeChanged(QAction*)));
- connect(zoomActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeZoom(QAction*)));
- connect(layoutActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeLayout(QAction*)));
- connect(gridActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeGrid(QAction*)));
- connect(snapToGridAction, SIGNAL(triggered()), this, SLOT(changeSnapToGrid()));
+ connect(addNewActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(addNew(QAction*)));
+ connect(mouseModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(mouseModeChanged(QAction*)));
+ connect(zoomActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeZoom(QAction*)));
+ connect(magnificationActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(magnificationChanged(QAction*)));
+ connect(layoutActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeLayout(QAction*)));
+ connect(gridActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeGrid(QAction*)));
+ connect(snapToGridAction, SIGNAL(triggered()), this, SLOT(changeSnapToGrid()));
- //action for cartesian plots
- QActionGroup* cartesianPlotActionModeActionGroup = new QActionGroup(this);
- cartesianPlotActionModeActionGroup->setExclusive(true);
- cartesianPlotApplyToSelectionAction = new KAction(i18n("selected plots"), cartesianPlotActionModeActionGroup);
- cartesianPlotApplyToSelectionAction->setCheckable(true);
- cartesianPlotApplyToSelectionAction->setChecked(true);
- cartesianPlotApplyToAllAction = new KAction(i18n("all plots"), cartesianPlotActionModeActionGroup);
- cartesianPlotApplyToAllAction->setCheckable(true);
- connect(cartesianPlotActionModeActionGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotActionModeChanged(QAction*)));
+ //action for cartesian plots
+ QActionGroup* cartesianPlotActionModeActionGroup = new QActionGroup(this);
+ cartesianPlotActionModeActionGroup->setExclusive(true);
+ cartesianPlotApplyToSelectionAction = new QAction(i18n("selected plots"), cartesianPlotActionModeActionGroup);
+ cartesianPlotApplyToSelectionAction->setCheckable(true);
+ cartesianPlotApplyToSelectionAction->setChecked(true);
+ cartesianPlotApplyToAllAction = new QAction(i18n("all plots"), cartesianPlotActionModeActionGroup);
+ cartesianPlotApplyToAllAction->setCheckable(true);
+ connect(cartesianPlotActionModeActionGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotActionModeChanged(QAction*)));
QActionGroup* cartesianPlotMouseModeActionGroup = new QActionGroup(this);
cartesianPlotMouseModeActionGroup->setExclusive(true);
@@@ -243,160 -268,166 +268,166 @@@
cartesianPlotSelectionModeAction->setCheckable(true);
cartesianPlotSelectionModeAction->setChecked(true);
- cartesianPlotZoomSelectionModeAction = new KAction(KIcon("labplot-zoom-select"), i18n("Select region and zoom in"), cartesianPlotMouseModeActionGroup);
+ cartesianPlotZoomSelectionModeAction = new QAction(QIcon::fromTheme("labplot-zoom-select"), i18n("Select region and zoom in"), cartesianPlotMouseModeActionGroup);
cartesianPlotZoomSelectionModeAction->setCheckable(true);
- cartesianPlotZoomXSelectionModeAction = new KAction(KIcon("labplot-zoom-select-x"), i18n("Select x-region and zoom in"), cartesianPlotMouseModeActionGroup);
+ cartesianPlotZoomXSelectionModeAction = new QAction(QIcon::fromTheme("labplot-zoom-select-x"), i18n("Select x-region and zoom in"), cartesianPlotMouseModeActionGroup);
cartesianPlotZoomXSelectionModeAction->setCheckable(true);
- cartesianPlotZoomYSelectionModeAction = new KAction(KIcon("labplot-zoom-select-y"), i18n("Select y-region and zoom in"), cartesianPlotMouseModeActionGroup);
+ cartesianPlotZoomYSelectionModeAction = new QAction(QIcon::fromTheme("labplot-zoom-select-y"), i18n("Select y-region and zoom in"), cartesianPlotMouseModeActionGroup);
cartesianPlotZoomYSelectionModeAction->setCheckable(true);
- connect(cartesianPlotMouseModeActionGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotMouseModeChanged(QAction*)));
+ connect(cartesianPlotMouseModeActionGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotMouseModeChanged(QAction*)));
- addCurveAction = new QAction(QIcon::fromTheme("labplot-xy-curve"), i18n("xy-curve"), this);
- addEquationCurveAction = new QAction(QIcon::fromTheme("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), this);
- addFitCurveAction = new QAction(QIcon::fromTheme("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), this);
+ QActionGroup* cartesianPlotAddNewActionGroup = new QActionGroup(this);
- addCurveAction = new KAction(KIcon("labplot-xy-curve"), i18n("xy-curve"), cartesianPlotAddNewActionGroup);
- addEquationCurveAction = new KAction(KIcon("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), cartesianPlotAddNewActionGroup);
- addFitCurveAction = new KAction(KIcon("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), cartesianPlotAddNewActionGroup);
- addLegendAction = new KAction(KIcon("text-field"), i18n("legend"), this);
- addHorizontalAxisAction = new KAction(KIcon("labplot-axis-horizontal"), i18n("horizontal axis"), cartesianPlotAddNewActionGroup);
- addVerticalAxisAction = new KAction(KIcon("labplot-axis-vertical"), i18n("vertical axis"), cartesianPlotAddNewActionGroup);
- addCustomPointAction = new KAction(KIcon("draw-cross"), i18n("custom point"), cartesianPlotAddNewActionGroup);
++ addCurveAction = new QAction(QIcon::fromTheme("labplot-xy-curve"), i18n("xy-curve"), cartesianPlotAddNewActionGroup);
++ addEquationCurveAction = new QAction(QIcon::fromTheme("labplot-xy-equation-curve"), i18n("xy-curve from a mathematical equation"), cartesianPlotAddNewActionGroup);
++ addFitCurveAction = new QAction(QIcon::fromTheme("labplot-xy-fit-curve"), i18n("xy-curve from a fit to data"), cartesianPlotAddNewActionGroup);
+ addLegendAction = new QAction(QIcon::fromTheme("text-field"), i18n("legend"), this);
- addHorizontalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-horizontal"), i18n("horizontal axis"), this);
- addVerticalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-vertical"), i18n("vertical axis"), this);
-
- connect(addCurveAction, SIGNAL(triggered()), SLOT(addCurve()));
- connect(addEquationCurveAction, SIGNAL(triggered()), SLOT(addEquationCurve()));
- connect(addFitCurveAction, SIGNAL(triggered()), SLOT(addFitCurve()));
- connect(addLegendAction, SIGNAL(triggered()), SLOT(addLegend()));
- connect(addHorizontalAxisAction, SIGNAL(triggered()), SLOT(addHorizontalAxis()));
- connect(addVerticalAxisAction, SIGNAL(triggered()), SLOT(addVerticalAxis()));
++ addHorizontalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-horizontal"), i18n("horizontal axis"), cartesianPlotAddNewActionGroup);
++ addVerticalAxisAction = new QAction(QIcon::fromTheme("labplot-axis-vertical"), i18n("vertical axis"), cartesianPlotAddNewActionGroup);
++ addCustomPointAction = new QAction(QIcon::fromTheme("draw-cross"), i18n("custom point"), cartesianPlotAddNewActionGroup);
+ connect(cartesianPlotAddNewActionGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotAddNew(QAction*)));
QActionGroup* cartesianPlotNavigationGroup = new QActionGroup(this);
- scaleAutoAction = new KAction(KIcon("labplot-auto-scale-all"), i18n("auto scale"), cartesianPlotNavigationGroup);
+ scaleAutoAction = new QAction(QIcon::fromTheme("labplot-auto-scale-all"), i18n("auto scale"), cartesianPlotNavigationGroup);
scaleAutoAction->setData(CartesianPlot::ScaleAuto);
- scaleAutoXAction = new KAction(KIcon("labplot-auto-scale-x"), i18n("auto scale X"), cartesianPlotNavigationGroup);
+ scaleAutoXAction = new QAction(QIcon::fromTheme("labplot-auto-scale-x"), i18n("auto scale X"), cartesianPlotNavigationGroup);
scaleAutoXAction->setData(CartesianPlot::ScaleAutoX);
- scaleAutoYAction = new KAction(KIcon("labplot-auto-scale-y"), i18n("auto scale Y"), cartesianPlotNavigationGroup);
+ scaleAutoYAction = new QAction(QIcon::fromTheme("labplot-auto-scale-y"), i18n("auto scale Y"), cartesianPlotNavigationGroup);
scaleAutoYAction->setData(CartesianPlot::ScaleAutoY);
- zoomInAction = new KAction(KIcon("zoom-in"), i18n("zoom in"), cartesianPlotNavigationGroup);
+ zoomInAction = new QAction(QIcon::fromTheme("zoom-in"), i18n("zoom in"), cartesianPlotNavigationGroup);
zoomInAction->setData(CartesianPlot::ZoomIn);
- zoomOutAction = new KAction(KIcon("zoom-out"), i18n("zoom out"), cartesianPlotNavigationGroup);
+ zoomOutAction = new QAction(QIcon::fromTheme("zoom-out"), i18n("zoom out"), cartesianPlotNavigationGroup);
zoomOutAction->setData(CartesianPlot::ZoomOut);
- zoomInXAction = new KAction(KIcon("labplot-zoom-in-x"), i18n("zoom in X"), cartesianPlotNavigationGroup);
+ zoomInXAction = new QAction(QIcon::fromTheme("labplot-zoom-in-x"), i18n("zoom in X"), cartesianPlotNavigationGroup);
zoomInXAction->setData(CartesianPlot::ZoomInX);
- zoomOutXAction = new KAction(KIcon("labplot-zoom-out-x"), i18n("zoom out X"), cartesianPlotNavigationGroup);
+ zoomOutXAction = new QAction(QIcon::fromTheme("labplot-zoom-out-x"), i18n("zoom out X"), cartesianPlotNavigationGroup);
zoomOutXAction->setData(CartesianPlot::ZoomOutX);
- zoomInYAction = new KAction(KIcon("labplot-zoom-in-y"), i18n("zoom in Y"), cartesianPlotNavigationGroup);
+ zoomInYAction = new QAction(QIcon::fromTheme("labplot-zoom-in-y"), i18n("zoom in Y"), cartesianPlotNavigationGroup);
zoomInYAction->setData(CartesianPlot::ZoomInY);
- zoomOutYAction = new KAction(KIcon("labplot-zoom-out-y"), i18n("zoom out Y"), cartesianPlotNavigationGroup);
+ zoomOutYAction = new QAction(QIcon::fromTheme("labplot-zoom-out-y"), i18n("zoom out Y"), cartesianPlotNavigationGroup);
zoomOutYAction->setData(CartesianPlot::ZoomOutY);
- shiftLeftXAction = new KAction(KIcon("labplot-shift-left-x"), i18n("shift left X"), cartesianPlotNavigationGroup);
+ shiftLeftXAction = new QAction(QIcon::fromTheme("labplot-shift-left-x"), i18n("shift left X"), cartesianPlotNavigationGroup);
shiftLeftXAction->setData(CartesianPlot::ShiftLeftX);
- shiftRightXAction = new KAction(KIcon("labplot-shift-right-x"), i18n("shift right X"), cartesianPlotNavigationGroup);
+ shiftRightXAction = new QAction(QIcon::fromTheme("labplot-shift-right-x"), i18n("shift right X"), cartesianPlotNavigationGroup);
shiftRightXAction->setData(CartesianPlot::ShiftRightX);
- shiftUpYAction = new KAction(KIcon("labplot-shift-up-y"), i18n("shift up Y"), cartesianPlotNavigationGroup);
+ shiftUpYAction = new QAction(QIcon::fromTheme("labplot-shift-up-y"), i18n("shift up Y"), cartesianPlotNavigationGroup);
shiftUpYAction->setData(CartesianPlot::ShiftUpY);
- shiftDownYAction = new KAction(KIcon("labplot-shift-down-y"), i18n("shift down Y"), cartesianPlotNavigationGroup);
+ shiftDownYAction = new QAction(QIcon::fromTheme("labplot-shift-down-y"), i18n("shift down Y"), cartesianPlotNavigationGroup);
shiftDownYAction->setData(CartesianPlot::ShiftDownY);
connect(cartesianPlotNavigationGroup, SIGNAL(triggered(QAction*)), SLOT(cartesianPlotNavigationChanged(QAction*)));
}
void WorksheetView::initMenus(){
- m_addNewCartesianPlotMenu = new QMenu(i18n("xy-plot"));
- m_addNewCartesianPlotMenu->addAction(addCartesianPlot1Action);
- m_addNewCartesianPlotMenu->addAction(addCartesianPlot2Action);
- m_addNewCartesianPlotMenu->addAction(addCartesianPlot3Action);
- m_addNewCartesianPlotMenu->addAction(addCartesianPlot4Action);
-
- m_addNewMenu = new QMenu(i18n("Add new"));
- m_addNewMenu->addMenu(m_addNewCartesianPlotMenu)->setIcon(KIcon("office-chart-line"));
- m_addNewMenu->addSeparator();
- m_addNewMenu->addAction(addTextLabelAction);
-
- m_viewMouseModeMenu = new QMenu(i18n("Mouse Mode"));
- m_viewMouseModeMenu->setIcon(KIcon("input-mouse"));
- m_viewMouseModeMenu->addAction(selectionModeAction);
- m_viewMouseModeMenu->addAction(navigationModeAction);
- m_viewMouseModeMenu->addAction(zoomSelectionModeAction);
-
- m_zoomMenu = new QMenu(i18n("Zoom"));
- m_zoomMenu->setIcon(KIcon("zoom-draw"));
- m_zoomMenu->addAction(zoomInViewAction);
- m_zoomMenu->addAction(zoomOutViewAction);
- m_zoomMenu->addAction(zoomOriginAction);
- m_zoomMenu->addAction(zoomFitPageHeightAction);
- m_zoomMenu->addAction(zoomFitPageWidthAction);
- m_zoomMenu->addAction(zoomFitSelectionAction);
+ m_addNewCartesianPlotMenu = new QMenu(i18n("xy-plot"));
+ m_addNewCartesianPlotMenu->addAction(addCartesianPlot1Action);
+ m_addNewCartesianPlotMenu->addAction(addCartesianPlot2Action);
+ m_addNewCartesianPlotMenu->addAction(addCartesianPlot3Action);
+ m_addNewCartesianPlotMenu->addAction(addCartesianPlot4Action);
+
+ m_addNewMenu = new QMenu(i18n("Add new"));
+ m_addNewMenu->addMenu(m_addNewCartesianPlotMenu)->setIcon(QIcon::fromTheme("office-chart-line"));
+ m_addNewMenu->addSeparator();
+ m_addNewMenu->addAction(addTextLabelAction);
+
+ m_viewMouseModeMenu = new QMenu(i18n("Mouse Mode"));
+ m_viewMouseModeMenu->setIcon(QIcon::fromTheme("input-mouse"));
+ m_viewMouseModeMenu->addAction(selectionModeAction);
+ m_viewMouseModeMenu->addAction(navigationModeAction);
+ m_viewMouseModeMenu->addAction(zoomSelectionModeAction);
+
+ m_zoomMenu = new QMenu(i18n("Zoom"));
+ m_zoomMenu->setIcon(QIcon::fromTheme("zoom-draw"));
+ m_zoomMenu->addAction(zoomInViewAction);
+ m_zoomMenu->addAction(zoomOutViewAction);
+ m_zoomMenu->addAction(zoomOriginAction);
+ m_zoomMenu->addAction(zoomFitPageHeightAction);
+ m_zoomMenu->addAction(zoomFitPageWidthAction);
+ m_zoomMenu->addAction(zoomFitSelectionAction);
- m_layoutMenu = new QMenu(i18n("Layout"));
- m_layoutMenu->addAction(verticalLayoutAction);
- m_layoutMenu->addAction(horizontalLayoutAction);
- m_layoutMenu->addAction(gridLayoutAction);
- m_layoutMenu->addSeparator();
- m_layoutMenu->addAction(breakLayoutAction);
+ m_magnificationMenu = new QMenu(i18n("Magnification"));
- m_magnificationMenu->setIcon(KIcon("labplot-zoom"));
++ m_magnificationMenu->setIcon(QIcon::fromTheme("labplot-zoom"));
+ m_magnificationMenu->addAction(noMagnificationAction);
+ m_magnificationMenu->addAction(twoTimesMagnificationAction);
+ m_magnificationMenu->addAction(threeTimesMagnificationAction);
+ m_magnificationMenu->addAction(fourTimesMagnificationAction);
+ m_magnificationMenu->addAction(fiveTimesMagnificationAction);
+
+ m_layoutMenu = new QMenu(i18n("Layout"));
+ m_layoutMenu->addAction(verticalLayoutAction);
+ m_layoutMenu->addAction(horizontalLayoutAction);
+ m_layoutMenu->addAction(gridLayoutAction);
+ m_layoutMenu->addSeparator();
+ m_layoutMenu->addAction(breakLayoutAction);
- m_gridMenu = new QMenu(i18n("Grid"));
- m_gridMenu->setIcon(KIcon("view-grid"));
- m_gridMenu->addAction(noGridAction);
- m_gridMenu->addSeparator();
- m_gridMenu->addAction(sparseLineGridAction);
- m_gridMenu->addAction(denseLineGridAction);
- m_gridMenu->addSeparator();
- m_gridMenu->addAction(sparseDotGridAction);
- m_gridMenu->addAction(denseDotGridAction);
- m_gridMenu->addSeparator();
- m_gridMenu->addAction(customGridAction);
- //TODO: implement "snap to grid" and activate this action
+ m_gridMenu = new QMenu(i18n("Grid"));
+ m_gridMenu->setIcon(QIcon::fromTheme("view-grid"));
+ m_gridMenu->addAction(noGridAction);
+ m_gridMenu->addSeparator();
+ m_gridMenu->addAction(sparseLineGridAction);
+ m_gridMenu->addAction(denseLineGridAction);
+ m_gridMenu->addSeparator();
+ m_gridMenu->addAction(sparseDotGridAction);
+ m_gridMenu->addAction(denseDotGridAction);
+ m_gridMenu->addSeparator();
+ m_gridMenu->addAction(customGridAction);
+ //TODO: implement "snap to grid" and activate this action
// m_gridMenu->addSeparator();
// m_gridMenu->addAction(snapToGridAction);
- m_cartesianPlotMenu = new QMenu(i18n("Cartesian Plot"));
+ m_cartesianPlotMenu = new QMenu(i18n("Cartesian Plot"));
- m_cartesianPlotMouseModeMenu = new QMenu(i18n("Mouse Mode"));
- m_cartesianPlotMouseModeMenu->setIcon(KIcon("input-mouse"));
- m_cartesianPlotMouseModeMenu->addAction(cartesianPlotSelectionModeAction);
- m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomSelectionModeAction);
- m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomXSelectionModeAction);
- m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomYSelectionModeAction);
- m_cartesianPlotMouseModeMenu->addSeparator();
+ m_cartesianPlotMouseModeMenu = new QMenu(i18n("Mouse Mode"));
+ m_cartesianPlotMouseModeMenu->setIcon(QIcon::fromTheme("input-mouse"));
+ m_cartesianPlotMouseModeMenu->addAction(cartesianPlotSelectionModeAction);
+ m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomSelectionModeAction);
+ m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomXSelectionModeAction);
+ m_cartesianPlotMouseModeMenu->addAction(cartesianPlotZoomYSelectionModeAction);
+ m_cartesianPlotMouseModeMenu->addSeparator();
- m_cartesianPlotAddNewMenu = new QMenu(i18n("Add new"));
- m_cartesianPlotAddNewMenu->addAction(addCurveAction);
- m_cartesianPlotAddNewMenu->addAction(addEquationCurveAction);
- m_cartesianPlotAddNewMenu->addAction(addFitCurveAction);
- m_cartesianPlotAddNewMenu->addAction(addLegendAction);
- m_cartesianPlotAddNewMenu->addSeparator();
- m_cartesianPlotAddNewMenu->addAction(addHorizontalAxisAction);
- m_cartesianPlotAddNewMenu->addAction(addVerticalAxisAction);
+ m_cartesianPlotAddNewMenu = new QMenu(i18n("Add new"));
+ m_cartesianPlotAddNewMenu->addAction(addCurveAction);
+ m_cartesianPlotAddNewMenu->addAction(addEquationCurveAction);
+ m_cartesianPlotAddNewMenu->addAction(addFitCurveAction);
+ m_cartesianPlotAddNewMenu->addAction(addLegendAction);
+ m_cartesianPlotAddNewMenu->addSeparator();
+ m_cartesianPlotAddNewMenu->addAction(addHorizontalAxisAction);
+ m_cartesianPlotAddNewMenu->addAction(addVerticalAxisAction);
+ m_cartesianPlotAddNewMenu->addSeparator();
+ m_cartesianPlotAddNewMenu->addAction(addCustomPointAction);
- m_cartesianPlotZoomMenu = new QMenu(i18n("Zoom/Navigate"));
- m_cartesianPlotZoomMenu->setIcon(KIcon("zoom-draw"));
- m_cartesianPlotZoomMenu->addAction(scaleAutoAction);
- m_cartesianPlotZoomMenu->addAction(scaleAutoXAction);
- m_cartesianPlotZoomMenu->addAction(scaleAutoYAction);
- m_cartesianPlotZoomMenu->addSeparator();
- m_cartesianPlotZoomMenu->addAction(zoomInAction);
- m_cartesianPlotZoomMenu->addAction(zoomOutAction);
- m_cartesianPlotZoomMenu->addSeparator();
- m_cartesianPlotZoomMenu->addAction(zoomInXAction);
- m_cartesianPlotZoomMenu->addAction(zoomOutXAction);
- m_cartesianPlotZoomMenu->addSeparator();
- m_cartesianPlotZoomMenu->addAction(zoomInYAction);
- m_cartesianPlotZoomMenu->addAction(zoomOutYAction);
- m_cartesianPlotZoomMenu->addSeparator();
- m_cartesianPlotZoomMenu->addAction(shiftLeftXAction);
- m_cartesianPlotZoomMenu->addAction(shiftRightXAction);
- m_cartesianPlotZoomMenu->addSeparator();
- m_cartesianPlotZoomMenu->addAction(shiftUpYAction);
- m_cartesianPlotZoomMenu->addAction(shiftDownYAction);
-
- m_cartesianPlotActionModeMenu = new QMenu(i18n("Apply actions to"));
- m_cartesianPlotActionModeMenu->addAction(cartesianPlotApplyToSelectionAction);
- m_cartesianPlotActionModeMenu->addAction(cartesianPlotApplyToAllAction);
-
- m_cartesianPlotMenu->addMenu(m_cartesianPlotMouseModeMenu);
- m_cartesianPlotMenu->addMenu(m_cartesianPlotAddNewMenu);
- m_cartesianPlotMenu->addMenu(m_cartesianPlotZoomMenu);
- m_cartesianPlotMenu->addSeparator();
- m_cartesianPlotMenu->addMenu(m_cartesianPlotActionModeMenu);
+ m_cartesianPlotZoomMenu = new QMenu(i18n("Zoom/Navigate"));
+ m_cartesianPlotZoomMenu->setIcon(QIcon::fromTheme("zoom-draw"));
+ m_cartesianPlotZoomMenu->addAction(scaleAutoAction);
+ m_cartesianPlotZoomMenu->addAction(scaleAutoXAction);
+ m_cartesianPlotZoomMenu->addAction(scaleAutoYAction);
+ m_cartesianPlotZoomMenu->addSeparator();
+ m_cartesianPlotZoomMenu->addAction(zoomInAction);
+ m_cartesianPlotZoomMenu->addAction(zoomOutAction);
+ m_cartesianPlotZoomMenu->addSeparator();
+ m_cartesianPlotZoomMenu->addAction(zoomInXAction);
+ m_cartesianPlotZoomMenu->addAction(zoomOutXAction);
+ m_cartesianPlotZoomMenu->addSeparator();
+ m_cartesianPlotZoomMenu->addAction(zoomInYAction);
+ m_cartesianPlotZoomMenu->addAction(zoomOutYAction);
+ m_cartesianPlotZoomMenu->addSeparator();
+ m_cartesianPlotZoomMenu->addAction(shiftLeftXAction);
+ m_cartesianPlotZoomMenu->addAction(shiftRightXAction);
+ m_cartesianPlotZoomMenu->addSeparator();
+ m_cartesianPlotZoomMenu->addAction(shiftUpYAction);
+ m_cartesianPlotZoomMenu->addAction(shiftDownYAction);
+
+ m_cartesianPlotActionModeMenu = new QMenu(i18n("Apply actions to"));
+ m_cartesianPlotActionModeMenu->addAction(cartesianPlotApplyToSelectionAction);
+ m_cartesianPlotActionModeMenu->addAction(cartesianPlotApplyToAllAction);
+
+ m_cartesianPlotMenu->addMenu(m_cartesianPlotMouseModeMenu);
+ m_cartesianPlotMenu->addMenu(m_cartesianPlotAddNewMenu);
+ m_cartesianPlotMenu->addMenu(m_cartesianPlotZoomMenu);
+ m_cartesianPlotMenu->addSeparator();
+ m_cartesianPlotMenu->addMenu(m_cartesianPlotActionModeMenu);
}
/*!
@@@ -428,29 -460,35 +460,35 @@@ void WorksheetView::createContextMenu(Q
}
void WorksheetView::fillToolBar(QToolBar* toolBar){
- toolBar->addSeparator();
- tbNewCartesianPlot = new QToolButton(toolBar);
- tbNewCartesianPlot->setPopupMode(QToolButton::MenuButtonPopup);
- tbNewCartesianPlot->setMenu(m_addNewCartesianPlotMenu);
- tbNewCartesianPlot->setDefaultAction(addCartesianPlot1Action);
- toolBar->addWidget(tbNewCartesianPlot);
- toolBar->addAction(addTextLabelAction);
-
- toolBar->addSeparator();
- toolBar->addAction(verticalLayoutAction);
- toolBar->addAction(horizontalLayoutAction);
- toolBar->addAction(gridLayoutAction);
- toolBar->addAction(breakLayoutAction);
+ toolBar->addSeparator();
+ tbNewCartesianPlot = new QToolButton(toolBar);
+ tbNewCartesianPlot->setPopupMode(QToolButton::MenuButtonPopup);
+ tbNewCartesianPlot->setMenu(m_addNewCartesianPlotMenu);
+ tbNewCartesianPlot->setDefaultAction(addCartesianPlot1Action);
+ toolBar->addWidget(tbNewCartesianPlot);
+ toolBar->addAction(addTextLabelAction);
+
+ toolBar->addSeparator();
+ toolBar->addAction(verticalLayoutAction);
+ toolBar->addAction(horizontalLayoutAction);
+ toolBar->addAction(gridLayoutAction);
+ toolBar->addAction(breakLayoutAction);
- toolBar->addSeparator();
- toolBar->addAction(selectionModeAction);
- toolBar->addAction(navigationModeAction);
- toolBar->addAction(zoomSelectionModeAction);
- tbZoom = new QToolButton(toolBar);
- tbZoom->setPopupMode(QToolButton::MenuButtonPopup);
- tbZoom->setMenu(m_zoomMenu);
- tbZoom->setDefaultAction(currentZoomAction);
- toolBar->addWidget(tbZoom);
+ toolBar->addSeparator();
+ toolBar->addAction(selectionModeAction);
+ toolBar->addAction(navigationModeAction);
+ toolBar->addAction(zoomSelectionModeAction);
+ tbZoom = new QToolButton(toolBar);
+ tbZoom->setPopupMode(QToolButton::MenuButtonPopup);
+ tbZoom->setMenu(m_zoomMenu);
+ tbZoom->setDefaultAction(currentZoomAction);
+ toolBar->addWidget(tbZoom);
+
+ tbMagnification = new QToolButton(toolBar);
+ tbMagnification->setPopupMode(QToolButton::MenuButtonPopup);
+ tbMagnification->setMenu(m_magnificationMenu);
+ tbMagnification->setDefaultAction(currentMagnificationAction);
+ toolBar->addWidget(tbMagnification);
}
void WorksheetView::fillCartesianPlotToolBar(QToolBar* toolBar) {
@@@ -710,42 -748,78 +748,79 @@@ void WorksheetView::mouseReleaseEvent(Q
}
void WorksheetView::mouseMoveEvent(QMouseEvent* event) {
- if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode != CartesianPlot::SelectionMode ) {
- //check whether there is a cartesian plot under the cursor
- bool plot = false;
- QGraphicsItem* item = itemAt(event->pos());
- if (item) {
- plot = item->data(0).toInt() == WorksheetElement::NameCartesianPlot;
- if (!plot && item->parentItem())
- plot = item->parentItem()->data(0).toInt() == WorksheetElement::NameCartesianPlot;
- }
+ if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode != CartesianPlot::SelectionMode ) {
+ //check whether there is a cartesian plot under the cursor
+ bool plot = false;
+ QGraphicsItem* item = itemAt(event->pos());
+ if (item) {
+ plot = item->data(0).toInt() == WorksheetElement::NameCartesianPlot;
+ if (!plot && item->parentItem())
+ plot = item->parentItem()->data(0).toInt() == WorksheetElement::NameCartesianPlot;
+ }
- //set the cursor appearance according to the current mouse mode for the cartesian plots
- if (plot) {
- if (m_cartesianPlotMouseMode == CartesianPlot::ZoomSelectionMode) {
- setCursor(Qt::CrossCursor);
- } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomXSelectionMode) {
- setCursor(Qt::SizeHorCursor);
- } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomYSelectionMode) {
- setCursor(Qt::SizeVerCursor);
- }
- } else {
- setCursor(Qt::ArrowCursor);
- }
- } else if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode == CartesianPlot::SelectionMode ) {
- setCursor(Qt::ArrowCursor);
- } else if (m_selectionBandIsShown) {
- QRect rect = QRect(m_selectionStart, m_selectionEnd).normalized();
- m_selectionEnd = event->pos();
- rect = rect.united(QRect(m_selectionStart, m_selectionEnd).normalized());
- int penWidth = 5/transform().m11();
- rect.setX(rect.x()-penWidth);
- rect.setY(rect.y()-penWidth);
- rect.setHeight(rect.height()+2*penWidth);
- rect.setWidth(rect.width()+2*penWidth);
- viewport()->repaint(rect);
- }
- QGraphicsView::mouseMoveEvent(event);
+ //set the cursor appearance according to the current mouse mode for the cartesian plots
+ if (plot) {
+ if (m_cartesianPlotMouseMode == CartesianPlot::ZoomSelectionMode) {
+ setCursor(Qt::CrossCursor);
+ } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomXSelectionMode) {
+ setCursor(Qt::SizeHorCursor);
+ } else if (m_cartesianPlotMouseMode == CartesianPlot::ZoomYSelectionMode) {
+ setCursor(Qt::SizeVerCursor);
+ }
+ } else {
+ setCursor(Qt::ArrowCursor);
+ }
+ } else if (m_mouseMode == SelectionMode && m_cartesianPlotMouseMode == CartesianPlot::SelectionMode ) {
+ setCursor(Qt::ArrowCursor);
+ } else if (m_selectionBandIsShown) {
+ QRect rect = QRect(m_selectionStart, m_selectionEnd).normalized();
+ m_selectionEnd = event->pos();
+ rect = rect.united(QRect(m_selectionStart, m_selectionEnd).normalized());
+ int penWidth = 5/transform().m11();
+ rect.setX(rect.x()-penWidth);
+ rect.setY(rect.y()-penWidth);
+ rect.setHeight(rect.height()+2*penWidth);
+ rect.setWidth(rect.width()+2*penWidth);
+ viewport()->repaint(rect);
+ }
+
+ //show the magnification window
+ if (magnificationFactor /*&& m_mouseMode == SelectAndEditMode*/) {
+ if (!m_magnificationWindow) {
- m_magnificationWindow = new QGraphicsPixmapItem(0, scene());
++ m_magnificationWindow = new QGraphicsPixmapItem(0);
+ m_magnificationWindow->setZValue(std::numeric_limits<int>::max());
++ scene()->addItem(m_magnificationWindow);
+ }
+
+ m_magnificationWindow->setVisible(false);
+
+ //copy the part of the view to be shown magnified
+ QPointF pos = mapToScene(event->pos());
+ const int size = Worksheet::convertToSceneUnits(2.0, Worksheet::Centimeter)/transform().m11();
+ const QRectF copyRect(pos.x() - size/2, pos.y() - size/2, size, size);
+ QPixmap px = QPixmap::grabWidget(this, mapFromScene(copyRect).boundingRect());
+ px = px.scaled(size*magnificationFactor, size*magnificationFactor, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ px = px.copy(px.width()/2 - size/2, px.height()/2 - size/2, size, size);
+
+ //draw the bounding rect
+ QPainter painter(&px);
+ const QPen pen = QPen(Qt::lightGray, 2/transform().m11());
+ painter.setPen(pen);
+ QRect rect = px.rect();
+ rect.setWidth(rect.width()-pen.widthF()/2);
+ rect.setHeight(rect.height()-pen.widthF()/2);
+ painter.drawRect(rect);
+
+ //set the pixmap
+ m_magnificationWindow->setPixmap(px);
+ m_magnificationWindow->setPos(pos.x()- px.width()/2, pos.y()- px.height()/2);
+
+ m_magnificationWindow->setVisible(true);
+ } else if (m_magnificationWindow) {
+ m_magnificationWindow->setVisible(false);
+ }
+
+ QGraphicsView::mouseMoveEvent(event);
}
void WorksheetView::contextMenuEvent(QContextMenuEvent* e) {
@@@ -816,20 -890,37 +891,37 @@@ void WorksheetView::changeZoom(QAction
tbZoom->setDefaultAction(action);
}
+ void WorksheetView::magnificationChanged(QAction* action){
+ if (action==noMagnificationAction)
+ magnificationFactor = 0;
+ else if (action==twoTimesMagnificationAction)
+ magnificationFactor = 2;
+ else if (action==threeTimesMagnificationAction)
+ magnificationFactor = 3;
+ else if (action==fourTimesMagnificationAction)
+ magnificationFactor = 4;
+ else if (action==fiveTimesMagnificationAction)
+ magnificationFactor = 5;
+
+ currentMagnificationAction=action;
+ if (tbMagnification)
+ tbMagnification->setDefaultAction(action);
+ }
+
void WorksheetView::mouseModeChanged(QAction* action) {
- if (action==selectionModeAction) {
- m_mouseMode = SelectionMode;
- setInteractive(true);
- setDragMode(QGraphicsView::NoDrag);
- } else if (action==navigationModeAction) {
- m_mouseMode = NavigationMode;
- setInteractive(false);
- setDragMode(QGraphicsView::ScrollHandDrag);
- } else {
- m_mouseMode = ZoomSelectionMode;
- setInteractive(false);
- setDragMode(QGraphicsView::NoDrag);
- }
+ if (action==selectionModeAction) {
+ m_mouseMode = SelectionMode;
+ setInteractive(true);
+ setDragMode(QGraphicsView::NoDrag);
+ } else if (action==navigationModeAction) {
+ m_mouseMode = NavigationMode;
+ setInteractive(false);
+ setDragMode(QGraphicsView::ScrollHandDrag);
+ } else {
+ m_mouseMode = ZoomSelectionMode;
+ setInteractive(false);
+ setDragMode(QGraphicsView::NoDrag);
+ }
}
//"Add new" related slots
@@@ -1261,26 -1352,27 +1353,27 @@@ void WorksheetView::exportToFile(const
}
void WorksheetView::exportPaint(QPainter* painter, const QRectF& targetRect, const QRectF& sourceRect, const bool background) {
- //draw the background
- if (background) {
- painter->save();
- painter->scale(targetRect.width()/sourceRect.width(), targetRect.height()/sourceRect.height());
- drawBackground(painter, sourceRect);
- painter->restore();
- }
+ //draw the background
+ if (background) {
+ painter->save();
+ painter->scale(targetRect.width()/sourceRect.width(), targetRect.height()/sourceRect.height());
+ drawBackground(painter, sourceRect);
+ painter->restore();
+ }
- //draw the scene items
- m_worksheet->setPrinting(true);
- scene()->render(painter, QRectF(), sourceRect);
- m_worksheet->setPrinting(false);
+ //draw the scene items
+ m_worksheet->setPrinting(true);
+ scene()->render(painter, QRectF(), sourceRect);
+ m_worksheet->setPrinting(false);
}
- void WorksheetView::print(QPrinter* printer) const{
- m_worksheet->setPrinting(true);
- QPainter painter(printer);
- painter.setRenderHint(QPainter::Antialiasing);
- scene()->render(&painter);
- m_worksheet->setPrinting(false);
+ void WorksheetView::print(QPrinter* printer) {
+ m_worksheet->setPrinting(true);
+ QPainter painter(printer);
+ painter.setRenderHint(QPainter::Antialiasing);
+ drawBackground(&painter, scene()->sceneRect());
+ scene()->render(&painter);
+ m_worksheet->setPrinting(false);
}
void WorksheetView::updateBackground(){
@@@ -1332,97 -1424,48 +1425,48 @@@ void WorksheetView::cartesianPlotAction
}
void WorksheetView::cartesianPlotMouseModeChanged(QAction* action) {
- if (action==cartesianPlotSelectionModeAction) {
- m_cartesianPlotMouseMode = CartesianPlot::SelectionMode;
- } else if (action==cartesianPlotZoomSelectionModeAction) {
- m_cartesianPlotMouseMode = CartesianPlot::ZoomSelectionMode;
- } else if (action==cartesianPlotZoomXSelectionModeAction) {
- m_cartesianPlotMouseMode = CartesianPlot::ZoomXSelectionMode;
- } else if (action==cartesianPlotZoomYSelectionModeAction) {
- m_cartesianPlotMouseMode = CartesianPlot::ZoomYSelectionMode;
- }
+ if (action==cartesianPlotSelectionModeAction) {
+ m_cartesianPlotMouseMode = CartesianPlot::SelectionMode;
+ } else if (action==cartesianPlotZoomSelectionModeAction) {
+ m_cartesianPlotMouseMode = CartesianPlot::ZoomSelectionMode;
+ } else if (action==cartesianPlotZoomXSelectionModeAction) {
+ m_cartesianPlotMouseMode = CartesianPlot::ZoomXSelectionMode;
+ } else if (action==cartesianPlotZoomYSelectionModeAction) {
+ m_cartesianPlotMouseMode = CartesianPlot::ZoomYSelectionMode;
+ }
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->setMouseMode(m_cartesianPlotMouseMode);
- }
+ foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
+ plot->setMouseMode(m_cartesianPlotMouseMode);
+ }
}
- void WorksheetView::addCurve() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addCurve();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addCurve();
- }
- }
- }
-
- void WorksheetView::addEquationCurve() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addEquationCurve();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addEquationCurve();
- }
- }
- }
-
- void WorksheetView::addFitCurve() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addFitCurve();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addFitCurve();
- }
- }
- }
-
- void WorksheetView::addLegend() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addLegend();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addLegend();
- }
- }
- }
-
- void WorksheetView::addHorizontalAxis() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addHorizontalAxis();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addHorizontalAxis();
- }
- }
+ void WorksheetView::cartesianPlotAddNew(QAction* action) {
+ if (m_cartesianPlotActionMode == ApplyActionToSelection) {
+ foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
+ if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
+ this->cartesianPlotAdd(plot, action);
+ }
+ } else {
+ foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() )
+ this->cartesianPlotAdd(plot, action);
+ }
}
- void WorksheetView::addVerticalAxis() {
- if (m_cartesianPlotActionMode == ApplyActionToSelection) {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- if (m_selectedItems.indexOf(plot->graphicsItem())!=-1)
- plot->addVerticalAxis();
- }
- } else {
- foreach(CartesianPlot* plot, m_worksheet->children<CartesianPlot>() ){
- plot->addVerticalAxis();
- }
- }
+ void WorksheetView::cartesianPlotAdd(CartesianPlot* plot, QAction* action) {
+ if (action==addCurveAction)
+ plot->addCurve();
+ else if (action==addEquationCurveAction)
+ plot->addEquationCurve();
+ else if (action==addFitCurveAction)
+ plot->addFitCurve();
+ else if (action==addLegendAction)
+ plot->addLegend();
+ else if (action==addHorizontalAxisAction)
+ plot->addHorizontalAxis();
+ else if (action==addVerticalAxisAction)
+ plot->addVerticalAxis();
+ else if (action==addCustomPointAction)
+ plot->addCustomPoint();
}
void WorksheetView::cartesianPlotNavigationChanged(QAction* action) {
diff --cc src/kdefrontend/MainWin.cpp
index 984e625,f5c8bcf..7b7651c
--- a/src/kdefrontend/MainWin.cpp
+++ b/src/kdefrontend/MainWin.cpp
@@@ -58,11 -57,7 +57,8 @@@
#include <QDockWidget>
#include <QStackedWidget>
#include <QUndoStack>
- #include <QPrinter>
- #include <QPrintDialog>
- #include <QPrintPreviewDialog>
#include <QCloseEvent>
+#include <QFileDialog>
#include <QElapsedTimer>
#include <QDebug>
diff --cc src/kdefrontend/SettingsDialog.cpp
index 0b2c2c0,984f870..09316d5
--- a/src/kdefrontend/SettingsDialog.cpp
+++ b/src/kdefrontend/SettingsDialog.cpp
@@@ -49,88 -40,60 +49,89 @@@ SettingsDialog::SettingsDialog(QWidget
const QSize minSize = minimumSize();
setMinimumSize(QSize(512, minSize.height()));
+
- setFaceType(List);
- setWindowTitle(i18n("Preferences"));
- QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
+ setFaceType(List);
- setCaption(i18n("Preferences"));
- setWindowIcon(KIcon("preferences-other"));
- setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Default);
- setDefaultButton(KDialog::Ok);
- enableButton(KDialog::Apply, false);
++ setWindowTitle(i18n("Preferences"));
++ setWindowIcon(QIcon::fromTheme("preferences-other"));
++ QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
+
- QPushButton* okbutton = dialogButtonBox->addButton(QDialogButtonBox::Ok);
- connect( okbutton, &QAbstractButton::clicked, this, &SettingsDialog::onOkButton );
++ QPushButton* okbutton = dialogButtonBox->addButton(QDialogButtonBox::Ok);
++ connect( okbutton, &QAbstractButton::clicked, this, &SettingsDialog::onOkButton );
- applybutton = dialogButtonBox->addButton(QDialogButtonBox::Apply);
- connect( applybutton, &QAbstractButton::clicked, this, &SettingsDialog::onApplyButton );
++ applybutton = dialogButtonBox->addButton(QDialogButtonBox::Apply);
++ connect( applybutton, &QAbstractButton::clicked, this, &SettingsDialog::onApplyButton );
generalPage = new SettingsGeneralPage(this);
KPageWidgetItem* generalFrame = addPage(generalPage, i18n("General"));
- generalFrame->setIcon(QIcon::fromTheme("system-run"));
- generalFrame->setIcon(KIcon("system-run"));
++ generalFrame->setIcon(QIcon::fromTheme("system-run"));
+
- dialogButtonBox->addButton(QDialogButtonBox::Cancel);
++ dialogButtonBox->addButton(QDialogButtonBox::Cancel);
+
- QPushButton* defaultbutton = dialogButtonBox->addButton(QDialogButtonBox::RestoreDefaults);
- connect( defaultbutton, &QAbstractButton::clicked, this, &SettingsDialog::onRestoreDefaultsButton );
++ QPushButton* defaultbutton = dialogButtonBox->addButton(QDialogButtonBox::RestoreDefaults);
++ connect( defaultbutton, &QAbstractButton::clicked, this, &SettingsDialog::onRestoreDefaultsButton );
+
- okbutton->setDefault(true);
- applybutton->setEnabled(false);
++ okbutton->setDefault(true);
++ applybutton->setEnabled(false);
+
- QVBoxLayout* layout = new QVBoxLayout;
- layout->addWidget( dialogButtonBox );
- setLayout( layout );
- generalFrame->setIcon(QIcon::fromTheme("system-run"));
- connect(generalPage, SIGNAL(settingsChanged()), this, SLOT(changed()));
++ QVBoxLayout* layout = new QVBoxLayout;
++ layout->addWidget( dialogButtonBox );
++ setLayout( layout );
++ generalFrame->setIcon(QIcon::fromTheme("system-run"));
+ connect(generalPage, SIGNAL(settingsChanged()), this, SLOT(changed()));
- KConfigGroup conf(KSharedConfig::openConfig(), "SettingsDialog");
- restoreDialogSize(conf);
+// printingPage = new SettingsPrintingPage(mainWindow, this);
+// KPageWidgetItem* printingFrame = addPage(printingPage, i18nc("@title:group", "Print"));
+// printingFrame->setIcon(KIcon("document-print"));
+
- const KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
- KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
++ const KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
++ KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
}
-SettingsDialog::~SettingsDialog() {
- KConfigGroup conf(KSharedConfig::openConfig(), "SettingsDialog");
- saveDialogSize(conf);
+SettingsDialog::~SettingsDialog(){
- KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
- KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
++ KConfigGroup dialogConfig = KSharedConfig::openConfig()->group("SettingsDialog");
++ KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
-void SettingsDialog::slotButtonClicked(int button) {
- if ((button == KDialog::Ok) || (button == KDialog::Apply)) {
- if (m_changed){
- applySettings();
- setCaption(i18n("Preferences"));
- enableButton(KDialog::Apply, false);
- }
- } else if (button == KDialog::Default) {
- const QString text(i18n("All settings will be reset to default values. Do you want to continue?"));
- if (KMessageBox::questionYesNo(this, text) == KMessageBox::Yes) {
- restoreDefaults();
- setCaption(i18n("Preferences"));
- enableButton(KDialog::Apply, false);
- }
+void SettingsDialog::onOkButton(){
- if (m_changed){
- applySettings();
- setWindowTitle(i18n("Preferences"));
- applybutton->setEnabled(false);
- }
++ if (m_changed){
++ applySettings();
++ setWindowTitle(i18n("Preferences"));
++ applybutton->setEnabled(false);
+ }
+}
- KPageDialog::slotButtonClicked(button);
+void SettingsDialog::onApplyButton(){
- if (m_changed){
- applySettings();
- setWindowTitle(i18n("Preferences"));
- applybutton->setEnabled(false);
- }
++ if (m_changed){
++ applySettings();
++ setWindowTitle(i18n("Preferences"));
++ applybutton->setEnabled(false);
++ }
+}
+
+void SettingsDialog::onRestoreDefaultsButton(){
- const QString text(i18n("All settings will be reset to default values. Do you want to continue?"));
- if (KMessageBox::questionYesNo(this, text) == KMessageBox::Yes) {
- restoreDefaults();
- setWindowTitle(i18n("Preferences"));
- applybutton->setEnabled(false);
- }
++ const QString text(i18n("All settings will be reset to default values. Do you want to continue?"));
++ if (KMessageBox::questionYesNo(this, text) == KMessageBox::Yes) {
++ restoreDefaults();
++ setWindowTitle(i18n("Preferences"));
++ applybutton->setEnabled(false);
++ }
}
void SettingsDialog::changed() {
- m_changed = true;
- setWindowTitle(i18n("Preferences [Changed]"));
- applybutton->setEnabled(true);
+ m_changed = true;
- setCaption(i18n("Preferences [Changed]"));
- enableButton(KDialog::Apply, true);
++ setWindowTitle(i18n("Preferences [Changed]"));
++ applybutton->setEnabled(true);
}
-void SettingsDialog::applySettings() {
+void SettingsDialog::applySettings(){
- m_changed = false;
+ m_changed = false;
generalPage->applySettings();
- KGlobal::config()->sync();
+// printingPage->applySettings();
- KSharedConfig::openConfig()->sync();
- emit settingsChanged();
++ KSharedConfig::openConfig()->sync();
+ emit settingsChanged();
}
void SettingsDialog::restoreDefaults(){
- m_changed = false;
+ m_changed = false;
generalPage->restoreDefaults();
+// printingPage->restoreDefaults();
}
diff --cc src/kdefrontend/SettingsDialog.h
index 1502f72,cdf138c..c8d9048
--- a/src/kdefrontend/SettingsDialog.h
+++ b/src/kdefrontend/SettingsDialog.h
@@@ -29,35 -28,32 +29,35 @@@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
-#include <KPageDialog>
+#include <kpagedialog.h>
class SettingsGeneralPage;
+// class SettingsPrintingPage;
class SettingsDialog : public KPageDialog {
- Q_OBJECT
+ Q_OBJECT
- public:
- explicit SettingsDialog(QWidget*);
- virtual ~SettingsDialog();
+public:
- explicit SettingsDialog(QWidget*);
- virtual ~SettingsDialog();
++ explicit SettingsDialog(QWidget*);
++ virtual ~SettingsDialog();
- private slots:
- void changed();
+private slots:
+ void changed();
- void onOkButton();
- void onApplyButton();
- void onRestoreDefaultsButton();
++ void onOkButton();
++ void onApplyButton();
++ void onRestoreDefaultsButton();
- protected slots:
- virtual void slotButtonClicked(int button);
+private:
+ bool m_changed;
- QPushButton* applybutton;
- SettingsGeneralPage* generalPage;
++ QPushButton* applybutton;
++ SettingsGeneralPage* generalPage;
+// SettingsPrintingPage* printingPage;
- void applySettings();
- void restoreDefaults();
- private:
- bool m_changed;
- SettingsGeneralPage* generalPage;
++ void applySettings();
++ void restoreDefaults();
- void applySettings();
- void restoreDefaults();
-
- signals:
- void settingsChanged();
+signals:
+ void settingsChanged();
};
#endif
diff --cc src/kdefrontend/datasources/ImportFileDialog.cpp
index 33a6311,049aa35..718c51f
--- a/src/kdefrontend/datasources/ImportFileDialog.cpp
+++ b/src/kdefrontend/datasources/ImportFileDialog.cpp
@@@ -46,12 -46,8 +46,10 @@@
#include <QStatusBar>
#include <QDir>
#include <QInputDialog>
- #include <KSharedConfig>
-#include <KMenu>
++#include <KSharedConfig>
+#include <KLocalizedString>
- #include <QToolButton>
+#include <QMenu>
-
/*!
\class ImportFileDialog
\brief Dialog for importing data from a file. Embeds \c ImportFileWidget and provides the standard buttons.
@@@ -93,15 -80,24 +82,24 @@@ ImportFileDialog::ImportFileDialog(Main
connect(importFileWidget, SIGNAL(fileNameChanged()), this, SLOT(checkOkButton()));
setCaption(i18n("Import Data to Spreadsheet or Matrix"));
- setWindowIcon(KIcon("document-import-database"));
+ setWindowIcon(QIcon::fromTheme("document-import-database"));
- resize( QSize(500,0).expandedTo(minimumSize()) );
+
+ //restore saved settings
+ KConfigGroup conf(KSharedConfig::openConfig(),"ImportFileDialog");
+ m_showOptions = conf.readEntry("ShowOptions", false);
+ m_showOptions ? setButtonText(KDialog::User1, i18n("Hide Options")) : setButtonText(KDialog::User1, i18n("Show Options"));
+ importFileWidget->showOptions(m_showOptions);
+ restoreDialogSize(conf);
}
- ImportFileDialog::~ImportFileDialog(){
+ ImportFileDialog::~ImportFileDialog() {
+ //save current settings
KConfigGroup conf(KSharedConfig::openConfig(),"ImportFileDialog");
- conf.writeEntry("ShowOptions", m_optionsShown);
+ conf.writeEntry("ShowOptions", m_showOptions);
if (cbPosition)
conf.writeEntry("Position", cbPosition->currentIndex());
+
+ saveDialogSize(conf);
}
/*!
diff --cc src/kdefrontend/datasources/ImportFileDialog.h
index a11567a,16e4044..b1e9b7f
--- a/src/kdefrontend/datasources/ImportFileDialog.h
+++ b/src/kdefrontend/datasources/ImportFileDialog.h
@@@ -71,8 -72,8 +71,8 @@@ class ImportFileDialog: public KDialog
QPushButton* bNewMatrix;
QPushButton* bNewWorkbook;
QToolButton* tbNewDataContainer;
- bool m_optionsShown;
+ bool m_showOptions;
- KMenu* m_newDataContainerMenu;
+ QMenu* m_newDataContainerMenu;
private slots:
void toggleOptions();
diff --cc src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
index a326002,765b44c..31c4ea9
--- a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
+++ b/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
@@@ -37,8 -37,8 +37,9 @@@
#include <QTimer>
#include <QDir>
#include <QFileDialog>
+ #include <QImageReader>
#include <KUrlCompletion>
+#include <KLocalizedString>
#include <math.h>
@@@ -739,12 -738,19 +740,19 @@@ void CartesianPlotDock::backgroundSecon
}
/*!
- opens a file dialog and lets the user select the image file.
+ opens a file dialog and lets the user select the image file.
*/
void CartesianPlotDock::selectFile() {
- KConfigGroup conf(KSharedConfig::openConfig(), "CartesianPlotDock");
- QString dir = conf.readEntry("LastImageDir", "");
+ KConfigGroup conf(KSharedConfig::openConfig(), "CartesianPlotDock");
+ QString dir = conf.readEntry("LastImageDir", "");
- QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), dir);
+
+ QString formats;
+ foreach(QByteArray format, QImageReader::supportedImageFormats()) {
+ QString f = "*." + QString(format.constData());
+ formats.isEmpty() ? formats+=f : formats+=" "+f;
+ }
+
+ QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), dir, i18n("Images (%1)").arg(formats));
if (path.isEmpty())
return; //cancel was clicked in the file-dialog
@@@ -1172,52 -1178,53 +1180,53 @@@ void CartesianPlotDock::loadConfig(KCon
}
void CartesianPlotDock::saveConfigAsTemplate(KConfig& config) {
-// KConfigGroup group = config.group( "CartesianPlot" );
-
- //General-tab
- //TODO: decide whether to save properties, not related to the appearance/style of the plot
-// group.writeEntry("Visible", ui.chkVisible->isChecked());
-// group.writeEntry("Left", Worksheet::convertToSceneUnits(ui.sbLeft->value(), Worksheet::Centimeter));
-// group.writeEntry("Top", Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::Centimeter));
-// group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->value(), Worksheet::Centimeter));
-// group.writeEntry("Height", Worksheet::convertToSceneUnits(ui.sbHeight->value(), Worksheet::Centimeter));
+// KConfigGroup group = config.group( "CartesianPlot" );
+
+ //General-tab
+ //TODO: decide whether to save properties, not related to the appearance/style of the plot
+// group.writeEntry("Visible", ui.chkVisible->isChecked());
+// group.writeEntry("Left", Worksheet::convertToSceneUnits(ui.sbLeft->value(), Worksheet::Centimeter));
+// group.writeEntry("Top", Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::Centimeter));
+// group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->value(), Worksheet::Centimeter));
+// group.writeEntry("Height", Worksheet::convertToSceneUnits(ui.sbHeight->value(), Worksheet::Centimeter));
//
-// group.writeEntry("AutoScaleX", ui.chkAutoScaleX->isChecked());
-// group.writeEntry("xMin", ui.kleXMin->text());
-// group.writeEntry("xMax", ui.kleXMax->text());
-// group.writeEntry("xScale", ui.cbXScaling->currentIndex());
+// group.writeEntry("AutoScaleX", ui.chkAutoScaleX->isChecked());
+// group.writeEntry("xMin", ui.kleXMin->text());
+// group.writeEntry("xMax", ui.kleXMax->text());
+// group.writeEntry("xScale", ui.cbXScaling->currentIndex());
//
-// group.writeEntry("AutoScaleY", ui.chkAutoScaleY->isChecked());
-// group.writeEntry("yMin", ui.kleYMin->text());
-// group.writeEntry("yMax", ui.kleYMax->text());
-// group.writeEntry("yScale", ui.cbYScaling->currentIndex());
-
- //Title
- KConfigGroup group = config.group("PlotTitle");
- labelWidget->saveConfig(group);
-
- //Scale breakings
- //TODO
-
- //Background
- group = config.group("PlotArea");
- group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex());
- group.writeEntry("BackgroundColorStyle", ui.cbBackgroundColorStyle->currentIndex());
- group.writeEntry("BackgroundImageStyle", ui.cbBackgroundImageStyle->currentIndex());
- group.writeEntry("BackgroundBrushStyle", ui.cbBackgroundBrushStyle->currentIndex());
- group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text());
- group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->color());
- group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor->color());
- group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/100.0);
- group.writeEntry("HorizontalPadding", Worksheet::convertToSceneUnits(ui.sbPaddingHorizontal->value(), Worksheet::Centimeter));
- group.writeEntry("VerticalPadding", Worksheet::convertToSceneUnits(ui.sbPaddingVertical->value(), Worksheet::Centimeter));
-
- //Border
- group.writeEntry("BorderStyle", ui.cbBorderStyle->currentIndex());
- group.writeEntry("BorderColor", ui.kcbBorderColor->color());
- group.writeEntry("BorderWidth", Worksheet::convertToSceneUnits(ui.sbBorderWidth->value(), Worksheet::Point));
- group.writeEntry("BorderCornerRadius", Worksheet::convertToSceneUnits(ui.sbBorderCornerRadius->value(), Worksheet::Centimeter));
- group.writeEntry("BorderOpacity", ui.sbBorderOpacity->value()/100.0);
-
- config.sync();
+// group.writeEntry("AutoScaleY", ui.chkAutoScaleY->isChecked());
+// group.writeEntry("yMin", ui.kleYMin->text());
+// group.writeEntry("yMax", ui.kleYMax->text());
+// group.writeEntry("yScale", ui.cbYScaling->currentIndex());
+
+ //Title
+ KConfigGroup group = config.group("PlotTitle");
+ labelWidget->saveConfig(group);
+
+ //Scale breakings
+ //TODO
+
+ //Background
+ group = config.group("PlotArea");
+ group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex());
+ group.writeEntry("BackgroundColorStyle", ui.cbBackgroundColorStyle->currentIndex());
+ group.writeEntry("BackgroundImageStyle", ui.cbBackgroundImageStyle->currentIndex());
+ group.writeEntry("BackgroundBrushStyle", ui.cbBackgroundBrushStyle->currentIndex());
+ group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text());
+ group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->color());
+ group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor->color());
+ group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/100.0);
+ group.writeEntry("HorizontalPadding", Worksheet::convertToSceneUnits(ui.sbPaddingHorizontal->value(), Worksheet::Centimeter));
+ group.writeEntry("VerticalPadding", Worksheet::convertToSceneUnits(ui.sbPaddingVertical->value(), Worksheet::Centimeter));
+
+ //Border
+ group.writeEntry("BorderStyle", ui.cbBorderStyle->currentIndex());
+ group.writeEntry("BorderColor", ui.kcbBorderColor->color());
+ group.writeEntry("BorderWidth", Worksheet::convertToSceneUnits(ui.sbBorderWidth->value(), Worksheet::Point));
+ group.writeEntry("BorderCornerRadius", Worksheet::convertToSceneUnits(ui.sbBorderCornerRadius->value(), Worksheet::Centimeter));
+ group.writeEntry("BorderOpacity", ui.sbBorderOpacity->value()/100.0);
+
+ config.sync();
}
+
diff --cc src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp
index b18b3c5,c0aad35..9e3897c
--- a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp
+++ b/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp
@@@ -35,8 -35,8 +35,9 @@@
#include <QDir>
#include <QFileDialog>
+ #include <QImageReader>
#include <KUrlCompletion>
+#include <KLocalizedString>
#include <math.h>
diff --cc src/kdefrontend/dockwidgets/MatrixDock.cpp
index aaa6c8a,e70c568..5305e23
--- a/src/kdefrontend/dockwidgets/MatrixDock.cpp
+++ b/src/kdefrontend/dockwidgets/MatrixDock.cpp
@@@ -28,10 -28,8 +28,9 @@@
#include "MatrixDock.h"
#include "commonfrontend/matrix/MatrixView.h"
- #include "backend/matrix/Matrix.h"
#include "kdefrontend/TemplateHandler.h"
#include <QDir>
+#include <KLocalizedString>
/*!
\class MatrixDock
diff --cc src/kdefrontend/dockwidgets/MatrixDock.h
index 846be3b,f18b891..52a023a
--- a/src/kdefrontend/dockwidgets/MatrixDock.h
+++ b/src/kdefrontend/dockwidgets/MatrixDock.h
@@@ -29,15 -29,10 +29,12 @@@
#ifndef MATRIXDOCK_H
#define MATRIXDOCK_H
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
+ #include "backend/matrix/Matrix.h"
#include "ui_matrixdock.h"
+#include <KConfig>
+#include <KConfigGroup>
-
- class Matrix;
- class AbstractAspect;
-
class MatrixDock: public QWidget {
Q_OBJECT
diff --cc src/kdefrontend/dockwidgets/WorksheetDock.cpp
index 7d09619,174fc58..a0ac0de
--- a/src/kdefrontend/dockwidgets/WorksheetDock.cpp
+++ b/src/kdefrontend/dockwidgets/WorksheetDock.cpp
@@@ -33,9 -33,8 +33,10 @@@
#include <QPrinter>
#include <QFileDialog>
+ #include <QImageReader>
#include <KUrlCompletion>
+#include <KLocalizedString>
+#include <KConfigGroup>
#include <math.h>
diff --cc src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp
index c019fad,6a00327..f2ac4b5
--- a/src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp
+++ b/src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp
@@@ -31,11 -31,6 +31,9 @@@
#include <QFileDialog>
#include <KUrlCompletion>
#include <KMessageBox>
- #include <KPushButton>
- #include <QStringList>
+#include <KLocalizedString>
+#include <KConfigGroup>
+#include <KSharedConfig>
/*!
\class ExportSpreadsheetDialog
@@@ -82,8 -76,9 +79,9 @@@ ExportSpreadsheetDialog::ExportSpreadsh
connect(this,SIGNAL(user1Clicked()), this, SLOT(toggleOptions()));
setCaption(i18n("Export spreadsheet"));
- setWindowIcon(KIcon("document-export-database"));
+ setWindowIcon(QIcon::fromTheme("document-export-database"));
+ //restore saved settings
KConfigGroup conf(KSharedConfig::openConfig(), "ExportSpreadsheetDialog");
ui.cbFormat->setCurrentIndex(conf.readEntry("Format", 0));
ui.chkExportHeader->setChecked(conf.readEntry("Header", true));
diff --cc src/kdefrontend/widgets/DatapickerCurveWidget.cpp
index bf43602,86ea64d..3cf9310
--- a/src/kdefrontend/widgets/DatapickerCurveWidget.cpp
+++ b/src/kdefrontend/widgets/DatapickerCurveWidget.cpp
@@@ -28,12 -28,13 +28,15 @@@
#include "DatapickerCurveWidget.h"
#include "backend/datapicker/DatapickerPoint.h"
- #include "kdefrontend/widgets/DatapickerPointWidget.h"
+ #include "backend/worksheet/Worksheet.h"
+ #include "kdefrontend/GuiTools.h"
- #include <QHBoxLayout>
+ #include "math.h"
+
+ #include <QPainter>
+#include <KLocale>
+
DatapickerCurveWidget::DatapickerCurveWidget(QWidget *parent) : QWidget(parent), m_suppressTypeChange(false) {
ui.setupUi(this);
diff --cc src/kdefrontend/widgets/DatapickerImageWidget.cpp
index 0000000,26d7941..9d8574e
mode 000000,100644..100644
--- a/src/kdefrontend/widgets/DatapickerImageWidget.cpp
+++ b/src/kdefrontend/widgets/DatapickerImageWidget.cpp
@@@ -1,0 -1,870 +1,877 @@@
+ /***************************************************************************
+ File : DatapickerImageWidget.cpp
+ Project : LabPlot
+ Description : widget for datapicker properties
+ --------------------------------------------------------------------
+ Copyright : (C) 2015-2016 by Ankit Wagadre (wagadre.ankit at gmail.com)
+ Copyright : (C) 2015-2016 by Alexander Semke (alexander.semke at web.de)
+
+ ***************************************************************************/
+ /***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ ***************************************************************************/
+
+ #include "DatapickerImageWidget.h"
+ #include "backend/datapicker/DatapickerPoint.h"
+ #include "commonfrontend/widgets/qxtspanslider.h"
+ #include "kdefrontend/GuiTools.h"
+ #include "backend/worksheet/Worksheet.h"
+ #include "backend/worksheet/plots/cartesian/Symbol.h"
+ #include "backend/datapicker/ImageEditor.h"
+
+ #include "math.h"
+
+ #include <QPainter>
+ #include <KUrlCompletion>
+ #include <KStandardDirs>
+ #include <QFileDialog>
+ #include <QDir>
+ #include <QGraphicsScene>
+ #include <QImageReader>
+
++#include <KSharedConfig>
++#include <KConfigGroup>
++#include <KLocalizedString>
++
+ HistogramView::HistogramView(QWidget* parent, int range) :
+ QGraphicsView(parent),
+ m_scene(new QGraphicsScene()),
+ m_range(range) {
+
+ setTransform(QTransform());
+ QRectF pageRect( 0, 0, 1000, 100 );
+ m_scene->setSceneRect(pageRect);
+ setScene(m_scene);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ //initialize bins
+ bins = new int[range + 1];
+ for (int i = 0; i <= range; i++)
+ bins [i] = 0;
+
- lowerSlider = new QGraphicsRectItem(pageRect, 0, m_scene);
++ lowerSlider = new QGraphicsRectItem(pageRect, 0);
+ lowerSlider->setPen(QPen(Qt::black, 0.5));
+ lowerSlider->setBrush(Qt::blue);
+ lowerSlider->setOpacity(0.2);
++ m_scene->addItem(lowerSlider);
+
- upperSlider = new QGraphicsRectItem(pageRect, 0, m_scene);
++ upperSlider = new QGraphicsRectItem(pageRect, 0);
+ upperSlider->setPen(QPen(Qt::black, 0.5));
+ upperSlider->setBrush(Qt::blue);
+ upperSlider->setOpacity(0.2);
++ m_scene->addItem(upperSlider);
+ }
+
+ void HistogramView::setScalePixmap(const QString& file) {
+ // scene rect is 1000*100 where upper 1000*80 is for histogram graph
+ // and lower 1000*20 is for histogram scale
- QGraphicsPixmapItem* pixmap = new QGraphicsPixmapItem(QPixmap(file).scaled( 1000, 20, Qt::IgnoreAspectRatio), 0, m_scene);
++ QGraphicsPixmapItem* pixmap = new QGraphicsPixmapItem(QPixmap(file).scaled( 1000, 20, Qt::IgnoreAspectRatio), 0);
+ pixmap->setZValue(-1);
+ pixmap->setPos(0, 90);
++ m_scene->addItem(pixmap);
+ }
+
+ void HistogramView::setSpan(int l, int h) {
+ l = l*1000/m_range;
+ h = h*1000/m_range;
+ lowerSlider->setPos(QPointF(l - 1000, 0));
+ upperSlider->setPos(QPointF(h, 0));
+ invalidateScene(sceneRect(), QGraphicsScene::BackgroundLayer);
+ }
+
+ void HistogramView::resizeEvent(QResizeEvent *event) {
+ fitInView(m_scene->sceneRect(), Qt::IgnoreAspectRatio);
+ QGraphicsView::resizeEvent(event);
+ }
+
+ void HistogramView::drawBackground(QPainter* painter, const QRectF& rect) {
+ painter->save();
+ int max = 1;
+ for (int i = 0; i <= m_range; i++)
+ if (bins [i] > max)
+ max = bins [i];
+
+ // convert y-scale count to log scale so small counts are still visible
+ // scene rect is 1000*100 where upper 1000*80 is for histogram graph
+ // and lower 1000*20 is for histogram scale
+ QPainterPath path(QPointF(0, (log(bins[0])*100/log(max))));
+ for (int i = 1; i <= m_range; i++) {
+ int x = i*1000/m_range;
+ int y = 80;
+ if ( bins[i] > 1 )
+ y = 80 - (log(bins[i])*80/log(max));
+
+ path.lineTo(QPointF(x, y));
+ }
+
+ painter->drawPath(path);
+ invalidateScene(rect, QGraphicsScene::BackgroundLayer);
+ painter->restore();
+ }
+
+ DatapickerImageWidget::DatapickerImageWidget(QWidget *parent): QWidget(parent) {
+ ui.setupUi(this);
+
+ ui.kleFileName->setClearButtonShown(true);
- ui.bOpen->setIcon( KIcon("document-open") );
++ ui.bOpen->setIcon( QIcon::fromTheme("document-open") );
+
+ KUrlCompletion *comp = new KUrlCompletion();
+ ui.kleFileName->setCompletionObject(comp);
+
+ QGridLayout* editTabLayout = static_cast<QGridLayout*>(ui.tEdit->layout());
+ editTabLayout->setContentsMargins(2,2,2,2);
+ editTabLayout->setHorizontalSpacing(2);
+ editTabLayout->setVerticalSpacing(4);
+
+ ssHue = new QxtSpanSlider(Qt::Horizontal, ui.tEdit);
+ ssHue->setToolTip(i18n("Select the range for the hue.\nEverything outside of this range will be set to white."));
+ ssHue->setRange(0, 360);
+ editTabLayout->addWidget(ssHue, 3, 2);
+
+ ssSaturation = new QxtSpanSlider(Qt::Horizontal, ui.tEdit);
+ ssSaturation->setToolTip(i18n("Select the range for the saturation.\nEverything outside of this range will be set to white."));
+ ssSaturation->setRange(0,100);
+ editTabLayout->addWidget(ssSaturation, 5, 2);
+
+ ssValue = new QxtSpanSlider(Qt::Horizontal, ui.tEdit);
+ ssValue->setToolTip(i18n("Select the range for the value, the degree of lightness of the color.\nEverything outside of this range will be set to white."));
+ ssValue->setRange(0,100);
+ editTabLayout->addWidget(ssValue, 7, 2);
+
+ ssIntensity = new QxtSpanSlider(Qt::Horizontal, ui.tEdit);
+ ssIntensity->setToolTip(i18n("Select the range for the intensity.\nEverything outside of this range will be set to white."));
+ ssIntensity->setRange(0, 100);
+ editTabLayout->addWidget(ssIntensity, 9, 2);
+
+ ssForeground = new QxtSpanSlider(Qt::Horizontal, ui.tEdit);
+ ssForeground->setToolTip(i18n("Select the range for the colors that are not part of the background color.\nEverything outside of this range will be set to white."));
+ ssForeground->setRange(0, 100);
+ editTabLayout->addWidget(ssForeground, 11, 2);
+
+ ui.cbGraphType->addItem(i18n("Cartesian (x, y)"));
+ ui.cbGraphType->addItem(i18n("Polar (x, y°)"));
+ ui.cbGraphType->addItem(i18n("Polar (x, y(rad))"));
+ ui.cbGraphType->addItem(i18n("Logarithmic (ln(x), y)"));
+ ui.cbGraphType->addItem(i18n("Logarithmic (x, ln(y))"));
+ ui.cbGraphType->addItem(i18n("Ternary (x, y, z)"));
+
+ ui.lTernaryScale->setHidden(true);
+ ui.sbTernaryScale->setHidden(true);
+ ui.lPoisitionZ1->setHidden(true);
+ ui.lPoisitionZ2->setHidden(true);
+ ui.lPoisitionZ3->setHidden(true);
+ ui.sbPoisitionZ1->setHidden(true);
+ ui.sbPoisitionZ2->setHidden(true);
+ ui.sbPoisitionZ3->setHidden(true);
+
+ ui.cbPlotImageType->addItem(i18n("No Image"));
+ ui.cbPlotImageType->addItem(i18n("Original Image"));
+ ui.cbPlotImageType->addItem(i18n("Processed Image"));
+
+ QString valueFile = KStandardDirs::locate("data", "labplot2/pics/colorchooser/colorchooser_value.xpm");
+ QString hueFile = KStandardDirs::locate("data", "labplot2/pics/colorchooser/colorchooser_hue.xpm");
+ QString saturationFile = KStandardDirs::locate("data", "labplot2/pics/colorchooser/colorchooser_saturation.xpm");
+
+ gvHue = new HistogramView(ui.tEdit, ImageEditor::colorAttributeMax(DatapickerImage::Hue));
+ gvHue->setToolTip(i18n("Select the range for the hue.\nEverything outside of this range will be set to white."));
+ editTabLayout->addWidget(gvHue, 2, 2);
+ gvHue->setScalePixmap(hueFile);
+
+ gvSaturation = new HistogramView(ui.tEdit, ImageEditor::colorAttributeMax(DatapickerImage::Saturation));
+ gvSaturation->setToolTip(i18n("Select the range for the saturation.\nEverything outside of this range will be set to white."));
+ editTabLayout->addWidget(gvSaturation, 4, 2);
+ gvSaturation->setScalePixmap(saturationFile);
+
+ gvValue = new HistogramView(ui.tEdit, ImageEditor::colorAttributeMax(DatapickerImage::Value));
+ gvValue->setToolTip(i18n("Select the range for the value, the degree of lightness of the color.\nEverything outside of this range will be set to white."));
+ editTabLayout->addWidget(gvValue, 6,2);
+ gvValue->setScalePixmap(valueFile);
+
+ gvIntensity = new HistogramView(ui.tEdit, ImageEditor::colorAttributeMax(DatapickerImage::Intensity));
+ gvIntensity->setToolTip(i18n("Select the range for the intensity.\nEverything outside of this range will be set to white."));
+ editTabLayout->addWidget(gvIntensity, 8, 2);
+ gvIntensity->setScalePixmap(valueFile);
+
+ gvForeground = new HistogramView(ui.tEdit, ImageEditor::colorAttributeMax(DatapickerImage::Foreground));
+ gvForeground->setToolTip(i18n("Select the range for the colors that are not part of the background color.\nEverything outside of this range will be set to white."));
+ editTabLayout->addWidget(gvForeground, 10, 2);
+ gvForeground->setScalePixmap(valueFile);
+
+ connect( ssIntensity, SIGNAL(spanSliderMoved(int,int)), gvIntensity, SLOT(setSpan(int,int)) );
+ connect( ssForeground, SIGNAL(spanSliderMoved(int,int)), gvForeground, SLOT(setSpan(int,int)) );
+ connect( ssHue, SIGNAL(spanSliderMoved(int,int)), gvHue, SLOT(setSpan(int,int)) );
+ connect( ssSaturation, SIGNAL(spanSliderMoved(int,int)), gvSaturation, SLOT(setSpan(int,int)) );
+ connect( ssValue, SIGNAL(spanSliderMoved(int,int)), gvValue, SLOT(setSpan(int,int)) );
+
+ //SLOTS
+ //general
+ connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) );
+ connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged()) );
+ connect( ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile()));
+ connect( ui.kleFileName, SIGNAL(returnPressed()), this, SLOT(fileNameChanged()) );
+ connect( ui.kleFileName, SIGNAL(clearButtonClicked()), this, SLOT(fileNameChanged()) );
+
+ // edit image
+ connect( ui.cbPlotImageType, SIGNAL(currentIndexChanged(int)), this, SLOT(plotImageTypeChanged(int)) );
+ connect( ui.sbRotation, SIGNAL(valueChanged(double)), this, SLOT(rotationChanged(double)) );
+ connect( ssIntensity, SIGNAL(spanChanged(int,int)), this, SLOT(intensitySpanChanged(int,int)) );
+ connect( ssForeground, SIGNAL(spanChanged(int,int)), this, SLOT(foregroundSpanChanged(int,int)) );
+ connect( ssHue, SIGNAL(spanChanged(int,int)), this, SLOT(hueSpanChanged(int,int)) );
+ connect( ssSaturation, SIGNAL(spanChanged(int,int)), this, SLOT(saturationSpanChanged(int,int)) );
+ connect( ssValue, SIGNAL(spanChanged(int,int)), this, SLOT(valueSpanChanged(int,int)) );
+ connect( ui.sbMinSegmentLength, SIGNAL(valueChanged(int)), this, SLOT(minSegmentLengthChanged(int)) );
+ connect( ui.sbPointSeparation, SIGNAL(valueChanged(int)), this, SLOT(pointSeparationChanged(int)) );
+
+ //axis point
+ connect( ui.cbGraphType, SIGNAL(currentIndexChanged(int)), this, SLOT(graphTypeChanged()) );
+ connect( ui.sbTernaryScale, SIGNAL(valueChanged(double)), this, SLOT(ternaryScaleChanged(double)) );
+ connect( ui.sbPoisitionX1, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionY1, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionX2, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionY2, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionX3, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionY3, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionZ1, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionZ2, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+ connect( ui.sbPoisitionZ3, SIGNAL(valueChanged(double)), this, SLOT(logicalPositionChanged()) );
+
+ //SYMBOL
+ connect( ui.cbSymbolStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(pointsStyleChanged(int)) );
+ connect( ui.sbSymbolSize, SIGNAL(valueChanged(double)), this, SLOT(pointsSizeChanged(double)) );
+ connect( ui.sbSymbolRotation, SIGNAL(valueChanged(int)), this, SLOT(pointsRotationChanged(int)) );
+ connect( ui.sbSymbolOpacity, SIGNAL(valueChanged(int)), this, SLOT(pointsOpacityChanged(int)) );
+
+ //Filling
+ connect( ui.cbSymbolFillingStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(pointsFillingStyleChanged(int)) );
+ connect( ui.kcbSymbolFillingColor, SIGNAL(changed(QColor)), this, SLOT(pointsFillingColorChanged(QColor)) );
+
+ //border
+ connect( ui.cbSymbolBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(pointsBorderStyleChanged(int)) );
+ connect( ui.kcbSymbolBorderColor, SIGNAL(changed(QColor)), this, SLOT(pointsBorderColorChanged(QColor)) );
+ connect( ui.sbSymbolBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(pointsBorderWidthChanged(double)) );
+
+ connect( ui.chbSymbolVisible, SIGNAL(clicked(bool)), this, SLOT(pointsVisibilityChanged(bool)) );
+
+ init();
+ }
+
+ void DatapickerImageWidget::init() {
+ m_initializing = true;
+ GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, Qt::black);
+
+ QPainter pa;
+ int iconSize = 20;
+ QPixmap pm(iconSize, iconSize);
+ QPen pen(Qt::SolidPattern, 0);
+ ui.cbSymbolStyle->setIconSize(QSize(iconSize, iconSize));
+ QTransform trafo;
+ trafo.scale(15, 15);
+ for (int i=1; i<19; ++i) {
+ Symbol::Style style = (Symbol::Style)i;
+ pm.fill(Qt::transparent);
+ pa.begin(&pm);
+ pa.setPen( pen );
+ pa.setRenderHint(QPainter::Antialiasing);
+ pa.translate(iconSize/2,iconSize/2);
+ pa.drawPath(trafo.map(Symbol::pathFromStyle(style)));
+ pa.end();
+ ui.cbSymbolStyle->addItem(QIcon(pm), Symbol::nameFromStyle(style));
+ }
+ GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, Qt::black);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::setImages(QList<DatapickerImage*> list) {
+ m_imagesList = list;
+ m_image = list.first();
+
+ if (list.size()==1) {
+ ui.lName->setEnabled(true);
+ ui.leName->setEnabled(true);
+ ui.lComment->setEnabled(true);
+ ui.leComment->setEnabled(true);
+ ui.leName->setText(m_image->parentAspect()->name());
+ ui.leComment->setText(m_image->parentAspect()->comment());
+ } else {
+ ui.lName->setEnabled(false);
+ ui.leName->setEnabled(false);
+ ui.lComment->setEnabled(false);
+ ui.leComment->setEnabled(false);
+ ui.leName->setText("");
+ ui.leComment->setText("");
+ }
+
+ this->load();
+ initConnections();
+ handleWidgetActions();
+ updateSymbolWidgets();
+ }
+
+ void DatapickerImageWidget::initConnections() {
+ connect( m_image->parentAspect(), SIGNAL(aspectDescriptionChanged(const AbstractAspect*)),this, SLOT(imageDescriptionChanged(const AbstractAspect*)));
+ connect( m_image, SIGNAL(fileNameChanged(QString)), this, SLOT(imageFileNameChanged(QString)) );
+ connect( m_image, SIGNAL(rotationAngleChanged(float)), this, SLOT(imageRotationAngleChanged(float)) );
+ connect( m_image, SIGNAL(aspectRemoved(const AbstractAspect*,const AbstractAspect*,const AbstractAspect*)),
+ this,SLOT(updateSymbolWidgets()) );
+ connect( m_image, SIGNAL(aspectAdded(const AbstractAspect*)), this,SLOT(updateSymbolWidgets()) );
+ connect( m_image, SIGNAL(axisPointsChanged(DatapickerImage::ReferencePoints)), this, SLOT(imageAxisPointsChanged(DatapickerImage::ReferencePoints)) );
+ connect( m_image, SIGNAL(settingsChanged(DatapickerImage::EditorSettings)), this, SLOT(imageEditorSettingsChanged(DatapickerImage::EditorSettings)) );
+ connect( m_image, SIGNAL(minSegmentLengthChanged(int)), this, SLOT(imageMinSegmentLengthChanged(int)) );
+ connect( m_image, SIGNAL(pointStyleChanged(Symbol::Style)), this, SLOT(symbolStyleChanged(Symbol::Style)));
+ connect( m_image, SIGNAL(pointSizeChanged(qreal)), this, SLOT(symbolSizeChanged(qreal)));
+ connect( m_image, SIGNAL(pointRotationAngleChanged(qreal)), this, SLOT(symbolRotationAngleChanged(qreal)));
+ connect( m_image, SIGNAL(pointOpacityChanged(qreal)), this, SLOT(symbolOpacityChanged(qreal)));
+ connect( m_image, SIGNAL(pointBrushChanged(QBrush)), this, SLOT(symbolBrushChanged(QBrush)) );
+ connect( m_image, SIGNAL(pointPenChanged(QPen)), this, SLOT(symbolPenChanged(QPen)) );
+ connect( m_image, SIGNAL(pointVisibilityChanged(bool)), this, SLOT(symbolVisibleChanged(bool)) );
+ }
+
+ void DatapickerImageWidget::handleWidgetActions() {
+ QString fileName = ui.kleFileName->text().trimmed();
+ bool b = !fileName.isEmpty();
+ ui.tEdit->setEnabled(b);
+ ui.cbGraphType->setEnabled(b);
+ ui.sbRotation->setEnabled(b);
+ ui.sbPoisitionX1->setEnabled(b);
+ ui.sbPoisitionX2->setEnabled(b);
+ ui.sbPoisitionX3->setEnabled(b);
+ ui.sbPoisitionY1->setEnabled(b);
+ ui.sbPoisitionY2->setEnabled(b);
+ ui.sbPoisitionY3->setEnabled(b);
+ ui.sbMinSegmentLength->setEnabled(b);
+ ui.sbPointSeparation->setEnabled(b);
+
+ if (b) {
+ //upload histogram to view
+ gvIntensity->bins = m_image->intensityBins;
+ gvForeground->bins = m_image->foregroundBins;
+ gvHue->bins = m_image->hueBins;
+ gvSaturation->bins = m_image->saturationBins;
+ gvValue->bins = m_image->valueBins;
+ }
+ }
+
+ //**********************************************************
+ //****** SLOTs for changes triggered in DatapickerImageWidget ********
+ //**********************************************************
+ //"General"-tab
+ void DatapickerImageWidget::nameChanged() {
+ if (m_initializing)
+ return;
+
+ m_image->parentAspect()->setName(ui.leName->text());
+ }
+
+ void DatapickerImageWidget::commentChanged() {
+ if (m_initializing)
+ return;
+
+ m_image->parentAspect()->setComment(ui.leComment->text());
+ }
+
+ void DatapickerImageWidget::selectFile() {
- KConfigGroup conf(KSharedConfig::openConfig(), "DatapickerImageWidget");
++ KConfigGroup conf(KSharedConfig::openConfig(), "DatapickerImageWidget");
+ QString dir = conf.readEntry("LastImageDir", "");
+ QString formats;
+ foreach(QByteArray format, QImageReader::supportedImageFormats()) {
+ QString f = "*." + QString(format.constData());
+ formats.isEmpty() ? formats+=f : formats+=" "+f;
+ }
+ QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), dir, i18n("Images (%1)").arg(formats));
+ if (path.isEmpty())
+ return; //cancel was clicked in the file-dialog
+
+ int pos = path.lastIndexOf(QDir::separator());
+ if (pos!=-1) {
+ QString newDir = path.left(pos);
+ if (newDir!=dir)
+ conf.writeEntry("LastImageDir", newDir);
+ }
+
+ ui.kleFileName->setText( path );
+ handleWidgetActions();
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setFileName(path);
+ }
+
+ void DatapickerImageWidget::fileNameChanged() {
+ if (m_initializing)
+ return;
+
+ handleWidgetActions();
+
+ QString fileName = ui.kleFileName->text();
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setFileName(fileName);
+ }
+
+ void DatapickerImageWidget::graphTypeChanged() {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::ReferencePoints points = m_image->axisPoints();
+ points.type = DatapickerImage::GraphType(ui.cbGraphType->currentIndex());
+
+ if (points.type != DatapickerImage::Ternary) {
+ ui.lTernaryScale->setHidden(true);
+ ui.sbTernaryScale->setHidden(true);
+ ui.lPoisitionZ1->setHidden(true);
+ ui.lPoisitionZ2->setHidden(true);
+ ui.lPoisitionZ3->setHidden(true);
+ ui.sbPoisitionZ1->setHidden(true);
+ ui.sbPoisitionZ2->setHidden(true);
+ ui.sbPoisitionZ3->setHidden(true);
+ } else {
+ ui.lTernaryScale->setHidden(false);
+ ui.sbTernaryScale->setHidden(false);
+ ui.lPoisitionZ1->setHidden(false);
+ ui.lPoisitionZ2->setHidden(false);
+ ui.lPoisitionZ3->setHidden(false);
+ ui.sbPoisitionZ1->setHidden(false);
+ ui.sbPoisitionZ2->setHidden(false);
+ ui.sbPoisitionZ3->setHidden(false);
+ }
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setAxisPoints(points);
+ }
+
+ void DatapickerImageWidget::ternaryScaleChanged(double value) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::ReferencePoints points = m_image->axisPoints();
+ points.ternaryScale = value;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setAxisPoints(points);
+ }
+
+ void DatapickerImageWidget::logicalPositionChanged() {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::ReferencePoints points = m_image->axisPoints();
+ points.logicalPos[0].setX(ui.sbPoisitionX1->value());
+ points.logicalPos[0].setY(ui.sbPoisitionY1->value());
+ points.logicalPos[1].setX(ui.sbPoisitionX2->value());
+ points.logicalPos[1].setY(ui.sbPoisitionY2->value());
+ points.logicalPos[2].setX(ui.sbPoisitionX3->value());
+ points.logicalPos[2].setY(ui.sbPoisitionY3->value());
+ points.logicalPos[0].setZ(ui.sbPoisitionZ1->value());
+ points.logicalPos[1].setZ(ui.sbPoisitionZ2->value());
+ points.logicalPos[2].setZ(ui.sbPoisitionZ3->value());
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setAxisPoints(points);
+ }
+
+ void DatapickerImageWidget::pointsStyleChanged(int index) {
+ Symbol::Style style = Symbol::Style(index + 1);
+ //enable/disable the filling options in the GUI depending on the currently selected points.
+ if (style != Symbol::Line && style != Symbol::Cross) {
+ ui.cbSymbolFillingStyle->setEnabled(true);
+ bool noBrush = (Qt::BrushStyle(ui.cbSymbolFillingStyle->currentIndex())==Qt::NoBrush);
+ ui.kcbSymbolFillingColor->setEnabled(!noBrush);
+ } else {
+ ui.kcbSymbolFillingColor->setEnabled(false);
+ ui.cbSymbolFillingStyle->setEnabled(false);
+ }
+
+ bool noLine = (Qt::PenStyle(ui.cbSymbolBorderStyle->currentIndex())== Qt::NoPen);
+ ui.kcbSymbolBorderColor->setEnabled(!noLine);
+ ui.sbSymbolBorderWidth->setEnabled(!noLine);
+
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointStyle(style);
+ }
+
+ void DatapickerImageWidget::pointsSizeChanged(double value) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointSize( Worksheet::convertToSceneUnits(value, Worksheet::Point) );
+ }
+
+ void DatapickerImageWidget::pointsRotationChanged(int value) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointRotationAngle(value);
+ }
+
+ void DatapickerImageWidget::pointsOpacityChanged(int value) {
+ if (m_initializing)
+ return;
+
+ qreal opacity = (float)value/100.;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointOpacity(opacity);
+ }
+
+ void DatapickerImageWidget::pointsFillingStyleChanged(int index) {
+ Qt::BrushStyle brushStyle = Qt::BrushStyle(index);
+ ui.kcbSymbolFillingColor->setEnabled(!(brushStyle==Qt::NoBrush));
+
+ if (m_initializing)
+ return;
+
+ QBrush brush;
+ foreach(DatapickerImage* image, m_imagesList) {
+ brush = image->pointBrush();
+ brush.setStyle(brushStyle);
+ image->setPointBrush(brush);
+ }
+ }
+
+ void DatapickerImageWidget::pointsFillingColorChanged(const QColor& color) {
+ if (m_initializing)
+ return;
+
+ QBrush brush;
+ foreach(DatapickerImage* image, m_imagesList) {
+ brush = image->pointBrush();
+ brush.setColor(color);
+ image->setPointBrush(brush);
+ }
+
+ m_initializing = true;
+ GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, color );
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::pointsBorderStyleChanged(int index) {
+ Qt::PenStyle penStyle=Qt::PenStyle(index);
+
+ if ( penStyle == Qt::NoPen ) {
+ ui.kcbSymbolBorderColor->setEnabled(false);
+ ui.sbSymbolBorderWidth->setEnabled(false);
+ } else {
+ ui.kcbSymbolBorderColor->setEnabled(true);
+ ui.sbSymbolBorderWidth->setEnabled(true);
+ }
+
+ if (m_initializing)
+ return;
+
+ QPen pen;
+ foreach(DatapickerImage* image, m_imagesList) {
+ pen = image->pointPen();
+ pen.setStyle(penStyle);
+ image->setPointPen(pen);
+ }
+ }
+
+ void DatapickerImageWidget::pointsBorderColorChanged(const QColor& color) {
+ if (m_initializing)
+ return;
+
+ QPen pen;
+ foreach(DatapickerImage* image, m_imagesList) {
+ pen = image->pointPen();
+ pen.setColor(color);
+ image->setPointPen(pen);
+ }
+
+ m_initializing = true;
+ GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, color);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::pointsBorderWidthChanged(double value) {
+ if (m_initializing)
+ return;
+
+ QPen pen;
+ foreach(DatapickerImage* image, m_imagesList) {
+ pen = image->pointPen();
+ pen.setWidthF( Worksheet::convertToSceneUnits(value, Worksheet::Point) );
+ image->setPointPen(pen);
+ }
+ }
+
+ void DatapickerImageWidget::pointsVisibilityChanged(bool state) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointVisibility(state);
+ }
+
+ void DatapickerImageWidget::intensitySpanChanged(int lowerLimit, int upperLimit) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::EditorSettings settings = m_image->settings();
+ settings.intensityThresholdHigh = upperLimit;
+ settings.intensityThresholdLow = lowerLimit;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setSettings(settings);
+ }
+
+ void DatapickerImageWidget::foregroundSpanChanged(int lowerLimit, int upperLimit) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::EditorSettings settings = m_image->settings();
+ settings.foregroundThresholdHigh = upperLimit;
+ settings.foregroundThresholdLow = lowerLimit;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setSettings(settings);
+ }
+
+ void DatapickerImageWidget::hueSpanChanged(int lowerLimit, int upperLimit) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::EditorSettings settings = m_image->settings();
+ settings.hueThresholdHigh = upperLimit;
+ settings.hueThresholdLow = lowerLimit;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setSettings(settings);
+ }
+
+ void DatapickerImageWidget::saturationSpanChanged(int lowerLimit, int upperLimit) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::EditorSettings settings = m_image->settings();
+ settings.saturationThresholdHigh = upperLimit;
+ settings.saturationThresholdLow = lowerLimit;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setSettings(settings);
+ }
+
+ void DatapickerImageWidget::valueSpanChanged(int lowerLimit, int upperLimit) {
+ if (m_initializing)
+ return;
+
+ DatapickerImage::EditorSettings settings = m_image->settings();
+ settings.valueThresholdHigh = upperLimit;
+ settings.valueThresholdLow = lowerLimit;
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setSettings(settings);
+ }
+
+ void DatapickerImageWidget::plotImageTypeChanged(int index) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPlotImageType(DatapickerImage::PlotImageType(index));
+ }
+
+ void DatapickerImageWidget::rotationChanged(double value) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setRotationAngle(value);
+ }
+
+ void DatapickerImageWidget::minSegmentLengthChanged(int value) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setminSegmentLength(value);
+ }
+
+ void DatapickerImageWidget::pointSeparationChanged(int value) {
+ if (m_initializing)
+ return;
+
+ foreach(DatapickerImage* image, m_imagesList)
+ image->setPointSeparation(value);
+ }
+
+ //*******************************************************************
+ //******** SLOTs for changes triggered in DatapickerImage ***********
+ //*******************************************************************
+ /*!
+ called when the name or comment of image's parent (datapicker) was changed.
+ */
+ void DatapickerImageWidget::imageDescriptionChanged(const AbstractAspect* aspect) {
+ if (m_image->parentAspect() != aspect)
+ return;
+
+ m_initializing = true;
+ if (aspect->name() != ui.leName->text()) {
+ ui.leName->setText(aspect->name());
+ } else if (aspect->comment() != ui.leComment->text()) {
+ ui.leComment->setText(aspect->comment());
+ }
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::imageFileNameChanged(const QString& name) {
+ m_initializing = true;
+ ui.kleFileName->setText(name);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::imageRotationAngleChanged(float angle) {
+ m_initializing = true;
+ ui.sbRotation->setValue(angle);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::imageAxisPointsChanged(const DatapickerImage::ReferencePoints& axisPoints) {
+ m_initializing = true;
+ ui.cbGraphType->setCurrentIndex((int) axisPoints.type);
+ ui.sbTernaryScale->setValue(axisPoints.ternaryScale);
+ ui.sbPoisitionX1->setValue(axisPoints.logicalPos[0].x());
+ ui.sbPoisitionY1->setValue(axisPoints.logicalPos[0].y());
+ ui.sbPoisitionX2->setValue(axisPoints.logicalPos[1].x());
+ ui.sbPoisitionY2->setValue(axisPoints.logicalPos[1].y());
+ ui.sbPoisitionX3->setValue(axisPoints.logicalPos[2].x());
+ ui.sbPoisitionY3->setValue(axisPoints.logicalPos[2].y());
+ ui.sbPoisitionZ1->setValue(axisPoints.logicalPos[0].z());
+ ui.sbPoisitionZ2->setValue(axisPoints.logicalPos[1].z());
+ ui.sbPoisitionZ3->setValue(axisPoints.logicalPos[2].z());
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::imageEditorSettingsChanged(const DatapickerImage::EditorSettings& settings) {
+ m_initializing = true;
+ ssIntensity->setSpan(settings.intensityThresholdLow, settings.intensityThresholdHigh);
+ ssForeground->setSpan(settings.foregroundThresholdLow, settings.foregroundThresholdHigh);
+ ssHue->setSpan(settings.hueThresholdLow, settings.hueThresholdHigh);
+ ssSaturation->setSpan(settings.saturationThresholdLow, settings.saturationThresholdHigh);
+ ssValue->setSpan(settings.valueThresholdLow, settings.valueThresholdHigh);
+ gvIntensity->setSpan(settings.intensityThresholdLow, settings.intensityThresholdHigh);
+ gvForeground->setSpan(settings.foregroundThresholdLow, settings.foregroundThresholdHigh);
+ gvHue->setSpan(settings.hueThresholdLow, settings.hueThresholdHigh);
+ gvSaturation->setSpan(settings.saturationThresholdLow, settings.saturationThresholdHigh);
+ gvValue->setSpan(settings.valueThresholdLow, settings.valueThresholdHigh);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::imageMinSegmentLengthChanged(const int value) {
+ m_initializing = true;
+ ui.sbMinSegmentLength->setValue(value);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::updateSymbolWidgets() {
+ int pointCount = m_image->childCount<DatapickerPoint>(AbstractAspect::IncludeHidden);
+ if (pointCount)
+ ui.tSymbol->setEnabled(true);
+ else
+ ui.tSymbol->setEnabled(false);
+ }
+
+ void DatapickerImageWidget::symbolStyleChanged(Symbol::Style style) {
+ m_initializing = true;
+ ui.cbSymbolStyle->setCurrentIndex((int)style - 1);
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolSizeChanged(qreal size) {
+ m_initializing = true;
+ ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(size, Worksheet::Point) );
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolRotationAngleChanged(qreal angle) {
+ m_initializing = true;
+ ui.sbSymbolRotation->setValue(round(angle));
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolOpacityChanged(qreal opacity) {
+ m_initializing = true;
+ ui.sbSymbolOpacity->setValue( round(opacity*100.0) );
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolBrushChanged(QBrush brush) {
+ m_initializing = true;
+ ui.cbSymbolFillingStyle->setCurrentIndex((int) brush.style());
+ ui.kcbSymbolFillingColor->setColor(brush.color());
+ GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, brush.color());
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolPenChanged(const QPen& pen) {
+ m_initializing = true;
+ ui.cbSymbolBorderStyle->setCurrentIndex( (int) pen.style());
+ ui.kcbSymbolBorderColor->setColor( pen.color());
+ GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, pen.color());
+ ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(pen.widthF(), Worksheet::Point));
+ m_initializing = false;
+ }
+
+ void DatapickerImageWidget::symbolVisibleChanged(bool on) {
+ m_initializing = true;
+ ui.chbSymbolVisible->setChecked(on);
+ m_initializing = false;
+ }
+
+ //**********************************************************
+ //******************** SETTINGS ****************************
+ //**********************************************************
+ void DatapickerImageWidget::load() {
+ if(m_image == NULL)
+ return;
+
+ m_initializing = true;
+ ui.kleFileName->setText( m_image->fileName() );
+ ui.cbGraphType->setCurrentIndex((int) m_image->axisPoints().type);
+ ui.sbTernaryScale->setValue(m_image->axisPoints().ternaryScale);
+ ui.sbPoisitionX1->setValue(m_image->axisPoints().logicalPos[0].x());
+ ui.sbPoisitionY1->setValue(m_image->axisPoints().logicalPos[0].y());
+ ui.sbPoisitionX2->setValue(m_image->axisPoints().logicalPos[1].x());
+ ui.sbPoisitionY2->setValue(m_image->axisPoints().logicalPos[1].y());
+ ui.sbPoisitionX3->setValue(m_image->axisPoints().logicalPos[2].x());
+ ui.sbPoisitionY3->setValue(m_image->axisPoints().logicalPos[2].y());
+ ui.sbPoisitionZ1->setValue(m_image->axisPoints().logicalPos[0].z());
+ ui.sbPoisitionZ2->setValue(m_image->axisPoints().logicalPos[1].z());
+ ui.sbPoisitionZ3->setValue(m_image->axisPoints().logicalPos[2].z());
+ ui.cbPlotImageType->setCurrentIndex((int) m_image->plotImageType());
+ ssIntensity->setSpan(m_image->settings().intensityThresholdLow, m_image->settings().intensityThresholdHigh);
+ ssForeground->setSpan(m_image->settings().foregroundThresholdLow, m_image->settings().foregroundThresholdHigh);
+ ssHue->setSpan(m_image->settings().hueThresholdLow, m_image->settings().hueThresholdHigh);
+ ssSaturation->setSpan(m_image->settings().saturationThresholdLow, m_image->settings().saturationThresholdHigh);
+ ssValue->setSpan(m_image->settings().valueThresholdLow, m_image->settings().valueThresholdHigh);
+ gvIntensity->setSpan(m_image->settings().intensityThresholdLow, m_image->settings().intensityThresholdHigh);
+ gvForeground->setSpan(m_image->settings().foregroundThresholdLow, m_image->settings().foregroundThresholdHigh);
+ gvHue->setSpan(m_image->settings().hueThresholdLow, m_image->settings().hueThresholdHigh);
+ gvSaturation->setSpan(m_image->settings().saturationThresholdLow, m_image->settings().saturationThresholdHigh);
+ gvValue->setSpan(m_image->settings().valueThresholdLow, m_image->settings().valueThresholdHigh);
+ ui.sbPointSeparation->setValue(m_image->pointSeparation());
+ ui.sbMinSegmentLength->setValue(m_image->minSegmentLength());
+ ui.cbSymbolStyle->setCurrentIndex( (int)m_image->pointStyle() - 1 );
+ ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(m_image->pointSize(), Worksheet::Point) );
+ ui.sbSymbolRotation->setValue( m_image->pointRotationAngle() );
+ ui.sbSymbolOpacity->setValue( round(m_image->pointOpacity()*100.0) );
+ ui.cbSymbolFillingStyle->setCurrentIndex( (int) m_image->pointBrush().style() );
+ ui.kcbSymbolFillingColor->setColor( m_image->pointBrush().color() );
+ ui.cbSymbolBorderStyle->setCurrentIndex( (int) m_image->pointPen().style() );
+ ui.kcbSymbolBorderColor->setColor( m_image->pointPen().color() );
+ ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(m_image->pointPen().widthF(), Worksheet::Point) );
+ ui.chbSymbolVisible->setChecked( m_image->pointVisibility() );
+ m_initializing = false;
+ }
diff --cc src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
index af48c7d,0875f71..66c1875
--- a/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
+++ b/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
@@@ -31,11 -31,7 +31,9 @@@
#include <QFileDialog>
#include <KUrlCompletion>
#include <KMessageBox>
- #include <KPushButton>
- #include <QStringList>
#include <QDesktopWidget>
+#include <KLocalizedString>
+#include <KSharedConfig>
/*!
\class ExportWorksheetDialog
@@@ -83,17 -77,32 +79,32 @@@ ExportWorksheetDialog::ExportWorksheetD
connect(this,SIGNAL(user1Clicked()), this, SLOT(toggleOptions()));
setCaption(i18n("Export worksheet"));
- setWindowIcon(KIcon("document-export-database"));
+ setWindowIcon(QIcon::fromTheme("document-export-database"));
+ //restore saved setting
KConfigGroup conf(KSharedConfig::openConfig(), "ExportWorksheetDialog");
- ui.cbFormat->setCurrentIndex(conf.readEntry("Format", "").toInt());
- ui.cbExportArea->setCurrentIndex(conf.readEntry("Area", "").toInt());
- ui.cbResolution->setCurrentIndex(conf.readEntry("Resolution", "").toInt());
+ ui.cbFormat->setCurrentIndex(conf.readEntry("Format", 0));
+ ui.cbExportArea->setCurrentIndex(conf.readEntry("Area", 0));
+ ui.chkExportBackground->setChecked(conf.readEntry("Background", true));
+ ui.cbResolution->setCurrentIndex(conf.readEntry("Resolution", 0));
+ m_showOptions = conf.readEntry("ShowOptions", false);
+ ui.gbOptions->setVisible(m_showOptions);
+ m_showOptions ? setButtonText(KDialog::User1,i18n("Hide Options")) : setButtonText(KDialog::User1,i18n("Show Options"));
+ restoreDialogSize(conf);
+ }
- resize( QSize(500,0).expandedTo(minimumSize()) );
+ ExportWorksheetDialog::~ExportWorksheetDialog() {
+ //save current settings
+ KConfigGroup conf(KSharedConfig::openConfig(), "ExportWorksheetDialog");
+ conf.writeEntry("Format", ui.cbFormat->currentIndex());
+ conf.writeEntry("Area", ui.cbExportArea->currentIndex());
+ conf.writeEntry("Background", ui.chkExportBackground->isChecked());
+ conf.writeEntry("Resolution", ui.cbResolution->currentIndex());
+ conf.writeEntry("ShowOptions", m_showOptions);
+ saveDialogSize(conf);
}
- void ExportWorksheetDialog::setFileName(const QString& name){
+ void ExportWorksheetDialog::setFileName(const QString& name) {
KConfigGroup conf(KSharedConfig::openConfig(), "ExportWorksheetDialog");
QString dir = conf.readEntry("LastDir", "");
if (dir.isEmpty()) dir = QDir::homePath();
More information about the kde-doc-english
mailing list