From kde-commits Sat Feb 28 22:03:00 2015 From: Alexander Semke Date: Sat, 28 Feb 2015 22:03:00 +0000 To: kde-commits Subject: [labplot/frameworks] /: kdefrontend Ported along with some of backend files ported Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=142516101224726 Git commit bd284dae19633b5bb7dfdd6a15f6d32d953e733c by Alexander Semke, on = behalf of Garvit Khatri. Committed on 18/02/2015 at 10:11. Pushed by asemke into branch 'frameworks'. kdefrontend Ported along with some of backend files ported M +7 -2 CMakeLists.txt M +1 -1 src/CMakeLists.txt M +1 -1 src/backend/core/AbstractColumn.cpp M +3 -3 src/backend/core/AbstractPart.cpp M +1 -1 src/backend/core/AbstractSimpleFilter.cpp M +1 -1 src/backend/core/column/Column.cpp M +7 -7 src/backend/datasources/FileDataSource.cpp M +1 -1 src/backend/gsl/functions.h M +1 -0 src/commonfrontend/spreadsheet/SpreadsheetView.h M +1 -0 src/commonfrontend/worksheet/WorksheetView.h M +2 -1 src/kdefrontend/GuiObserver.cpp M +3 -3 src/kdefrontend/HistoryDialog.cpp M +31 -22 src/kdefrontend/LabPlot.cpp M +980 -984 src/kdefrontend/MainWin.cpp M +44 -42 src/kdefrontend/MainWin.h M +58 -34 src/kdefrontend/SettingsDialog.cpp M +4 -0 src/kdefrontend/SettingsDialog.h M +2 -2 src/kdefrontend/SettingsGeneralPage.cpp M +1 -1 src/kdefrontend/SettingsPage.h M +12 -13 src/kdefrontend/TemplateHandler.cpp M +1 -1 src/kdefrontend/TemplateHandler.h M +1 -1 src/kdefrontend/datasources/FileInfoDialog.cpp M +5 -3 src/kdefrontend/datasources/ImportFileDialog.cpp M +9 -7 src/kdefrontend/datasources/ImportFileWidget.cpp M +1 -0 src/kdefrontend/dockwidgets/AxisDock.cpp M +1 -0 src/kdefrontend/dockwidgets/AxisDock.h M +794 -793 src/kdefrontend/dockwidgets/CartesianPlotDock.cpp M +1 -0 src/kdefrontend/dockwidgets/CartesianPlotDock.h M +2 -1 src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp M +1 -0 src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h M +2 -0 src/kdefrontend/dockwidgets/ColumnDock.cpp M +1 -0 src/kdefrontend/dockwidgets/ProjectDock.cpp M +1 -0 src/kdefrontend/dockwidgets/ProjectDock.h M +2 -0 src/kdefrontend/dockwidgets/SpreadsheetDock.cpp M +1 -1 src/kdefrontend/dockwidgets/SpreadsheetDock.h M +3 -1 src/kdefrontend/dockwidgets/WorksheetDock.cpp M +1 -0 src/kdefrontend/dockwidgets/WorksheetDock.h M +2 -0 src/kdefrontend/dockwidgets/XYCurveDock.cpp M +1 -0 src/kdefrontend/dockwidgets/XYCurveDock.h M +6 -5 src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp M +4 -4 src/kdefrontend/dockwidgets/XYFitCurveDock.cpp M +1 -0 src/kdefrontend/spreadsheet/EquidistantValuesDialog.cpp M +5 -2 src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp M +3 -2 src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp M +1 -0 src/kdefrontend/spreadsheet/RandomValuesDialog.cpp M +2 -2 src/kdefrontend/widgets/ConstantsWidget.cpp M +2 -2 src/kdefrontend/widgets/FitOptionsWidget.cpp M +5 -4 src/kdefrontend/widgets/FitParametersWidget.cpp M +2 -2 src/kdefrontend/widgets/FunctionsWidget.cpp M +445 -444 src/kdefrontend/widgets/LabelWidget.cpp M +1 -0 src/kdefrontend/widgets/LabelWidget.h M +8 -6 src/kdefrontend/worksheet/ExportWorksheetDialog.cpp http://commits.kde.org/labplot/bd284dae19633b5bb7dfdd6a15f6d32d953e733c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b80773..b91878f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,14 @@ cmake_minimum_required(VERSION 2.8.12) find_package(ECM 1.3.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) = -find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Q= ml Quick QuickWidgets Svg Test) +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Q= ml Quick QuickWidgets Svg Test Declarative) find_package(KF5 REQUIRED COMPONENTS + Archive + I18n + WidgetsAddons + XmlGui KIO + NotifyConfig KDELibs4Support) = include(FeatureSummary) @@ -20,7 +25,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wu= ndef -Wpointer-arith -W add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS}) include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BIN= ARY_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) -add_definitions (-DLVERSION=3D'\"2.0.1\"') +add_definitions (-DLVERSION=3D"2.0.1") # add_definitions (-DLDEBUG=3D'1') # needed for qt_plugin_instance_scidavis_standardcurvesymbolfactory() add_definitions(-D QT_STATICPLUGIN ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2ff324d..847124f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,7 +164,7 @@ set(LABPLOT_SRCS ${GUI_SOURCES} ${PLOTS_SOURCES}) INCLUDE_DIRECTORIES(.) qt5_wrap_ui(LABPLOT_SRCS ${UI_SOURCES}) add_executable(labplot2 ${LABPLOT_SRCS} ${BACKEND_SOURCES} ${DATASOURCES_S= OURCES} ${COMMONFRONTEND_SOURCES} ${TOOLS_SOURCES} ${QTMOC_HDRS}) -target_link_libraries(labplot2 KF5::WidgetsAddons KF5::KIOWidgets ${GSL_LI= BRARIES} ${GSL_CBLAS_LIBRARIES}) +target_link_libraries(labplot2 KF5::KDELibs4Support KF5::Archive Qt5::Decl= arative KF5::Declarative KF5::WidgetsAddons KF5::KIOWidgets KF5::XmlGui ${G= SL_LIBRARIES} ${GSL_CBLAS_LIBRARIES}) # ${OPJ_LIBRARY} = ############## installation ################################ diff --git a/src/backend/core/AbstractColumn.cpp b/src/backend/core/Abstrac= tColumn.cpp index 15988d9..04d708e 100644 --- a/src/backend/core/AbstractColumn.cpp +++ b/src/backend/core/AbstractColumn.cpp @@ -33,7 +33,7 @@ #include "backend/lib/XmlStreamReader.h" #include "backend/lib/SignallingUndoCommand.h" = -#include +#include #include #include #include diff --git a/src/backend/core/AbstractPart.cpp b/src/backend/core/AbstractP= art.cpp index c18fc30..38ad11a 100644 --- a/src/backend/core/AbstractPart.cpp +++ b/src/backend/core/AbstractPart.cpp @@ -114,9 +114,9 @@ QMenu* AbstractPart::createContextMenu(){ = if (m_mdiWindow) { #ifndef ACTIVATE_SCIDAVIS_SPECIFIC_CODE - menu->addAction(QIcon(KIcon("document-export-database")), i18n("Export")= , this, SIGNAL(exportRequested())); - menu->addAction(QIcon(KIcon("document-print")), i18n("Print"), this, SIG= NAL(printRequested())); - menu->addAction(QIcon(KIcon("document-print-preview")), i18n("Print Prev= iew"), this, SIGNAL(printPreviewRequested())); + menu->addAction(QIcon(QIcon("document-export-database")), i18n("Ex= port"), this, SIGNAL(exportRequested())); + menu->addAction(QIcon(QIcon("document-print")), i18n("Print"), thi= s, SIGNAL(printRequested())); + menu->addAction(QIcon(QIcon("document-print-preview")), i18n("Prin= t Preview"), this, SIGNAL(printPreviewRequested())); #else menu->addAction(i18n("Export"), this, SIGNAL(exportRequested())); menu->addAction(i18n("Print"), this, SIGNAL(printRequested())); diff --git a/src/backend/core/AbstractSimpleFilter.cpp b/src/backend/core/A= bstractSimpleFilter.cpp index 383834b..0cea557 100644 --- a/src/backend/core/AbstractSimpleFilter.cpp +++ b/src/backend/core/AbstractSimpleFilter.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "backend/lib/XmlStreamReader.h" #include = diff --git a/src/backend/core/column/Column.cpp b/src/backend/core/column/C= olumn.cpp index 079501d..9c43e92 100644 --- a/src/backend/core/column/Column.cpp +++ b/src/backend/core/column/Column.cpp @@ -459,7 +459,7 @@ QIcon Column::icon() const { // return QIcon(QPixmap("")); // } = - return KIcon("x-shape-text"); + return QIcon("x-shape-text"); } = //////////////////////////////////////////////////////////////////////////= ////////////////////////// diff --git a/src/backend/datasources/FileDataSource.cpp b/src/backend/datas= ources/FileDataSource.cpp index 377c796..703fabe 100644 --- a/src/backend/datasources/FileDataSource.cpp +++ b/src/backend/datasources/FileDataSource.cpp @@ -77,14 +77,14 @@ FileDataSource::~FileDataSource(){ } = void FileDataSource::initActions(){ - m_reloadAction =3D new KAction(KIcon("view-refresh"), i18n("Reload"), thi= s); + m_reloadAction =3D new QAction(KIcon("view-refresh"), i18n("Reload"), = this); connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(read())); = - m_toggleWatchAction =3D new KAction(i18n("Watch the file"), this); + m_toggleWatchAction =3D new QAction(i18n("Watch the file"), this); m_toggleWatchAction->setCheckable(true); connect(m_toggleWatchAction, SIGNAL(triggered()), this, SLOT(watchToggled= ())); = - m_toggleLinkAction =3D new KAction(i18n("Link the file"), this); + m_toggleLinkAction =3D new QAction(i18n("Link the file"), this); m_toggleLinkAction->setCheckable(true); connect(m_toggleLinkAction, SIGNAL(triggered()), this, SLOT(linkToggled()= )); } @@ -171,13 +171,13 @@ QIcon FileDataSource::icon() const{ QIcon icon; #ifndef ACTIVATE_SCIDAVIS_SPECIFIC_CODE if (m_fileType=3D=3DAsciiVector || m_fileType=3D=3DAsciiMatrix) - icon =3D KIcon("text-plain"); + icon =3D QIcon("text-plain"); else if (m_fileType=3D=3DBinaryVector || m_fileType=3D=3DBinaryMatrix) - icon =3D KIcon("application-octet-stream"); + icon =3D QIcon("application-octet-stream"); else if (m_fileType=3D=3DImage) - icon =3D KIcon("image-x-generic"); + icon =3D QIcon("image-x-generic"); else if (m_fileType=3D=3DSound) - icon =3D KIcon("audio-x-generic"); + icon =3D QIcon("audio-x-generic"); #endif return icon; } diff --git a/src/backend/gsl/functions.h b/src/backend/gsl/functions.h index 80454b6..1037a01 100644 --- a/src/backend/gsl/functions.h +++ b/src/backend/gsl/functions.h @@ -553,7 +553,7 @@ struct func _functions[] =3D { {"poissonP",gsl_cdf_poisson_P}, {"poissonQ",gsl_cdf_poisson_Q}, /* Bernoulli Distribution */ - {"bernoulli",bernoulli}, + {"bernoulli",bernoulli}, /* Binomial Distribution */ {"binomial",gsl_ran_binomial_pdf}, {"binomialP",gsl_cdf_binomial_P}, diff --git a/src/commonfrontend/spreadsheet/SpreadsheetView.h b/src/commonf= rontend/spreadsheet/SpreadsheetView.h index 3258d8b..5cf08f8 100644 --- a/src/commonfrontend/spreadsheet/SpreadsheetView.h +++ b/src/commonfrontend/spreadsheet/SpreadsheetView.h @@ -30,6 +30,7 @@ #define SPREADSHEETVIEW_H = #include +#include = #include "backend/core/AbstractColumn.h" #include "backend/lib/IntervalAttribute.h" diff --git a/src/commonfrontend/worksheet/WorksheetView.h b/src/commonfront= end/worksheet/WorksheetView.h index 5a91052..3de4d50 100644 --- a/src/commonfrontend/worksheet/WorksheetView.h +++ b/src/commonfrontend/worksheet/WorksheetView.h @@ -32,6 +32,7 @@ #include #include "backend/worksheet/Worksheet.h" #include "backend/worksheet/plots/cartesian/CartesianPlot.h" +#include = class QMenu; class QToolBar; diff --git a/src/kdefrontend/GuiObserver.cpp b/src/kdefrontend/GuiObserver.= cpp index f27e44e..8457e71 100644 --- a/src/kdefrontend/GuiObserver.cpp +++ b/src/kdefrontend/GuiObserver.cpp @@ -59,6 +59,7 @@ Email (use @ for *) : alexander.semke*web.de #include #include #include +#include = /*! \class GuiObserver @@ -287,7 +288,7 @@ GuiObserver::GuiObserver(MainWin* mainWin) : m_lastCart= esianPlot(0){ = mainWindow->stackedWidget->setCurrentWidget(mainWindow->projectDock); }else{ - mainWindow->m_propertiesDock->setWindowTitle(i18n("Properties")); + mainWindow->m_propertiesDock->setWindowTitle(i18n("Properties")); if (mainWindow->stackedWidget->currentWidget()) mainWindow->stackedWidget->currentWidget()->hide(); } diff --git a/src/kdefrontend/HistoryDialog.cpp b/src/kdefrontend/HistoryDia= log.cpp index 9dff0a2..a302f52 100644 --- a/src/kdefrontend/HistoryDialog.cpp +++ b/src/kdefrontend/HistoryDialog.cpp @@ -41,21 +41,21 @@ HistoryDialog::HistoryDialog(QWidget* parent, QUndoStack* stack, QString& = emptyLabel) : KDialog(parent){ m_undoStack =3D stack; QUndoView* undoView =3D new QUndoView(stack, this); - undoView->setCleanIcon( KIcon("edit-clear-history") ); + undoView->setCleanIcon( QIcon("edit-clear-history") ); undoView->setEmptyLabel(emptyLabel); undoView->setMinimumWidth(350); undoView->setWhatsThis(i18n("List of all performed steps/actions.\n" "Select an item in the list to navigate to the corresponding step.")); setMainWidget(undoView); = - setWindowIcon( KIcon("view-history") ); + setWindowIcon( QIcon("view-history") ); setWindowTitle(i18n("Undo/Redo History")); showButtonSeparator(true); = if (stack->count()) { setButtons( KDialog::Ok | KDialog::User1 | KDialog::Cancel ); setButtonToolTip(KDialog::User1, i18n("Clears the undo history. Commands= are not undone or redone; the state of the project remains unchanged.")); - setButtonIcon(KDialog::User1, KIcon("edit-clear")); + setButtonIcon(KDialog::User1, QIcon("edit-clear")); setButtonText(KDialog::User1, i18n("Clear")); connect(this,SIGNAL(user1Clicked()), this, SLOT(clearUndoStack())); }else{ diff --git a/src/kdefrontend/LabPlot.cpp b/src/kdefrontend/LabPlot.cpp index 74f67fc..fc8cea8 100644 --- a/src/kdefrontend/LabPlot.cpp +++ b/src/kdefrontend/LabPlot.cpp @@ -26,12 +26,13 @@ * Boston, MA 02110-1301 USA = * * = * *************************************************************************= **/ -#include +#include +#include #include -#include +#include #include #include -#include +#include #include #include = @@ -40,27 +41,35 @@ #include "backend/spreadsheet/Spreadsheet.h" = int main (int argc, char *argv[]) { - KAboutData aboutData( "LabPlot2", "LabPlot2", - ki18n("LabPlot2"), LVERSION, - ki18n("LabPlot2 is a KDE-application for interactive graphing and analy= sis of scientific data."), - KAboutData::License_GPL, - ki18n("(c) 2007-2014") ); - aboutData.setHomepage("http://www.labplot.sourceforge.net"); - aboutData.addAuthor(ki18n("Stefan Gerlach"), ki18n("developer"), "stefan.= gerlach@uni-konstanz.de", 0); - aboutData.addAuthor(ki18n("Alexander Semke"), ki18n("developer"), "alexan= der.semke@web.de", 0); - aboutData.addAuthor(ki18n("Andreas Kainz"), ki18n("icon designer"), "kain= z.a@gmail.com", 0); + KAboutData aboutData( QStringLiteral("LabPlot2"), QString("LabPlot2"), + LVERSION, + i18n("LabPlot2 is a KDE-application for interactive graphi= ng and analysis of scientific data."), + KAboutLicense::GPL, + i18n("(c) 2007-2014"), + QString(), + QStringLiteral("http://www.labplot.sourceforge.net")); = - KCmdLineArgs::init( argc, argv, &aboutData ); - KCmdLineOptions options; - options.add("no-splash",ki18n("do not show the splash screen")); - options.add("+[file]",ki18n("open a project file")); - KCmdLineArgs::addCmdLineOptions( options ); + aboutData.addAuthor(i18n("Stefan Gerlach"), i18n("developer"), "stefan= .gerlach@uni-konstanz.de", 0); + aboutData.addAuthor(i18n("Alexander Semke"), i18n("developer"), "alexa= nder.semke@web.de", 0); + aboutData.addAuthor(i18n("Andreas Kainz"), i18n("icon designer"), "kai= nz.a@gmail.com", 0); + KAboutData::setApplicationData(aboutData); = - KApplication app; - KCmdLineArgs *args =3D KCmdLineArgs::parsedArgs(); + QApplication app(argc, argv); + + QCommandLineParser parser; + QCommandLineOption nosplashOption("no-splash", i18n( "start in fullscr= een mode")); + parser.addOption(nosplashOption); + + parser.addPositionalArgument("+[file]", i18n( "open a project file")); + + aboutData.setupCommandLine(&parser); + parser.process(app); + aboutData.processCommandLine(&parser); + + const QStringList args =3D parser.positionalArguments(); QString filename; - if (args->count() > 0) - filename =3D args->arg(0); + if (args.count() > 0) + filename =3D args[0]; = if(!filename.isEmpty() ){ if ( !QFile::exists(filename)) { @@ -83,7 +92,7 @@ int main (int argc, char *argv[]) { } = KSplashScreen *splash=3D0; - if (args->isSet("-splash")) { + if (parser.isSet("-splash")) { QString file =3D KStandardDirs::locate("appdata", "splash.png"); QPixmap pixmap(file); splash=3D new KSplashScreen(pixmap); diff --git a/src/kdefrontend/MainWin.cpp b/src/kdefrontend/MainWin.cpp index 583b521..0acb89b 100644 --- a/src/kdefrontend/MainWin.cpp +++ b/src/kdefrontend/MainWin.cpp @@ -73,79 +73,79 @@ #include = /*! - \class MainWin - \brief Main application window. + \class MainWin + \brief Main application window. = - \ingroup kdefrontend + \ingroup kdefrontend */ = MainWin::MainWin(QWidget *parent, const QString& filename) - : KXmlGuiWindow(parent), - m_currentSubWindow(0), - m_project(0), - m_aspectTreeModel(0), - m_projectExplorer(0), - m_projectExplorerDock(0), - m_propertiesDock(0), - m_currentAspect(0), - m_currentFolder(0), - m_suppressCurrentSubWindowChangedEvent(false), - m_closing(false), - m_autoSaveActive(false), - m_visibilityMenu(0), - m_newMenu(0), - axisDock(0), - cartesianPlotDock(0), - cartesianPlotLegendDock(0), - columnDock(0), - spreadsheetDock(0), - projectDock(0), - xyCurveDock(0), - xyEquationCurveDock(0), - xyFitCurveDock(0), - worksheetDock(0), - textLabelDock(0){ + : KXmlGuiWindow(parent), + m_currentSubWindow(0), + m_project(0), + m_aspectTreeModel(0), + m_projectExplorer(0), + m_projectExplorerDock(0), + m_propertiesDock(0), + m_currentAspect(0), + m_currentFolder(0), + m_suppressCurrentSubWindowChangedEvent(false), + m_closing(false), + m_autoSaveActive(false), + m_visibilityMenu(0), + m_newMenu(0), + axisDock(0), + cartesianPlotDock(0), + cartesianPlotLegendDock(0), + columnDock(0), + spreadsheetDock(0), + projectDock(0), + xyCurveDock(0), + xyEquationCurveDock(0), + xyFitCurveDock(0), + worksheetDock(0), + textLabelDock(0){ = // QTimer::singleShot( 0, this, SLOT(initGUI(filename)) ); //TODO doesn'= t work anymore - initGUI(filename); + initGUI(filename); } = MainWin::~MainWin() { - kDebug()<<"write settings"<saveEntries( KGlobal::config()->group("Recent Fil= es") ); + //write settings + m_recentProjectsAction->saveEntries( KSharedConfig::openConfig()->grou= p("Recent Files") ); // qDebug()<<"SAVED m_recentProjectsAction->urls()=3D"<urls()<sync(); + KSharedConfig::openConfig()->sync(); = - if (m_project!=3D0){ - m_mdiArea->closeAllSubWindows(); - disconnect(m_project, 0, this, 0); - delete m_aspectTreeModel; - delete m_project; - } + if (m_project!=3D0){ + m_mdiArea->closeAllSubWindows(); + disconnect(m_project, 0, this, 0); + delete m_aspectTreeModel; + delete m_project; + } } = void MainWin::initGUI(const QString& fileName){ - m_mdiArea =3D new QMdiArea; - setCentralWidget(m_mdiArea); - connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), - this, SLOT(handleCurrentSubWindowChanged(QMdiSubWindow*))); - - statusBar()->showMessage(i18nc("%1 is the LabPlot version", "Welcome to L= abPlot %1", QLatin1String(LVERSION))); - initActions(); - initMenus(); - setupGUI(); - setWindowIcon(KIcon("LabPlot2")); - setAttribute( Qt::WA_DeleteOnClose ); - - //make the status bar of a fixed size in order to avoid height changes wh= en placing a ProgressBar there. - statusBar()->setFixedHeight(statusBar()->height()); - - //load recently used projects - m_recentProjectsAction->loadEntries( KGlobal::config()->group("Recent F= iles") ); + m_mdiArea =3D new QMdiArea; + setCentralWidget(m_mdiArea); + connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), + this, SLOT(handleCurrentSubWindowChanged(QMdiSubWindow*))); + + statusBar()->showMessage(i18nc("%1 is the LabPlot version", "Welcome t= o LabPlot %1", QLatin1String(LVERSION))); + initActions(); + initMenus(); + setupGUI(); + setWindowIcon(QIcon("LabPlot2")); + setAttribute( Qt::WA_DeleteOnClose ); + + //make the status bar of a fixed size in order to avoid height changes= when placing a ProgressBar there. + statusBar()->setFixedHeight(statusBar()->height()); + + //load recently used projects + m_recentProjectsAction->loadEntries( KSharedConfig::openConfig()->grou= p("Recent Files") ); // qDebug()<<"LOADED m_recentProjectsAction->urls()=3D"<urls()<urls().first()=3D"<urls().first()<urls().size();i++) { @@ -153,232 +153,232 @@ void MainWin::initGUI(const QString& fileName){ // qDebug()<<"LOADED m_recentProjectsAction->urls().urls("<urls().at(i)<group("General"); - int viewMode =3D group.readEntry("ViewMode", 0); - if (viewMode =3D=3D 1) { - m_mdiArea->setViewMode(QMdiArea::TabbedView); - int tabPosition =3D group.readEntry("TabPosition", 0); - m_mdiArea->setTabPosition(QTabWidget::TabPosition(tabPosition)); - m_mdiArea->setTabsClosable(true); - m_mdiArea->setTabsMovable(true); - m_tileWindows->setVisible(false); - m_cascadeWindows->setVisible(false); - } - - //auto-save - m_autoSaveActive =3D group.readEntry("AutoSave", 0); - int interval =3D group.readEntry("AutoSaveInterval", 1); - interval =3D interval*60*1000; - m_autoSaveTimer.setInterval(interval); - connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSaveProject()= )); - - if ( !fileName.isEmpty() ) { - openProject(fileName); - } else { - //There is no file to open. Depending on the settings do nothing, - //create a new project or open the last used project. - int load =3D group.readEntry("LoadOnStart", 0); - if (load =3D=3D 1) { //create new project - newProject(); - } else if (load =3D=3D 2) { //create new project with a worksheet - newProject(); - newWorksheet(); - } else if (load =3D=3D 3) { //open last used project - if (m_recentProjectsAction->urls().size()){ - qDebug()<<"TO OPEN m_recentProjectsAction->urls()=3D"<urls().first()<urls().first() ); - } - } - } - updateGUIOnProjectChanges(); + //set the view mode of the mdi area + KConfigGroup group =3D KSharedConfig::openConfig()->group("General"); + int viewMode =3D group.readEntry("ViewMode", 0); + if (viewMode =3D=3D 1) { + m_mdiArea->setViewMode(QMdiArea::TabbedView); + int tabPosition =3D group.readEntry("TabPosition", 0); + m_mdiArea->setTabPosition(QTabWidget::TabPosition(tabPosition)); + m_mdiArea->setTabsClosable(true); + m_mdiArea->setTabsMovable(true); + m_tileWindows->setVisible(false); + m_cascadeWindows->setVisible(false); + } + + //auto-save + m_autoSaveActive =3D group.readEntry("AutoSave", 0); + int interval =3D group.readEntry("AutoSaveInterval", 1); + interval =3D interval*60*1000; + m_autoSaveTimer.setInterval(interval); + connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSaveProjec= t())); + + if ( !fileName.isEmpty() ) { + openProject(fileName); + } else { + //There is no file to open. Depending on the settings do nothing, + //create a new project or open the last used project. + int load =3D group.readEntry("LoadOnStart", 0); + if (load =3D=3D 1) { //create new project + newProject(); + } else if (load =3D=3D 2) { //create new project with a worksheet + newProject(); + newWorksheet(); + } else if (load =3D=3D 3) { //open last used project + if (m_recentProjectsAction->urls().size()){ + qDebug()<<"TO OPEN m_recentProjectsAction->urls()=3D"<urls().first()<urls().first() = ); + } + } + } + updateGUIOnProjectChanges(); } = void MainWin::initActions() { - KAction* action; - - // ******************** File-menu ******************************* - //add some standard actions - action =3D KStandardAction::openNew(this, SLOT(newProject()),actionColle= ction()); - action =3D KStandardAction::open(this, SLOT(openProject()),actionCollecti= on()); - m_recentProjectsAction =3D KStandardAction::openRecent(this, SLOT(openR= ecentProject(KUrl)),actionCollection()); - m_closeAction =3D KStandardAction::close(this, SLOT(closeProject()),actio= nCollection()); - m_saveAction =3D KStandardAction::save(this, SLOT(saveProject()),actionCo= llection()); - m_saveAsAction =3D KStandardAction::saveAs(this, SLOT(saveProjectAs()),ac= tionCollection()); - m_printAction =3D KStandardAction::print(this, SLOT(print()),actionCollec= tion()); - m_printPreviewAction =3D KStandardAction::printPreview(this, SLOT(printPr= eview()),actionCollection()); - KStandardAction::fullScreen(this, SLOT(toggleFullScreen()), this, actionC= ollection()); - - //New Folder/Spreadsheet/Worksheet/Datasources - m_newSpreadsheetAction =3D new KAction(KIcon("insert-table"),i18n("Spread= sheet"),this); + QAction* action; + + // ******************** File-menu ******************************* + //add some standard actions + action =3D KStandardAction::openNew(this, SLOT(newProject()),actionCol= lection()); + action =3D KStandardAction::open(this, SLOT(openProject()),actionColle= ction()); + m_recentProjectsAction =3D KStandardAction::openRecent(this, SLOT(open= RecentProject(KUrl)),actionCollection()); + m_closeAction =3D KStandardAction::close(this, SLOT(closeProject()),ac= tionCollection()); + m_saveAction =3D KStandardAction::save(this, SLOT(saveProject()),actio= nCollection()); + m_saveAsAction =3D KStandardAction::saveAs(this, SLOT(saveProjectAs())= ,actionCollection()); + m_printAction =3D KStandardAction::print(this, SLOT(print()),actionCol= lection()); + m_printPreviewAction =3D KStandardAction::printPreview(this, SLOT(prin= tPreview()),actionCollection()); + KStandardAction::fullScreen(this, SLOT(toggleFullScreen()), this, acti= onCollection()); + + //New Folder/Spreadsheet/Worksheet/Datasources + m_newSpreadsheetAction =3D new QAction(QIcon("insert-table"),i18n("Spr= eadsheet"),this); // m_newSpreadsheetAction->setShortcut(Qt::CTRL+Qt::Key_Equal); - actionCollection()->addAction("new_spreadsheet", m_newSpreadsheetAction); - connect(m_newSpreadsheetAction, SIGNAL(triggered()),SLOT(newSpreadsheet()= )); + actionCollection()->addAction("new_spreadsheet", m_newSpreadsheetActio= n); + connect(m_newSpreadsheetAction, SIGNAL(triggered()),SLOT(newSpreadshee= t())); = -// m_newMatrixAction =3D new KAction(KIcon("insert-table"),i18n("Matrix")= ,this); +// m_newMatrixAction =3D new QAction(QIcon("insert-table"),i18n("Matrix")= ,this); // m_newMatrixAction->setShortcut(Qt::CTRL+Qt::Key_Equal); // actionCollection()->addAction("new_matrix", m_newMatrixAction); // connect(m_newMatrixAction, SIGNAL(triggered()),SLOT(newMatrix())); = - m_newWorksheetAction=3D new KAction(KIcon("archive-insert"),i18n("Workshe= et"),this); + m_newWorksheetAction=3D new QAction(QIcon("archive-insert"),i18n("Work= sheet"),this); // m_newWorksheetAction->setShortcut(Qt::ALT+Qt::Key_X); - actionCollection()->addAction("new_worksheet", m_newWorksheetAction); - connect(m_newWorksheetAction, SIGNAL(triggered()), SLOT(newWorksheet())); + actionCollection()->addAction("new_worksheet", m_newWorksheetAction); + connect(m_newWorksheetAction, SIGNAL(triggered()), SLOT(newWorksheet()= )); = -// m_newScriptAction =3D new KAction(KIcon("insert-text"),i18n("Note/Scri= pt"),this); +// m_newScriptAction =3D new QAction(QIcon("insert-text"),i18n("Note/Scri= pt"),this); // actionCollection()->addAction("new_script", m_newScriptAction); // connect(m_newScriptAction, SIGNAL(triggered()),SLOT(newScript())); = - m_newFolderAction =3D new KAction(KIcon("folder-new"),i18n("Folder"),this= ); - actionCollection()->addAction("new_folder", m_newFolderAction); - connect(m_newFolderAction, SIGNAL(triggered()),SLOT(newFolder())); + m_newFolderAction =3D new QAction(QIcon("folder-new"),i18n("Folder"),t= his); + actionCollection()->addAction("new_folder", m_newFolderAction); + connect(m_newFolderAction, SIGNAL(triggered()),SLOT(newFolder())); = - //"New file datasources" - m_newFileDataSourceAction =3D new KAction(KIcon("application-octet-stream= "),i18n("File Data Source"),this); - actionCollection()->addAction("new_file_datasource", m_newFileDataSourceA= ction); - connect(m_newFileDataSourceAction, SIGNAL(triggered()), this, SLOT(newFil= eDataSourceActionTriggered())); + //"New file datasources" + m_newFileDataSourceAction =3D new QAction(QIcon("application-octet-str= eam"),i18n("File Data Source"),this); + actionCollection()->addAction("new_file_datasource", m_newFileDataSour= ceAction); + connect(m_newFileDataSourceAction, SIGNAL(triggered()), this, SLOT(new= FileDataSourceActionTriggered())); = - //"New database datasources" -// m_newSqlDataSourceAction =3D new KAction(KIcon("server-database"),i18n= ("SQL Data Source "),this); + //"New database datasources" +// m_newSqlDataSourceAction =3D new QAction(QIcon("server-database"),i18n= ("SQL Data Source "),this); // actionCollection()->addAction("new_database_datasource", m_newSqlDataS= ourceAction); // connect(m_newSqlDataSourceAction, SIGNAL(triggered()), this, SLOT(newS= qlDataSourceActionTriggered())); = - m_importAction =3D new KAction(KIcon("document-import-database"), i18n("I= mport"), this); - m_importAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_I); - actionCollection()->addAction("import", m_importAction); - connect(m_importAction, SIGNAL(triggered()),SLOT(importFileDialog())); - - m_exportAction =3D new KAction(KIcon("document-export-database"), i18n("E= xport"), this); - m_exportAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_E); - actionCollection()->addAction("export", m_exportAction); - connect(m_exportAction, SIGNAL(triggered()),SLOT(exportDialog())); - - // Edit - //Undo/Redo-stuff - m_undoAction =3D KStandardAction::undo(this, SLOT(undo()), actionCollecti= on()); - m_redoAction =3D KStandardAction::redo(this, SLOT(redo()), actionCollecti= on()); - - m_historyAction =3D new KAction(KIcon("view-history"), i18n("Undo/Redo Hi= story"),this); - actionCollection()->addAction("history", m_historyAction); - connect(m_historyAction, SIGNAL(triggered()),SLOT(historyDialog())); - - // Appearance - // Analysis - // Drawing - // Script - - //Windows - action =3D new KAction(i18n("Cl&ose"), this); - action->setShortcut(i18n("Ctrl+W")); - action->setStatusTip(i18n("Close the active window")); - actionCollection()->addAction("close window", action); - connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(closeActiveSubWindow= ())); - - action =3D new KAction(i18n("Close &All"), this); - action->setStatusTip(i18n("Close all the windows")); - actionCollection()->addAction("close all windows", action); - connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(closeAllSubWindows()= )); - - m_tileWindows =3D new KAction(i18n("&Tile"), this); - m_tileWindows->setStatusTip(i18n("Tile the windows")); - actionCollection()->addAction("tile windows", m_tileWindows); - connect(m_tileWindows, SIGNAL(triggered()), m_mdiArea, SLOT(tileSubWindow= s())); - - m_cascadeWindows =3D new KAction(i18n("&Cascade"), this); - m_cascadeWindows->setStatusTip(i18n("Cascade the windows")); - actionCollection()->addAction("cascade windows", m_cascadeWindows); - connect(m_cascadeWindows, SIGNAL(triggered()), m_mdiArea, SLOT(cascadeSub= Windows())); - - action =3D new KAction(KIcon("go-next-view"), i18n("Ne&xt"), this); - action->setStatusTip(i18n("Move the focus to the next window")); - actionCollection()->addAction("next window", action); - connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activateNextSubWindo= w())); - - action =3D new KAction(KIcon("go-previous-view"), i18n("Pre&vious"), this= ); - action->setStatusTip(i18n("Move the focus to the previous window")); - actionCollection()->addAction("previous window", action); - connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activatePreviousSubW= indow())); - - //"Standard actions" - KStandardAction::preferences(this, SLOT(settingsDialog()), actionCollecti= on()); - KStandardAction::quit(this, SLOT(close()), actionCollection()); - - //Actions for window visibility - QActionGroup* windowVisibilityActions =3D new QActionGroup(this); - windowVisibilityActions->setExclusive(true); - - m_visibilityFolderAction =3D new KAction(KIcon("folder"), i18n("Current &= Folder Only"), windowVisibilityActions); - m_visibilityFolderAction->setCheckable(true); - m_visibilityFolderAction->setData(Project::folderOnly); - - m_visibilitySubfolderAction =3D new KAction(KIcon("folder-documents"), i1= 8n("Current Folder and &Subfolders"), windowVisibilityActions); - m_visibilitySubfolderAction->setCheckable(true); - m_visibilitySubfolderAction->setData(Project::folderAndSubfolders); - - m_visibilityAllAction =3D new KAction(i18n("&All"), windowVisibilityActio= ns); - m_visibilityAllAction->setCheckable(true); - m_visibilityAllAction->setData(Project::allMdiWindows); - - connect(windowVisibilityActions, SIGNAL(triggered(QAction*)), this, SLOT(= setMdiWindowVisibility(QAction*))); - - //Actions for hiding/showing the dock widgets - QActionGroup * docksActions =3D new QActionGroup(this); - docksActions->setExclusive(false); - - m_toggleProjectExplorerDockAction =3D new KAction(KIcon("view-list-tree")= , i18n("Project explorer"), docksActions); - m_toggleProjectExplorerDockAction->setCheckable(true); - m_toggleProjectExplorerDockAction->setChecked(true); - actionCollection()->addAction("toggle_project_explorer_dock", m_togglePro= jectExplorerDockAction); - - m_togglePropertiesDockAction =3D new KAction(KIcon("view-list-details"), = i18n("Properties explorer"), docksActions); - m_togglePropertiesDockAction->setCheckable(true); - m_togglePropertiesDockAction->setChecked(true); - actionCollection()->addAction("toggle_properties_explorer_dock", m_toggle= PropertiesDockAction); - - connect(docksActions, SIGNAL(triggered(QAction*)), this, SLOT(toggleDockW= idget(QAction*))); + m_importAction =3D new QAction(QIcon("document-import-database"), i18n= ("Import"), this); + m_importAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_I); + actionCollection()->addAction("import", m_importAction); + connect(m_importAction, SIGNAL(triggered()),SLOT(importFileDialog())); + + m_exportAction =3D new QAction(QIcon("document-export-database"), i18n= ("Export"), this); + m_exportAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_E); + actionCollection()->addAction("export", m_exportAction); + connect(m_exportAction, SIGNAL(triggered()),SLOT(exportDialog())); + + // Edit + //Undo/Redo-stuff + m_undoAction =3D KStandardAction::undo(this, SLOT(undo()), actionColle= ction()); + m_redoAction =3D KStandardAction::redo(this, SLOT(redo()), actionColle= ction()); + + m_historyAction =3D new QAction(QIcon("view-history"), i18n("Undo/Redo= History"),this); + actionCollection()->addAction("history", m_historyAction); + connect(m_historyAction, SIGNAL(triggered()),SLOT(historyDialog())); + + // Appearance + // Analysis + // Drawing + // Script + + //Windows + action =3D new QAction(i18n("Cl&ose"), this); + action->setShortcut(i18n("Ctrl+W")); + action->setStatusTip(i18n("Close the active window")); + actionCollection()->addAction("close window", action); + connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(closeActiveSubWin= dow())); + + action =3D new QAction(i18n("Close &All"), this); + action->setStatusTip(i18n("Close all the windows")); + actionCollection()->addAction("close all windows", action); + connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(closeAllSubWindow= s())); + + m_tileWindows =3D new QAction(i18n("&Tile"), this); + m_tileWindows->setStatusTip(i18n("Tile the windows")); + actionCollection()->addAction("tile windows", m_tileWindows); + connect(m_tileWindows, SIGNAL(triggered()), m_mdiArea, SLOT(tileSubWin= dows())); + + m_cascadeWindows =3D new QAction(i18n("&Cascade"), this); + m_cascadeWindows->setStatusTip(i18n("Cascade the windows")); + actionCollection()->addAction("cascade windows", m_cascadeWindows); + connect(m_cascadeWindows, SIGNAL(triggered()), m_mdiArea, SLOT(cascade= SubWindows())); + + action =3D new QAction(QIcon("go-next-view"), i18n("Ne&xt"), this); + action->setStatusTip(i18n("Move the focus to the next window")); + actionCollection()->addAction("next window", action); + connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activateNextSubWi= ndow())); + + action =3D new QAction(QIcon("go-previous-view"), i18n("Pre&vious"), t= his); + action->setStatusTip(i18n("Move the focus to the previous window")); + actionCollection()->addAction("previous window", action); + connect(action, SIGNAL(triggered()), m_mdiArea, SLOT(activatePreviousS= ubWindow())); + + //"Standard actions" + KStandardAction::preferences(this, SLOT(settingsDialog()), actionColle= ction()); + KStandardAction::quit(this, SLOT(close()), actionCollection()); + + //Actions for window visibility + QActionGroup* windowVisibilityActions =3D new QActionGroup(this); + windowVisibilityActions->setExclusive(true); + + m_visibilityFolderAction =3D new QAction(QIcon("folder"), i18n("Curren= t &Folder Only"), windowVisibilityActions); + m_visibilityFolderAction->setCheckable(true); + m_visibilityFolderAction->setData(Project::folderOnly); + + m_visibilitySubfolderAction =3D new QAction(QIcon("folder-documents"),= i18n("Current Folder and &Subfolders"), windowVisibilityActions); + m_visibilitySubfolderAction->setCheckable(true); + m_visibilitySubfolderAction->setData(Project::folderAndSubfolders); + + m_visibilityAllAction =3D new QAction(i18n("&All"), windowVisibilityAc= tions); + m_visibilityAllAction->setCheckable(true); + m_visibilityAllAction->setData(Project::allMdiWindows); + + connect(windowVisibilityActions, SIGNAL(triggered(QAction*)), this, SL= OT(setMdiWindowVisibility(QAction*))); + + //Actions for hiding/showing the dock widgets + QActionGroup * docksActions =3D new QActionGroup(this); + docksActions->setExclusive(false); + + m_toggleProjectExplorerDockAction =3D new QAction(QIcon("view-list-tre= e"), i18n("Project explorer"), docksActions); + m_toggleProjectExplorerDockAction->setCheckable(true); + m_toggleProjectExplorerDockAction->setChecked(true); + actionCollection()->addAction("toggle_project_explorer_dock", m_toggle= ProjectExplorerDockAction); + + m_togglePropertiesDockAction =3D new QAction(QIcon("view-list-details"= ), i18n("Properties explorer"), docksActions); + m_togglePropertiesDockAction->setCheckable(true); + m_togglePropertiesDockAction->setChecked(true); + actionCollection()->addAction("toggle_properties_explorer_dock", m_tog= glePropertiesDockAction); + + connect(docksActions, SIGNAL(triggered(QAction*)), this, SLOT(toggleDo= ckWidget(QAction*))); } = void MainWin::initMenus(){ - //menu for adding new aspects - m_newMenu =3D new QMenu(i18n("Add new")); - m_newMenu->setIcon(KIcon("document-new")); - m_newMenu->addAction(m_newFolderAction); - m_newMenu->addAction(m_newSpreadsheetAction); - m_newMenu->addAction(m_newWorksheetAction); - m_newMenu->addSeparator(); - m_newMenu->addAction(m_newFileDataSourceAction); + //menu for adding new aspects + m_newMenu =3D new QMenu(i18n("Add new")); + m_newMenu->setIcon(QIcon("document-new")); + m_newMenu->addAction(m_newFolderAction); + m_newMenu->addAction(m_newSpreadsheetAction); + m_newMenu->addAction(m_newWorksheetAction); + m_newMenu->addSeparator(); + m_newMenu->addAction(m_newFileDataSourceAction); // m_newMenu->addAction(m_newSqlDataSourceAction); = - //menu subwindow visibility policy - m_visibilityMenu =3D new QMenu(i18n("Window visibility policy")); - m_visibilityMenu->setIcon(KIcon("window-duplicate")); - m_visibilityMenu ->addAction(m_visibilityFolderAction); - m_visibilityMenu ->addAction(m_visibilitySubfolderAction); - m_visibilityMenu ->addAction(m_visibilityAllAction); + //menu subwindow visibility policy + m_visibilityMenu =3D new QMenu(i18n("Window visibility policy")); + m_visibilityMenu->setIcon(QIcon("window-duplicate")); + m_visibilityMenu ->addAction(m_visibilityFolderAction); + m_visibilityMenu ->addAction(m_visibilitySubfolderAction); + m_visibilityMenu ->addAction(m_visibilityAllAction); } = /*! - Asks to save the project if it was modified. - \return \c true if the project still needs to be saved ("cancel" clicked)= , \c false otherwise. + Asks to save the project if it was modified. + \return \c true if the project still needs to be saved ("cancel" click= ed), \c false otherwise. */ bool MainWin::warnModified() { - if(m_project->hasChanged()) { - int want_save =3D KMessageBox::warningYesNoCancel( this, - i18n("The current project %1 has been modified. Do you want to save it?= ", m_project->name()), - i18n("Save Project")); - switch (want_save) { - case KMessageBox::Yes: - return !saveProject(); - break; - case KMessageBox::No: - break; - case KMessageBox::Cancel: - return true; - break; - } - } - - return false; + if(m_project->hasChanged()) { + int want_save =3D KMessageBox::warningYesNoCancel( this, + i18n("The current project %1 has been modified. Do you want to= save it?", m_project->name()), + i18n("Save Project")); + switch (want_save) { + case KMessageBox::Yes: + return !saveProject(); + break; + case KMessageBox::No: + break; + case KMessageBox::Cancel: + return true; + break; + } + } + + return false; } = /*! @@ -386,51 +386,51 @@ bool MainWin::warnModified() { * on project changes (project closes and opens) */ void MainWin::updateGUIOnProjectChanges() { - if (m_closing) - return; - - KXMLGUIFactory* factory=3Dthis->guiFactory(); - if (factory->container("worksheet", this)=3D=3DNULL) { - //no worksheet menu found, most probably Labplotui.rc - //was not properly installed -> return here in order not to crash - return; - } - - //disable all menus if there is no project - bool b =3D (m_project=3D=3D0); - m_saveAction->setEnabled(!b); - m_saveAsAction->setEnabled(!b); - m_printAction->setEnabled(!b); - m_printPreviewAction->setEnabled(!b); - m_importAction->setEnabled(!b); - m_exportAction->setEnabled(!b); - m_newSpreadsheetAction->setEnabled(!b); - m_newWorksheetAction->setEnabled(!b); - m_closeAction->setEnabled(!b); - m_toggleProjectExplorerDockAction->setEnabled(!b); - m_togglePropertiesDockAction->setEnabled(!b); - factory->container("new", this)->setEnabled(!b); - factory->container("edit", this)->setEnabled(!b); - factory->container("spreadsheet", this)->setEnabled(!b); - factory->container("worksheet", this)->setEnabled(!b); + if (m_closing) + return; + + KXMLGUIFactory* factory=3Dthis->guiFactory(); + if (factory->container("worksheet", this)=3D=3DNULL) { + //no worksheet menu found, most probably Labplotui.rc + //was not properly installed -> return here in order not to crash + return; + } + + //disable all menus if there is no project + bool b =3D (m_project=3D=3D0); + m_saveAction->setEnabled(!b); + m_saveAsAction->setEnabled(!b); + m_printAction->setEnabled(!b); + m_printPreviewAction->setEnabled(!b); + m_importAction->setEnabled(!b); + m_exportAction->setEnabled(!b); + m_newSpreadsheetAction->setEnabled(!b); + m_newWorksheetAction->setEnabled(!b); + m_closeAction->setEnabled(!b); + m_toggleProjectExplorerDockAction->setEnabled(!b); + m_togglePropertiesDockAction->setEnabled(!b); + factory->container("new", this)->setEnabled(!b); + factory->container("edit", this)->setEnabled(!b); + factory->container("spreadsheet", this)->setEnabled(!b); + factory->container("worksheet", this)->setEnabled(!b); // factory->container("analysis", this)->setEnabled(!b); // factory->container("script", this)->setEnabled(!b); // factory->container("drawing", this)->setEnabled(!b); - factory->container("windows", this)->setEnabled(!b); - - if (b) { - factory->container("worksheet_toolbar", this)->hide(); - factory->container("cartesian_plot_toolbar", this)->hide(); - factory->container("spreadsheet_toolbar", this)->hide(); - setCaption("LabPlot2"); - } - else { - setCaption(m_project->name()); - } - - // undo/redo actions are disabled in both cases - when the project is clo= sed or opened - m_undoAction->setEnabled(false); - m_redoAction->setEnabled(false); + factory->container("windows", this)->setEnabled(!b); + + if (b) { + factory->container("worksheet_toolbar", this)->hide(); + factory->container("cartesian_plot_toolbar", this)->hide(); + factory->container("spreadsheet_toolbar", this)->hide(); + setCaption("LabPlot2"); + } + else { + setCaption(m_project->name()); + } + + // undo/redo actions are disabled in both cases - when the project is = closed or opened + m_undoAction->setEnabled(false); + m_redoAction->setEnabled(false); } = /* @@ -438,217 +438,216 @@ void MainWin::updateGUIOnProjectChanges() { * depending on the currently active window (worksheet or spreadsheet). */ void MainWin::updateGUI() { - if (m_closing) - return; - - KXMLGUIFactory* factory=3Dthis->guiFactory(); - if (factory->container("worksheet", this)=3D=3DNULL) { - //no worksheet menu found, most probably Labplotui.rc - //was not properly installed -> return here in order not to crash - return; - } - - //for the toolbar worksheet_toolbar, spreadsheet_toolbar and cartesian_pl= ot_toolbar - //the default desktop style is ignored and the buttons are shown with ico= ns and texts. - //We need to set the style explicitly when the toolbar is shown for the f= irst time - //(no subgroup in the group "MainWindow" available) - //TODO: is this the usual behaviour for toolbars defined in the rc-file? - KConfigGroup group =3D KGlobal::config()->group("MainWindow"); - - Worksheet* w =3D this->activeWorksheet(); - if (w!=3D0){ - //enable worksheet related menus - factory->container("worksheet", this)->setEnabled(true); + if (m_closing) + return; + + KXMLGUIFactory* factory=3Dthis->guiFactory(); + if (factory->container("worksheet", this)=3D=3DNULL) { + //no worksheet menu found, most probably Labplotui.rc + //was not properly installed -> return here in order not to crash + return; + } + + //for the toolbar worksheet_toolbar, spreadsheet_toolbar and cartesian= _plot_toolbar + //the default desktop style is ignored and the buttons are shown with = icons and texts. + //We need to set the style explicitly when the toolbar is shown for th= e first time + //(no subgroup in the group "MainWindow" available) + //TODO: is this the usual behaviour for toolbars defined in the rc-fil= e? + KConfigGroup group =3D KSharedConfig::openConfig()->group("MainWindow"= ); + + Worksheet* w =3D this->activeWorksheet(); + if (w!=3D0){ + //enable worksheet related menus + factory->container("worksheet", this)->setEnabled(true); // factory->container("drawing", this)->setEnabled(true); = - //disable spreadsheet related menus - factory->container("spreadsheet", this)->setEnabled(false); + //disable spreadsheet related menus + factory->container("spreadsheet", this)->setEnabled(false); // factory->container("analysis", this)->setEnabled(false); = - //populate worksheet-menu - WorksheetView* view=3Dqobject_cast(w->view()); - QMenu* menu=3Dqobject_cast(factory->container("worksheet", this)= ); - menu->clear(); - view->createContextMenu(menu); - - //populate worksheet-toolbar - QToolBar* toolbar=3Dqobject_cast(factory->container("workshee= t_toolbar", this)); - if (group.groupList().indexOf("Toolbar worksheet_toolbar")=3D=3D-1) - toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting()); - - toolbar->setVisible(true); - toolbar->clear(); - view->fillToolBar(toolbar); - - //populate the toolbar for cartesian plots - toolbar=3Dqobject_cast(factory->container("cartesian_plot_too= lbar", this)); - if (group.groupList().indexOf("Toolbar cartesian_plot_toolbar")=3D=3D-1) - toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting()); - - toolbar->setVisible(true); - toolbar->clear(); - view->fillCartesianPlotToolBar(toolbar); - - //hide the spreadsheet toolbar - factory->container("spreadsheet_toolbar", this)->setVisible(false); - }else{ - //no worksheet selected -> deactivate worksheet related menus and the to= olbar - factory->container("worksheet", this)->setEnabled(false); + //populate worksheet-menu + WorksheetView* view=3Dqobject_cast(w->view()); + QMenu* menu=3Dqobject_cast(factory->container("worksheet",= this)); + menu->clear(); + view->createContextMenu(menu); + + //populate worksheet-toolbar + QToolBar* toolbar=3Dqobject_cast(factory->container("wo= rksheet_toolbar", this)); +// if (group.groupList().indexOf("Toolbar worksheet_toolbar")=3D=3D= -1) +// toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting= ()); + + toolbar->setVisible(true); + toolbar->clear(); + view->fillToolBar(toolbar); + + //populate the toolbar for cartesian plots + toolbar=3Dqobject_cast(factory->container("cartesian_pl= ot_toolbar", this)); +// if (group.groupList().indexOf("Toolbar cartesian_plot_toolbar")= =3D=3D-1) +// toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting= ()); + + toolbar->setVisible(true); + toolbar->clear(); + view->fillCartesianPlotToolBar(toolbar); + + //hide the spreadsheet toolbar + factory->container("spreadsheet_toolbar", this)->setVisible(false); + }else{ + //no worksheet selected -> deactivate worksheet related menus and = the toolbar + factory->container("worksheet", this)->setEnabled(false); // factory->container("drawing", this)->setEnabled(false); - factory->container("worksheet_toolbar", this)->setVisible(false); - factory->container("cartesian_plot_toolbar", this)->setVisible(false); + factory->container("worksheet_toolbar", this)->setVisible(false); + factory->container("cartesian_plot_toolbar", this)->setVisible(fal= se); = - //Handle the Spreadsheet-object - Spreadsheet* spreadsheet =3D this->activeSpreadsheet(); - if (spreadsheet){ - //enable spreadsheet related menus + //Handle the Spreadsheet-object + Spreadsheet* spreadsheet =3D this->activeSpreadsheet(); + if (spreadsheet){ + //enable spreadsheet related menus // factory->container("analysis", this)->setEnabled(true); - factory->container("spreadsheet", this)->setEnabled(true); - - //populate spreadsheet-menu - SpreadsheetView* view=3Dqobject_cast(spreadsheet->vie= w()); - QMenu* menu=3Dqobject_cast(factory->container("spreadsheet", th= is)); - menu->clear(); - view->createContextMenu(menu); - - //populate spreadsheet-toolbar - QToolBar* toolbar=3Dqobject_cast(factory->container("spreads= heet_toolbar", this)); - if (group.groupList().indexOf("Toolbar spreadsheet_toolbar")=3D=3D-1) - toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting()); - - toolbar->setVisible(true); - toolbar->clear(); - view->fillToolBar(toolbar); - }else{ - //no spreadsheet selected -> deactivate spreadsheet related menus + factory->container("spreadsheet", this)->setEnabled(true); + + //populate spreadsheet-menu + SpreadsheetView* view=3Dqobject_cast(spreads= heet->view()); + QMenu* menu=3Dqobject_cast(factory->container("spreads= heet", this)); + menu->clear(); + view->createContextMenu(menu); + + //populate spreadsheet-toolbar + QToolBar* toolbar=3Dqobject_cast(factory->container= ("spreadsheet_toolbar", this)); +// if (group.groupList().indexOf("Toolbar spreadsheet_toolbar")= =3D=3D-1) +// toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSet= ting()); + + toolbar->setVisible(true); + toolbar->clear(); + view->fillToolBar(toolbar); + }else{ + //no spreadsheet selected -> deactivate spreadsheet related me= nus // factory->container("analysis", this)->setEnabled(false); - factory->container("spreadsheet", this)->setEnabled(false); - factory->container("spreadsheet_toolbar", this)->setVisible(false); - } - } + factory->container("spreadsheet", this)->setEnabled(false); + factory->container("spreadsheet_toolbar", this)->setVisible(fa= lse); + } + } } = /*! - creates a new empty project. Returns \c true, if a new project was create= d. + creates a new empty project. Returns \c true, if a new project was cre= ated. */ bool MainWin::newProject(){ - //close the current project, if available - if (!closeProject()) - return false; - - QApplication::processEvents(QEventLoop::AllEvents, 100); - - if (m_project) - delete m_project; - - if (m_aspectTreeModel) - delete m_aspectTreeModel; - - m_project =3D new Project(); - m_currentAspect =3D m_project; - m_currentFolder =3D m_project; - - KConfigGroup group =3D KGlobal::config()->group("General"); - Project::MdiWindowVisibility vis =3D Project::MdiWindowVisibility(group.r= eadEntry("MdiWindowVisibility", 0)); - m_project->setMdiWindowVisibility( vis ); - if (vis =3D=3D Project::folderOnly) - m_visibilityFolderAction->setChecked(true); - else if (vis =3D=3D Project::folderAndSubfolders) - m_visibilitySubfolderAction->setChecked(true); - else - m_visibilityAllAction->setChecked(true); - - m_aspectTreeModel =3D new AspectTreeModel(m_project, this); - - //newProject is called for the first time, there is no project explorer y= et - //-> initialize the project explorer, the GUI-observer and the dock widg= ets. - if ( m_projectExplorer=3D=3D0 ){ - m_projectExplorerDock =3D new QDockWidget(this); - m_projectExplorerDock->setObjectName("projectexplorer"); - m_projectExplorerDock->setWindowTitle(i18n("Project Explorer")); - addDockWidget(Qt::LeftDockWidgetArea, m_projectExplorerDock); - - m_projectExplorer =3D new ProjectExplorer(m_projectExplorerDock); - m_projectExplorerDock->setWidget(m_projectExplorer); - - connect(m_projectExplorer, SIGNAL(currentAspectChanged(AbstractAspect*)), - this, SLOT(handleCurrentAspectChanged(AbstractAspect*))); - - //Properties dock - m_propertiesDock =3D new QDockWidget(this); - m_propertiesDock->setObjectName("aspect_properties_dock"); - m_propertiesDock->setWindowTitle(i18n("Properties")); - addDockWidget(Qt::RightDockWidgetArea, m_propertiesDock); - - stackedWidget =3D new QStackedWidget(m_propertiesDock); - m_propertiesDock->setWidget(stackedWidget); - - //GUI-observer; - m_guiObserver =3D new GuiObserver(this); - } - - m_projectExplorer->setModel(m_aspectTreeModel); - m_projectExplorer->setProject(m_project); - m_projectExplorer->setCurrentAspect(m_project); - - m_projectExplorerDock->show(); - m_propertiesDock->show(); - updateGUIOnProjectChanges(); - - connect(m_project, SIGNAL(aspectAdded(const AbstractAspect*)), this, SLOT= (handleAspectAdded(const AbstractAspect*))); - connect(m_project, SIGNAL(aspectRemoved(const AbstractAspect*,const Abstr= actAspect*,const AbstractAspect*)), - this, SLOT(handleAspectRemoved(const AbstractAspect*))); - connect(m_project, SIGNAL(aspectAboutToBeRemoved(const AbstractAspect*)), - this, SLOT(handleAspectAboutToBeRemoved(const AbstractAspect*))); - connect(m_project, SIGNAL(statusInfo(QString)), statusBar(), SLOT(showMes= sage(QString))); - connect(m_project, SIGNAL(changed()), this, SLOT(projectChanged())); - connect(m_project, SIGNAL(requestProjectContextMenu(QMenu*)), this, SLOT(= createContextMenu(QMenu*))); - connect(m_project, SIGNAL(requestFolderContextMenu(const Folder*,QMenu*))= , this, SLOT(createFolderContextMenu(const Folder*,QMenu*))); - connect(m_project, SIGNAL(mdiWindowVisibilityChanged()), this, SLOT(updat= eMdiWindowVisibility())); - - m_undoViewEmptyLabel =3D i18n("Project %1 created", m_project->name()); - setCaption(m_project->name()); - - return true; + //close the current project, if available + if (!closeProject()) + return false; + + QApplication::processEvents(QEventLoop::AllEvents, 100); + + if (m_project) + delete m_project; + + if (m_aspectTreeModel) + delete m_aspectTreeModel; + + m_project =3D new Project(); + m_currentAspect =3D m_project; + m_currentFolder =3D m_project; + + KConfigGroup group =3D KSharedConfig::openConfig()->group("General"); + Project::MdiWindowVisibility vis =3D Project::MdiWindowVisibility(grou= p.readEntry("MdiWindowVisibility", 0)); + m_project->setMdiWindowVisibility( vis ); + if (vis =3D=3D Project::folderOnly) + m_visibilityFolderAction->setChecked(true); + else if (vis =3D=3D Project::folderAndSubfolders) + m_visibilitySubfolderAction->setChecked(true); + else + m_visibilityAllAction->setChecked(true); + + m_aspectTreeModel =3D new AspectTreeModel(m_project, this); + + //newProject is called for the first time, there is no project explore= r yet + //-> initialize the project explorer, the GUI-observer and the dock w= idgets. + if ( m_projectExplorer=3D=3D0 ){ + m_projectExplorerDock =3D new QDockWidget(this); + m_projectExplorerDock->setObjectName("projectexplorer"); + m_projectExplorerDock->setWindowTitle(i18n("Project Explorer")); + addDockWidget(Qt::LeftDockWidgetArea, m_projectExplorerDock); + + m_projectExplorer =3D new ProjectExplorer(m_projectExplorerDock); + m_projectExplorerDock->setWidget(m_projectExplorer); + + connect(m_projectExplorer, SIGNAL(currentAspectChanged(AbstractAsp= ect*)), + this, SLOT(handleCurrentAspectChanged(AbstractAspect*))); + + //Properties dock + m_propertiesDock =3D new QDockWidget(this); + m_propertiesDock->setObjectName("aspect_properties_dock"); + m_propertiesDock->setWindowTitle(i18n("Properties")); + addDockWidget(Qt::RightDockWidgetArea, m_propertiesDock); + + stackedWidget =3D new QStackedWidget(m_propertiesDock); + m_propertiesDock->setWidget(stackedWidget); + + //GUI-observer; + m_guiObserver =3D new GuiObserver(this); + } + + m_projectExplorer->setModel(m_aspectTreeModel); + m_projectExplorer->setProject(m_project); + m_projectExplorer->setCurrentAspect(m_project); + + m_projectExplorerDock->show(); + m_propertiesDock->show(); + updateGUIOnProjectChanges(); + + connect(m_project, SIGNAL(aspectAdded(const AbstractAspect*)), this, S= LOT(handleAspectAdded(const AbstractAspect*))); + connect(m_project, SIGNAL(aspectRemoved(const AbstractAspect*,const Ab= stractAspect*,const AbstractAspect*)), + this, SLOT(handleAspectRemoved(const AbstractAspect*))); + connect(m_project, SIGNAL(aspectAboutToBeRemoved(const AbstractAspect*= )), + this, SLOT(handleAspectAboutToBeRemoved(const AbstractAspect*)= )); + connect(m_project, SIGNAL(statusInfo(QString)), statusBar(), SLOT(show= Message(QString))); + connect(m_project, SIGNAL(changed()), this, SLOT(projectChanged())); + connect(m_project, SIGNAL(requestProjectContextMenu(QMenu*)), this, SL= OT(createContextMenu(QMenu*))); + connect(m_project, SIGNAL(requestFolderContextMenu(const Folder*,QMenu= *)), this, SLOT(createFolderContextMenu(const Folder*,QMenu*))); + connect(m_project, SIGNAL(mdiWindowVisibilityChanged()), this, SLOT(up= dateMdiWindowVisibility())); + + m_undoViewEmptyLabel =3D i18n("Project %1 created", m_project->name()); + setCaption(m_project->name()); + + return true; } = void MainWin::openProject(){ - KConfigGroup conf(KSharedConfig::openConfig(), "MainWin"); - QString dir =3D conf.readEntry("LastOpenDir", ""); - QString path =3D KFileDialog::getOpenFileName(KUrl(dir), - i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.G= Z *.LML.BZ2)"), - this, i18n("Open project")); - - if (!path.isEmpty()) { - this->openProject(path); - - int pos =3D path.lastIndexOf(QDir::separator()); - if (pos!=3D-1) { - QString newDir =3D path.left(pos); - if (newDir!=3Ddir) - conf.writeEntry("LastOpenDir", newDir); - } - } + KConfigGroup conf(KSharedConfig::openConfig(), "MainWin"); + QString dir =3D conf.readEntry("LastOpenDir", ""); + QString path =3D QFileDialog::getOpenFileName(this,i18n("Open project"= ), dir, + i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.G= Z *.LML.BZ2)")); + + if (!path.isEmpty()) { + this->openProject(path); + + int pos =3D path.lastIndexOf(QDir::separator()); + if (pos!=3D-1) { + QString newDir =3D path.left(pos); + if (newDir!=3Ddir) + conf.writeEntry("LastOpenDir", newDir); + } + } } = void MainWin::openProject(const QString& filename) { - if (filename =3D=3D m_currentFileName) { - KMessageBox::information(this, - i18n("The project file %1 is already opened.", filename),i18n("Open pro= ject")); - return; - } - - QIODevice *file =3D KFilterDev::deviceForFile(filename,"application/x-gzi= p",true); - if (file=3D=3D0) - file =3D new QFile(filename); - - if (!file->open(QIODevice::ReadOnly)) { - KMessageBox::error(this, i18n("Sorry. Could not open file for reading.")= ); - return; - } - - //TODO: this solves the problem with empty files (the application doesn't= hang anymore) - //but it crashes from time to time at unexpected places within Qt. + if (filename =3D=3D m_currentFileName) { + KMessageBox::information(this, + i18n("The project file %1 is already opened.", filename),i18n(= "Open project")); + return; + } + + QIODevice *file =3D KFilterDev::deviceForFile(filename,"application/x-= gzip",true); + if (file=3D=3D0) + file =3D new QFile(filename); + + if (!file->open(QIODevice::ReadOnly)) { + KMessageBox::error(this, i18n("Sorry. Could not open file for read= ing.")); + return; + } + + //TODO: this solves the problem with empty files (the application does= n't hang anymore) + //but it crashes from time to time at unexpected places within Qt. // char* c; // bool rc =3D file->getChar(c); // if (!rc) { @@ -659,57 +658,57 @@ void MainWin::openProject(const QString& filename) { // } // file->seek(0); = - if (!newProject()){ - file->close(); - delete file; - return; - } - - WAIT_CURSOR; - QElapsedTimer timer; - timer.start(); - bool rc =3D openXML(file); - file->close(); - delete file; - if (!rc) { - closeProject(); - return; - } - - m_currentFileName =3D filename; - m_project->setFileName(filename); - m_project->undoStack()->clear(); - m_undoViewEmptyLabel =3D i18n("Project %1 opened", m_project->name()); - m_recentProjectsAction->addUrl( KUrl(filename) ); - setCaption(m_project->name()); - updateGUIOnProjectChanges(); - updateGUI(); //there are most probably worksheets or spreadsheets in the = open project -> update the GUI - m_saveAction->setEnabled(false); - - statusBar()->showMessage( i18n("Project successfully opened (in %1 second= s).").arg((float)timer.elapsed()/1000) ); - - if (m_autoSaveActive) - m_autoSaveTimer.start(); - - RESET_CURSOR; + if (!newProject()){ + file->close(); + delete file; + return; + } + + WAIT_CURSOR; + QElapsedTimer timer; + timer.start(); + bool rc =3D openXML(file); + file->close(); + delete file; + if (!rc) { + closeProject(); + return; + } + + m_currentFileName =3D filename; + m_project->setFileName(filename); + m_project->undoStack()->clear(); + m_undoViewEmptyLabel =3D i18n("Project %1 opened", m_project->name()); + m_recentProjectsAction->addUrl( QUrl(filename) ); + setCaption(m_project->name()); + updateGUIOnProjectChanges(); + updateGUI(); //there are most probably worksheets or spreadsheets in t= he open project -> update the GUI + m_saveAction->setEnabled(false); + + statusBar()->showMessage( i18n("Project successfully opened (in %1 sec= onds).").arg((float)timer.elapsed()/1000) ); + + if (m_autoSaveActive) + m_autoSaveTimer.start(); + + RESET_CURSOR; } = -void MainWin::openRecentProject(const KUrl& url) { - this->openProject(url.path()); +void MainWin::openRecentProject(const QUrl& url) { + this->openProject(url.path()); } = bool MainWin::openXML(QIODevice *file) { - XmlStreamReader reader(file); - if (m_project->load(&reader) =3D=3D false) { - RESET_CURSOR; - kDebug()<<"ERROR: reading file content"<showMessage(msg_text); - return false; - } - - //TODO: show warnings in a kind of "log window" but not in message box + XmlStreamReader reader(file); + if (m_project->load(&reader) =3D=3D false) { + RESET_CURSOR; + kDebug()<<"ERROR: reading file content"<showMessage(msg_text); + return false; + } + + //TODO: show warnings in a kind of "log window" but not in message box // if (reader.hasWarnings()) { // QString msg_text =3D i18n("The following problems occurred when loadi= ng the project:\n"); // QStringList warnings =3D reader.warningStrings(); @@ -719,15 +718,15 @@ bool MainWin::openXML(QIODevice *file) { // statusBar()->showMessage(msg_text); // } = - return true; + return true; } = /*! - Closes the current project, if available. Return \c true, if the project = was closed. + Closes the current project, if available. Return \c true, if the proje= ct was closed. */ bool MainWin::closeProject(){ - if (m_project=3D=3D0) - return true; //nothing to close + if (m_project=3D=3D0) + return true; //nothing to close = // int b =3D KMessageBox::warningYesNo( this, // i18n("The current project %1 will be closed. Do you want to c= ontinue?", m_project->name()), @@ -735,171 +734,168 @@ bool MainWin::closeProject(){ // if (b=3D=3DKMessageBox::No) // return false; = - if(warnModified()) - return false; - - delete m_aspectTreeModel; - m_aspectTreeModel=3D0; - delete m_project; - m_project=3D0; - m_currentFileName =3D ""; - - //update the UI if we're just closing a project - //and not closing(quitting) the application - if (!m_closing) { - m_projectExplorerDock->hide(); - m_propertiesDock->hide(); - m_currentAspect=3D0; - m_currentFolder=3D0; - updateGUIOnProjectChanges(); - - if (m_autoSaveActive) - m_autoSaveTimer.stop(); - } - - return true; + if(warnModified()) + return false; + + delete m_aspectTreeModel; + m_aspectTreeModel=3D0; + delete m_project; + m_project=3D0; + m_currentFileName =3D ""; + + //update the UI if we're just closing a project + //and not closing(quitting) the application + if (!m_closing) { + m_projectExplorerDock->hide(); + m_propertiesDock->hide(); + m_currentAspect=3D0; + m_currentFolder=3D0; + updateGUIOnProjectChanges(); + + if (m_autoSaveActive) + m_autoSaveTimer.stop(); + } + + return true; } = bool MainWin::saveProject() { - const QString& fileName =3D m_project->fileName(); - if(fileName.isEmpty()) - return saveProjectAs(); - else - return save(fileName); + const QString& fileName =3D m_project->fileName(); + if(fileName.isEmpty()) + return saveProjectAs(); + else + return save(fileName); } = bool MainWin::saveProjectAs() { - KConfigGroup conf(KSharedConfig::openConfig(), "MainWin"); - QString dir =3D conf.readEntry("LastOpenDir", ""); - QString fileName =3D KFileDialog::getSaveFileName(KUrl(dir), - i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.GZ *.= LML.BZ2)"), - this, i18n("Save project as")); + QString fileName =3D QFileDialog::getSaveFileName(this, i18n("Save pro= ject as"),QString::null, + i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.GZ *.= LML.BZ2)")); = - if( fileName.isEmpty() )// "Cancel" was clicked - return false; + if( fileName.isEmpty() )// "Cancel" was clicked + return false; = - if( fileName.contains(QString(".lml"),Qt::CaseInsensitive) =3D=3D false ) - fileName.append(".lml"); + if( fileName.contains(QString(".lml"),Qt::CaseInsensitive) =3D=3D fals= e ) + fileName.append(".lml"); = - return save(fileName); + return save(fileName); } = /*! * auxillary function that does the actual saving of the project */ bool MainWin::save(const QString& fileName) { - WAIT_CURSOR; - QIODevice* file =3D KFilterDev::deviceForFile(fileName, "application/x-gz= ip", true); - if (file =3D=3D 0) - file =3D new QFile(fileName); - - bool ok; - if(file->open(QIODevice::WriteOnly)){ - m_project->setFileName(fileName); - - QXmlStreamWriter writer(file); - m_project->save(&writer); - m_project->undoStack()->clear(); - m_project->setChanged(false); - file->close(); - - setCaption(m_project->name()); - statusBar()->showMessage(i18n("Project saved")); - m_saveAction->setEnabled(false); - m_recentProjectsAction->addUrl( KUrl(fileName) ); - ok =3D true; - - //if the project dock is visible, refresh the shown content - //(version and modification time might have been changed) - if (stackedWidget->currentWidget() =3D=3D projectDock) - projectDock->setProject(m_project); - - //we have a file name now - // -> auto save can be activated now if not happened yet - if (m_autoSaveActive && !m_autoSaveTimer.isActive()) - m_autoSaveTimer.start(); - }else{ - KMessageBox::error(this, i18n("Sorry. Could not open file for writing.")= ); - ok =3D false; - } - - if (file !=3D 0) - delete file; - - RESET_CURSOR; - return ok; + WAIT_CURSOR; + QIODevice* file =3D KFilterDev::deviceForFile(fileName, "application/x= -gzip", true); + if (file =3D=3D 0) + file =3D new QFile(fileName); + + bool ok; + if(file->open(QIODevice::WriteOnly)){ + m_project->setFileName(fileName); + + QXmlStreamWriter writer(file); + m_project->save(&writer); + m_project->undoStack()->clear(); + m_project->setChanged(false); + file->close(); + + setCaption(m_project->name()); + statusBar()->showMessage(i18n("Project saved")); + m_saveAction->setEnabled(false); + m_recentProjectsAction->addUrl( QUrl(fileName) ); + ok =3D true; + + //if the project dock is visible, refresh the shown content + //(version and modification time might have been changed) + if (stackedWidget->currentWidget() =3D=3D projectDock) + projectDock->setProject(m_project); + + //we have a file name now + // -> auto save can be activated now if not happened yet + if (m_autoSaveActive && !m_autoSaveTimer.isActive()) + m_autoSaveTimer.start(); + }else{ + KMessageBox::error(this, i18n("Sorry. Could not open file for writ= ing.")); + ok =3D false; + } + + if (file !=3D 0) + delete file; + + RESET_CURSOR; + return ok; } = /*! * automatically saves the project in the specified time interval. */ void MainWin::autoSaveProject() { - //don't auto save when there are no changes or the file name - //was not provided yet (the project was never explicitly saved yet). - if ( !m_project->hasChanged() || m_project->fileName().isEmpty()) - return; + //don't auto save when there are no changes or the file name + //was not provided yet (the project was never explicitly saved yet). + if ( !m_project->hasChanged() || m_project->fileName().isEmpty()) + return; = - this->saveProject(); + this->saveProject(); } = /*! - prints the current sheet (worksheet or spreadsheet) + prints the current sheet (worksheet or spreadsheet) */ void MainWin::print(){ - QPrinter printer; - - //determine first, whether we want to export a worksheet or a spreadsheet - Worksheet* w=3Dthis->activeWorksheet(); - if (w!=3D0){ //worksheet - QPrintDialog *dialog =3D new QPrintDialog(&printer, this); - dialog->setWindowTitle(i18n("Print worksheet")); - if (dialog->exec() !=3D QDialog::Accepted) - return; - - WorksheetView* view =3D qobject_cast(w->view()); - view->print(&printer); - statusBar()->showMessage(i18n("Worksheet printed")); - }else{ - //Spreadsheet - Spreadsheet* s=3Dthis->activeSpreadsheet(); - QPrintDialog *dialog =3D new QPrintDialog(&printer, this); - dialog->setWindowTitle(i18n("Print spreadsheet")); - if (dialog->exec() !=3D QDialog::Accepted) - return; - - SpreadsheetView* view =3D qobject_cast(s->view()); - view->print(&printer); - - statusBar()->showMessage(i18n("Spreadsheet printed")); - } + QPrinter printer; + + //determine first, whether we want to export a worksheet or a spreadsh= eet + Worksheet* w=3Dthis->activeWorksheet(); + if (w!=3D0){ //worksheet + QPrintDialog *dialog =3D new QPrintDialog(&printer, this); + dialog->setWindowTitle(i18n("Print worksheet")); + if (dialog->exec() !=3D QDialog::Accepted) + return; + + WorksheetView* view =3D qobject_cast(w->view()); + view->print(&printer); + statusBar()->showMessage(i18n("Worksheet printed")); + }else{ + //Spreadsheet + Spreadsheet* s=3Dthis->activeSpreadsheet(); + QPrintDialog *dialog =3D new QPrintDialog(&printer, this); + dialog->setWindowTitle(i18n("Print spreadsheet")); + if (dialog->exec() !=3D QDialog::Accepted) + return; + + SpreadsheetView* view =3D qobject_cast(s->view()= ); + view->print(&printer); + + statusBar()->showMessage(i18n("Spreadsheet printed")); + } } = void MainWin::printPreview(){ - Worksheet* w=3Dthis->activeWorksheet(); - if (w!=3D0){ //worksheet - WorksheetView* view =3D qobject_cast(w->view()); - QPrintPreviewDialog *dialog =3D new QPrintPreviewDialog(this); - connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(print(QPri= nter*))); - dialog->exec(); - }else{ - //Spreadsheet - Spreadsheet* s=3Dthis->activeSpreadsheet(); - if (s!=3D0){ - SpreadsheetView* view =3D qobject_cast(s->view()); - QPrintPreviewDialog *dialog =3D new QPrintPreviewDialog(this); - connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(print(QPr= inter*))); - dialog->exec(); - } - } + Worksheet* w=3Dthis->activeWorksheet(); + if (w!=3D0){ //worksheet + WorksheetView* view =3D qobject_cast(w->view()); + QPrintPreviewDialog *dialog =3D new QPrintPreviewDialog(this); + connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(prin= t(QPrinter*))); + dialog->exec(); + }else{ + //Spreadsheet + Spreadsheet* s=3Dthis->activeSpreadsheet(); + if (s!=3D0){ + SpreadsheetView* view =3D qobject_cast(s->vi= ew()); + QPrintPreviewDialog *dialog =3D new QPrintPreviewDialog(this); + connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(= print(QPrinter*))); + dialog->exec(); + } + } } = /*! - adds a new Spreadsheet to the project. + adds a new Spreadsheet to the project. */ void MainWin::newSpreadsheet(){ - Spreadsheet* spreadsheet =3D new Spreadsheet(0, i18n("Spreadsheet")); - spreadsheet->initDefault(); - this->addAspectToProject(spreadsheet); + Spreadsheet* spreadsheet =3D new Spreadsheet(0, i18n("Spreadsheet")); + spreadsheet->initDefault(); + this->addAspectToProject(spreadsheet); } = /*! @@ -907,109 +903,109 @@ void MainWin::newSpreadsheet(){ * this slot is only supposed to be called from ImportFileDialog */ void MainWin::newSpreadsheetForImportFileDialog(const QString& name){ - if (!m_importFileDialog) - return; + if (!m_importFileDialog) + return; = - Spreadsheet* spreadsheet =3D new Spreadsheet(0, name); - spreadsheet->initDefault(); - this->addAspectToProject(spreadsheet); + Spreadsheet* spreadsheet =3D new Spreadsheet(0, name); + spreadsheet->initDefault(); + this->addAspectToProject(spreadsheet); = - std::auto_ptr model(new AspectTreeModel(m_project, th= is)); - m_importFileDialog->updateModel( model ); + std::auto_ptr model(new AspectTreeModel(m_project,= this)); + m_importFileDialog->updateModel( model ); = - //TODO add Matrix here in future. - if ( m_currentAspect->inherits("Spreadsheet") ) - m_importFileDialog->setCurrentIndex( m_projectExplorer->currentIndex()); + //TODO add Matrix here in future. + if ( m_currentAspect->inherits("Spreadsheet") ) + m_importFileDialog->setCurrentIndex( m_projectExplorer->currentInd= ex()); } /*! - adds a new Worksheet to the project. + adds a new Worksheet to the project. */ void MainWin::newWorksheet() { - Worksheet* worksheet=3D new Worksheet(0, i18n("Worksheet")); - this->addAspectToProject(worksheet); + Worksheet* worksheet=3D new Worksheet(0, i18n("Worksheet")); + this->addAspectToProject(worksheet); } = /*! - returns a pointer to a Spreadsheet-object, if the currently active Mdi-Su= bwindow is \a SpreadsheetView. - Otherwise returns \a 0. + returns a pointer to a Spreadsheet-object, if the currently active Mdi= -Subwindow is \a SpreadsheetView. + Otherwise returns \a 0. */ Spreadsheet* MainWin::activeSpreadsheet() const{ - QMdiSubWindow* win =3D m_mdiArea->currentSubWindow(); - if (!win) - return 0; + QMdiSubWindow* win =3D m_mdiArea->currentSubWindow(); + if (!win) + return 0; = - AbstractPart* part =3D dynamic_cast(win)->part(); - Q_ASSERT(part); - return dynamic_cast(part); + AbstractPart* part =3D dynamic_cast(win)->part(); + Q_ASSERT(part); + return dynamic_cast(part); } = /*! - returns a pointer to a Worksheet-object, if the currently active Mdi-Subw= indow is \a WorksheetView - Otherwise returns \a 0. + returns a pointer to a Worksheet-object, if the currently active Mdi-S= ubwindow is \a WorksheetView + Otherwise returns \a 0. */ Worksheet* MainWin::activeWorksheet() const{ - QMdiSubWindow* win =3D m_mdiArea->currentSubWindow(); - if (!win) - return 0; + QMdiSubWindow* win =3D m_mdiArea->currentSubWindow(); + if (!win) + return 0; = - AbstractPart* part =3D dynamic_cast(win)->part(); - Q_ASSERT(part); - return dynamic_cast(part); + AbstractPart* part =3D dynamic_cast(win)->part(); + Q_ASSERT(part); + return dynamic_cast(part); } = /*! - called if there were changes in the project. - Adds "changed" to the window caption and activates the save-Action. + called if there were changes in the project. + Adds "changed" to the window caption and activates the save-Action. */ void MainWin::projectChanged(){ - setCaption(i18n("%1 [Changed]", m_project->name())); - m_saveAction->setEnabled(true); - m_undoAction->setEnabled(true); - return; + setCaption(i18n("%1 [Changed]", m_project->name())); + m_saveAction->setEnabled(true); + m_undoAction->setEnabled(true); + return; } = void MainWin::handleCurrentSubWindowChanged(QMdiSubWindow* win){ - PartMdiView *view =3D qobject_cast(win); - if (!view) - return; - - if (view =3D=3D m_currentSubWindow){ - //do nothing, if the current sub-window gets selected again. - //This event happens, when labplot loses the focus (modal window is open= ed or the user switches to another application) - //and gets it back (modal window is closed or the user switches back to = labplot). - return; - }else{ - m_currentSubWindow =3D view; - } - - updateGUI(); - if (!m_suppressCurrentSubWindowChangedEvent) - m_projectExplorer->setCurrentAspect(view->part()); + PartMdiView *view =3D qobject_cast(win); + if (!view) + return; + + if (view =3D=3D m_currentSubWindow){ + //do nothing, if the current sub-window gets selected again. + //This event happens, when labplot loses the focus (modal window i= s opened or the user switches to another application) + //and gets it back (modal window is closed or the user switches ba= ck to labplot). + return; + }else{ + m_currentSubWindow =3D view; + } + + updateGUI(); + if (!m_suppressCurrentSubWindowChangedEvent) + m_projectExplorer->setCurrentAspect(view->part()); } = void MainWin::handleAspectAdded(const AbstractAspect* aspect) { - const AbstractPart* part =3D dynamic_cast(aspect); - if (part) { - connect(part, SIGNAL(exportRequested()), this, SLOT(exportDialog())); - connect(part, SIGNAL(printRequested()), this, SLOT(print())); - connect(part, SIGNAL(printPreviewRequested()), this, SLOT(printPreview()= )); - connect(part, SIGNAL(showRequested()), this, SLOT(handleShowSubWindowReq= uested())); - } + const AbstractPart* part =3D dynamic_cast(aspect); + if (part) { + connect(part, SIGNAL(exportRequested()), this, SLOT(exportDialog()= )); + connect(part, SIGNAL(printRequested()), this, SLOT(print())); + connect(part, SIGNAL(printPreviewRequested()), this, SLOT(printPre= view())); + connect(part, SIGNAL(showRequested()), this, SLOT(handleShowSubWin= dowRequested())); + } } = void MainWin::handleAspectRemoved(const AbstractAspect *parent){ - m_projectExplorer->setCurrentAspect(parent); + m_projectExplorer->setCurrentAspect(parent); } = void MainWin::handleAspectAboutToBeRemoved(const AbstractAspect *aspect){ - const AbstractPart *part =3D qobject_cast(aspect); - if (!part) return; - PartMdiView *win =3D part->mdiSubWindow(); - Q_ASSERT(win); - disconnect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowS= tatus,PartMdiView::SubWindowStatus)), - this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWind= owStatus,PartMdiView::SubWindowStatus))); - m_mdiArea->removeSubWindow(win); - updateGUI(); + const AbstractPart *part =3D qobject_cast(aspect); + if (!part) return; + PartMdiView *win =3D part->mdiSubWindow(); + Q_ASSERT(win); + disconnect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWind= owStatus,PartMdiView::SubWindowStatus)), + this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::S= ubWindowStatus,PartMdiView::SubWindowStatus))); + m_mdiArea->removeSubWindow(win); + updateGUI(); } = /*! @@ -1017,331 +1013,331 @@ void MainWin::handleAspectAboutToBeRemoved(const = AbstractAspect *aspect){ Selects the new aspect. */ void MainWin::handleCurrentAspectChanged(AbstractAspect *aspect){ - if (!aspect) - aspect =3D m_project; // should never happen, just in case + if (!aspect) + aspect =3D m_project; // should never happen, just in case = - m_suppressCurrentSubWindowChangedEvent =3D true; - if(aspect->folder() !=3D m_currentFolder) { - m_currentFolder =3D aspect->folder(); - updateMdiWindowVisibility(); - } + m_suppressCurrentSubWindowChangedEvent =3D true; + if(aspect->folder() !=3D m_currentFolder) { + m_currentFolder =3D aspect->folder(); + updateMdiWindowVisibility(); + } = - m_currentAspect =3D aspect; + m_currentAspect =3D aspect; = - //activate the corresponding MDI sub window for the current aspect - activateSubWindowForAspect(aspect); - m_suppressCurrentSubWindowChangedEvent =3D false; + //activate the corresponding MDI sub window for the current aspect + activateSubWindowForAspect(aspect); + m_suppressCurrentSubWindowChangedEvent =3D false; } = void MainWin::activateSubWindowForAspect(const AbstractAspect* aspect) con= st { - const AbstractPart* part =3D dynamic_cast(aspect); - if (part) { - if (dynamic_cast(part)) - return; - - PartMdiView* win =3D part->mdiSubWindow(); - if (m_mdiArea->subWindowList().indexOf(win) =3D=3D -1) { - m_mdiArea->addSubWindow(win); - connect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowSt= atus,PartMdiView::SubWindowStatus)), - this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWi= ndowStatus,PartMdiView::SubWindowStatus))); - } - win->show(); - m_mdiArea->setActiveSubWindow(win); - } else { - AbstractAspect* parent =3D aspect->parentAspect(); - if (parent) - activateSubWindowForAspect(parent); - } - return; + const AbstractPart* part =3D dynamic_cast(aspect); + if (part) { + if (dynamic_cast(part)) + return; + + PartMdiView* win =3D part->mdiSubWindow(); + if (m_mdiArea->subWindowList().indexOf(win) =3D=3D -1) { + m_mdiArea->addSubWindow(win); + connect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::Su= bWindowStatus,PartMdiView::SubWindowStatus)), + this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMd= iView::SubWindowStatus,PartMdiView::SubWindowStatus))); + } + win->show(); + m_mdiArea->setActiveSubWindow(win); + } else { + AbstractAspect* parent =3D aspect->parentAspect(); + if (parent) + activateSubWindowForAspect(parent); + } + return; } = void MainWin::handleSubWindowStatusChange(PartMdiView * view, PartMdiView:= :SubWindowStatus from, PartMdiView::SubWindowStatus to){ - Q_UNUSED(from); - Q_UNUSED(to); - if (view =3D=3D m_mdiArea->currentSubWindow()) { - updateGUI(); - } + Q_UNUSED(from); + Q_UNUSED(to); + if (view =3D=3D m_mdiArea->currentSubWindow()) { + updateGUI(); + } } = void MainWin::setMdiWindowVisibility(QAction * action){ - m_project->setMdiWindowVisibility((Project::MdiWindowVisibility)(action->= data().toInt())); + m_project->setMdiWindowVisibility((Project::MdiWindowVisibility)(actio= n->data().toInt())); } = /*! - shows the sub window of a worksheet or a spreadsheet. - Used if the window was closed before and the user asks to show - the window again via the context menu in the project explorer. + shows the sub window of a worksheet or a spreadsheet. + Used if the window was closed before and the user asks to show + the window again via the context menu in the project explorer. */ void MainWin::handleShowSubWindowRequested() { - activateSubWindowForAspect(m_currentAspect); + activateSubWindowForAspect(m_currentAspect); } = void MainWin::newScript(){ - //TODO + //TODO } = void MainWin::newMatrix(){ - //TODO + //TODO } = void MainWin::newFolder() { - Folder * folder =3D new Folder(i18n("Folder %1", 1)); - this->addAspectToProject(folder); + Folder * folder =3D new Folder(i18n("Folder %1", 1)); + this->addAspectToProject(folder); } = /*! - this is called on a right click on the root folder in the project explorer + this is called on a right click on the root folder in the project expl= orer */ void MainWin::createContextMenu(QMenu* menu) const { - menu->addMenu(m_newMenu); + menu->addMenu(m_newMenu); = - //The tabbed view collides with the visibility policy for the subwindows. - //Hide the menus for the visibility policy if the tabbed view is used. - if (m_mdiArea->viewMode() !=3D QMdiArea::TabbedView) - menu->addMenu(m_visibilityMenu); + //The tabbed view collides with the visibility policy for the subwindo= ws. + //Hide the menus for the visibility policy if the tabbed view is used. + if (m_mdiArea->viewMode() !=3D QMdiArea::TabbedView) + menu->addMenu(m_visibilityMenu); } = /*! - this is called on a right click on a non-root folder in the project explo= rer + this is called on a right click on a non-root folder in the project ex= plorer */ void MainWin::createFolderContextMenu(const Folder* folder, QMenu* menu) c= onst{ - Q_UNUSED(folder); + Q_UNUSED(folder); = - //Folder provides it's own context menu. Add a separator before adding ad= ditional actions. - menu->addSeparator(); - this->createContextMenu(menu); + //Folder provides it's own context menu. Add a separator before adding= additional actions. + menu->addSeparator(); + this->createContextMenu(menu); } = void MainWin::undo(){ - WAIT_CURSOR; - m_project->undoStack()->undo(); - if (m_project->undoStack()->index()=3D=3D0) { - setCaption(m_project->name()); - m_saveAction->setEnabled(false); - m_undoAction->setEnabled(false); - m_project->setChanged(false); - } - m_redoAction->setEnabled(true); - RESET_CURSOR; + WAIT_CURSOR; + m_project->undoStack()->undo(); + if (m_project->undoStack()->index()=3D=3D0) { + setCaption(m_project->name()); + m_saveAction->setEnabled(false); + m_undoAction->setEnabled(false); + m_project->setChanged(false); + } + m_redoAction->setEnabled(true); + RESET_CURSOR; } = void MainWin::redo(){ - WAIT_CURSOR; - m_project->undoStack()->redo(); - projectChanged(); - if (m_project->undoStack()->index() =3D=3D m_project->undoStack()->count(= )) - m_redoAction->setEnabled(false); - RESET_CURSOR; + WAIT_CURSOR; + m_project->undoStack()->redo(); + projectChanged(); + if (m_project->undoStack()->index() =3D=3D m_project->undoStack()->cou= nt()) + m_redoAction->setEnabled(false); + RESET_CURSOR; } = /*! - Shows/hides mdi sub-windows depending on the current visibility policy. + Shows/hides mdi sub-windows depending on the current visibility policy. */ void MainWin::updateMdiWindowVisibility() const{ - QList windows =3D m_mdiArea->subWindowList(); - PartMdiView * part_view; - switch(m_project->mdiWindowVisibility()){ - case Project::allMdiWindows: - foreach(QMdiSubWindow *window, windows){ - part_view =3D qobject_cast(window); - Q_ASSERT(part_view); - part_view->show(); - } - break; - case Project::folderOnly: - foreach(QMdiSubWindow *window, windows){ - part_view =3D qobject_cast(window); - Q_ASSERT(part_view); - if(part_view->part()->folder() =3D=3D m_currentFolder) - part_view->show(); - else - part_view->hide(); - } - break; - case Project::folderAndSubfolders: - foreach(QMdiSubWindow *window, windows){ - part_view =3D qobject_cast(window); - if(part_view->part()->isDescendantOf(m_currentFolder)) - part_view->show(); - else - part_view->hide(); - } - break; - } + QList windows =3D m_mdiArea->subWindowList(); + PartMdiView * part_view; + switch(m_project->mdiWindowVisibility()){ + case Project::allMdiWindows: + foreach(QMdiSubWindow *window, windows){ + part_view =3D qobject_cast(window); + Q_ASSERT(part_view); + part_view->show(); + } + break; + case Project::folderOnly: + foreach(QMdiSubWindow *window, windows){ + part_view =3D qobject_cast(window); + Q_ASSERT(part_view); + if(part_view->part()->folder() =3D=3D m_currentFolder) + part_view->show(); + else + part_view->hide(); + } + break; + case Project::folderAndSubfolders: + foreach(QMdiSubWindow *window, windows){ + part_view =3D qobject_cast(window); + if(part_view->part()->isDescendantOf(m_currentFolder)) + part_view->show(); + else + part_view->hide(); + } + break; + } } = void MainWin::toggleDockWidget(QAction* action) const{ - if (action->objectName() =3D=3D "toggle_project_explorer_dock"){ - if (m_projectExplorerDock->isVisible()) - m_projectExplorerDock->hide(); - else - m_projectExplorerDock->show(); - }else if (action->objectName() =3D=3D "toggle_properties_explorer_dock"){ - if (m_propertiesDock->isVisible()) - m_propertiesDock->hide(); - else - m_propertiesDock->show(); - } + if (action->objectName() =3D=3D "toggle_project_explorer_dock"){ + if (m_projectExplorerDock->isVisible()) + m_projectExplorerDock->hide(); + else + m_projectExplorerDock->show(); + }else if (action->objectName() =3D=3D "toggle_properties_explorer_dock= "){ + if (m_propertiesDock->isVisible()) + m_propertiesDock->hide(); + else + m_propertiesDock->show(); + } } = void MainWin::toggleFullScreen() { - if (this->windowState() =3D=3D Qt::WindowFullScreen){ - this->setWindowState(m_lastWindowState); - } else { - m_lastWindowState =3D this->windowState(); - qDebug()<<"m_lastWindowState " << m_lastWindowState; - this->showFullScreen(); - } + if (this->windowState() =3D=3D Qt::WindowFullScreen){ + this->setWindowState(m_lastWindowState); + } else { + m_lastWindowState =3D this->windowState(); + qDebug()<<"m_lastWindowState " << m_lastWindowState; + this->showFullScreen(); + } } = void MainWin::closeEvent(QCloseEvent* event) { - m_closing =3D true; - if (!this->closeProject()) { - m_closing =3D false; - event->ignore(); - } + m_closing =3D true; + if (!this->closeProject()) { + m_closing =3D false; + event->ignore(); + } } = void MainWin::handleSettingsChanges() { - const KConfigGroup group =3D KGlobal::config()->group( "General" ); - - QMdiArea::ViewMode viewMode =3D QMdiArea::ViewMode(group.readEntry("ViewM= ode", 0)); - if (m_mdiArea->viewMode() !=3D viewMode) { - m_mdiArea->setViewMode(viewMode); - if (viewMode =3D=3D QMdiArea::SubWindowView) - this->updateMdiWindowVisibility(); - } - - if (m_mdiArea->viewMode() =3D=3D QMdiArea::TabbedView) { - m_tileWindows->setVisible(false); - m_cascadeWindows->setVisible(false); - QTabWidget::TabPosition tabPosition =3D QTabWidget::TabPosition(group.re= adEntry("TabPosition", 0)); - if (m_mdiArea->tabPosition() !=3D tabPosition) - m_mdiArea->setTabPosition(tabPosition); - } else { - m_tileWindows->setVisible(true); - m_cascadeWindows->setVisible(true); - } - - //autosave - bool autoSave =3D group.readEntry("AutoSave", 0); - if (m_autoSaveActive !=3D autoSave) { - m_autoSaveActive =3D autoSave; - if (autoSave) - m_autoSaveTimer.start(); - else - m_autoSaveTimer.stop(); - } - - int interval =3D group.readEntry("AutoSaveInterval", 1); - interval =3D interval*60*1000; - if (interval!=3Dm_autoSaveTimer.interval()) - m_autoSaveTimer.setInterval(interval); + const KConfigGroup group =3D KSharedConfig::openConfig()->group( "Gene= ral" ); + + QMdiArea::ViewMode viewMode =3D QMdiArea::ViewMode(group.readEntry("Vi= ewMode", 0)); + if (m_mdiArea->viewMode() !=3D viewMode) { + m_mdiArea->setViewMode(viewMode); + if (viewMode =3D=3D QMdiArea::SubWindowView) + this->updateMdiWindowVisibility(); + } + + if (m_mdiArea->viewMode() =3D=3D QMdiArea::TabbedView) { + m_tileWindows->setVisible(false); + m_cascadeWindows->setVisible(false); + QTabWidget::TabPosition tabPosition =3D QTabWidget::TabPosition(gr= oup.readEntry("TabPosition", 0)); + if (m_mdiArea->tabPosition() !=3D tabPosition) + m_mdiArea->setTabPosition(tabPosition); + } else { + m_tileWindows->setVisible(true); + m_cascadeWindows->setVisible(true); + } + + //autosave + bool autoSave =3D group.readEntry("AutoSave", 0); + if (m_autoSaveActive !=3D autoSave) { + m_autoSaveActive =3D autoSave; + if (autoSave) + m_autoSaveTimer.start(); + else + m_autoSaveTimer.stop(); + } + + int interval =3D group.readEntry("AutoSaveInterval", 1); + interval =3D interval*60*1000; + if (interval!=3Dm_autoSaveTimer.interval()) + m_autoSaveTimer.setInterval(interval); } = /*************************************************************************= **************/ /************************************** dialogs **************************= *************/ /*************************************************************************= **************/ /*! - shows the dialog with the Undo-history. + shows the dialog with the Undo-history. */ void MainWin::historyDialog(){ - if (!m_project->undoStack()) - return; - - HistoryDialog* dialog =3D new HistoryDialog(this, m_project->undoStack(),= m_undoViewEmptyLabel); - int index =3D m_project->undoStack()->index(); - if (dialog->exec() !=3D QDialog::Accepted) { - if (m_project->undoStack()->count() !=3D 0) - m_project->undoStack()->setIndex(index); - } - - //disable undo/redo-actions if the history was cleared - //(in both cases, when accepted or rejected in the dialog) - if (m_project->undoStack()->count() =3D=3D 0) { - m_undoAction->setEnabled(false); - m_redoAction->setEnabled(false); - } + if (!m_project->undoStack()) + return; + + HistoryDialog* dialog =3D new HistoryDialog(this, m_project->undoStack= (), m_undoViewEmptyLabel); + int index =3D m_project->undoStack()->index(); + if (dialog->exec() !=3D QDialog::Accepted) { + if (m_project->undoStack()->count() !=3D 0) + m_project->undoStack()->setIndex(index); + } + + //disable undo/redo-actions if the history was cleared + //(in both cases, when accepted or rejected in the dialog) + if (m_project->undoStack()->count() =3D=3D 0) { + m_undoAction->setEnabled(false); + m_redoAction->setEnabled(false); + } } = /*! Opens the dialog to import data to the selected spreadsheet */ void MainWin::importFileDialog(){ - m_importFileDialog =3D new ImportFileDialog(this); - connect (m_importFileDialog, SIGNAL(newSpreadsheetRequested(QString)), - this, SLOT(newSpreadsheetForImportFileDialog(QString))); - std::auto_ptr model(new AspectTreeModel(m_project, th= is)); - m_importFileDialog->setModel( model ); - - //TODO add Matrix here in future. - if ( m_currentAspect->inherits("Spreadsheet") ) { - m_importFileDialog->setCurrentIndex( m_projectExplorer->currentIndex()); - } else if ( m_currentAspect->inherits("Column") ) { - if (m_currentAspect->parentAspect()->inherits("Spreadsheet")) - m_importFileDialog->setCurrentIndex( m_aspectTreeModel->modelIndexOfAsp= ect(m_currentAspect->parentAspect())); - } - - if ( m_importFileDialog->exec() =3D=3D QDialog::Accepted ) { - m_importFileDialog->importToSpreadsheet(statusBar()); - m_project->setChanged(true); - } - - delete m_importFileDialog; - m_importFileDialog =3D 0; + m_importFileDialog =3D new ImportFileDialog(this); + connect (m_importFileDialog, SIGNAL(newSpreadsheetRequested(QString)), + this, SLOT(newSpreadsheetForImportFileDialog(QString))); + std::auto_ptr model(new AspectTreeModel(m_project,= this)); + m_importFileDialog->setModel( model ); + + //TODO add Matrix here in future. + if ( m_currentAspect->inherits("Spreadsheet") ) { + m_importFileDialog->setCurrentIndex( m_projectExplorer->currentInd= ex()); + } else if ( m_currentAspect->inherits("Column") ) { + if (m_currentAspect->parentAspect()->inherits("Spreadsheet")) + m_importFileDialog->setCurrentIndex( m_aspectTreeModel->modelI= ndexOfAspect(m_currentAspect->parentAspect())); + } + + if ( m_importFileDialog->exec() =3D=3D QDialog::Accepted ) { + m_importFileDialog->importToSpreadsheet(statusBar()); + m_project->setChanged(true); + } + + delete m_importFileDialog; + m_importFileDialog =3D 0; } = /*! - opens the dialog for the export of the currently active worksheet/spreads= heet. + opens the dialog for the export of the currently active worksheet/spre= adsheet. */ void MainWin::exportDialog(){ - //determine first, whether we want to export a worksheet or a spreadsheet - Worksheet* w=3Dthis->activeWorksheet(); - if (w!=3D0){ //worksheet - ExportWorksheetDialog* dlg =3D new ExportWorksheetDialog(this); - dlg->setFileName(w->name()); - if (dlg->exec()=3D=3DQDialog::Accepted){ - QString path =3D dlg->path(); - WorksheetView::ExportFormat format =3D dlg->exportFormat(); - WorksheetView::ExportArea area =3D dlg->exportArea(); - bool background =3D dlg->exportBackground(); - int resolution =3D dlg->exportResolution(); - - WorksheetView* view =3D qobject_cast(w->view()); - WAIT_CURSOR; - view->exportToFile(path, format, area, background, resolution); - RESET_CURSOR; - } - }else{//Spreadsheet - Spreadsheet* s =3D this->activeSpreadsheet(); - if (!s) - return; - - ExportSpreadsheetDialog* dlg =3D new ExportSpreadsheetDialog(this); - dlg->setFileName(s->name()); - if (dlg->exec()=3D=3DQDialog::Accepted){ - QString path =3D dlg->path(); - const bool exportHeader =3D dlg->exportHeader(); - QString separator =3D dlg->separator(); - - SpreadsheetView* view =3D qobject_cast(s->view()); - WAIT_CURSOR; - view->exportToFile(path, exportHeader, separator); - RESET_CURSOR; - } - } + //determine first, whether we want to export a worksheet or a spreadsh= eet + Worksheet* w=3Dthis->activeWorksheet(); + if (w!=3D0){ //worksheet + ExportWorksheetDialog* dlg =3D new ExportWorksheetDialog(this); + dlg->setFileName(w->name()); + if (dlg->exec()=3D=3DQDialog::Accepted){ + QString path =3D dlg->path(); + WorksheetView::ExportFormat format =3D dlg->exportFormat(); + WorksheetView::ExportArea area =3D dlg->exportArea(); + bool background =3D dlg->exportBackground(); + int resolution =3D dlg->exportResolution(); + + WorksheetView* view =3D qobject_cast(w->view()= ); + WAIT_CURSOR; + view->exportToFile(path, format, area, background, resolution); + RESET_CURSOR; + } + }else{//Spreadsheet + Spreadsheet* s =3D this->activeSpreadsheet(); + if (!s) + return; + + ExportSpreadsheetDialog* dlg =3D new ExportSpreadsheetDialog(this); + dlg->setFileName(s->name()); + if (dlg->exec()=3D=3DQDialog::Accepted){ + QString path =3D dlg->path(); + const bool exportHeader =3D dlg->exportHeader(); + QString separator =3D dlg->separator(); + + SpreadsheetView* view =3D qobject_cast(s->vi= ew()); + WAIT_CURSOR; + view->exportToFile(path, exportHeader, separator); + RESET_CURSOR; + } + } } = /*! - adds a new file data source to the current project. + adds a new file data source to the current project. */ void MainWin::newFileDataSourceActionTriggered(){ ImportFileDialog* dlg =3D new ImportFileDialog(this); if ( dlg->exec() =3D=3D QDialog::Accepted ) { - FileDataSource* dataSource =3D new FileDataSource(0, i18n("File data s= ource%1", 1)); - dlg->importToFileDataSource(dataSource, statusBar()); - this->addAspectToProject(dataSource); - kDebug()<<"new file data source created"<importToFileDataSource(dataSource, statusBar()); + this->addAspectToProject(dataSource); + kDebug()<<"new file data source created"<currentIndex(); - if(!index.isValid()) - m_project->addChild(aspect); - else { - AbstractAspect * parent_aspect =3D static_cast(index.i= nternalPointer()); + QModelIndex index =3D m_projectExplorer->currentIndex(); + if(!index.isValid()) + m_project->addChild(aspect); + else { + AbstractAspect * parent_aspect =3D static_cast(i= ndex.internalPointer()); // every aspect contained in the project should have a folder Q_ASSERT(parent_aspect->folder()); - parent_aspect->folder()->addChild(aspect); - } + parent_aspect->folder()->addChild(aspect); + } } = void MainWin::settingsDialog(){ - SettingsDialog* dlg =3D new SettingsDialog(this); - connect (dlg, SIGNAL(settingsChanged()), this, SLOT(handleSettingsChanges= ())); - dlg->exec(); - delete dlg; + SettingsDialog* dlg =3D new SettingsDialog(this); + connect (dlg, SIGNAL(settingsChanged()), this, SLOT(handleSettingsChan= ges())); + dlg->exec(); + delete dlg; } diff --git a/src/kdefrontend/MainWin.h b/src/kdefrontend/MainWin.h index ca12d7d..1b250fe 100644 --- a/src/kdefrontend/MainWin.h +++ b/src/kdefrontend/MainWin.h @@ -83,51 +83,53 @@ private: Qt::WindowStates m_lastWindowState; //< last window state before switchin= g to full screen mode = KRecentFilesAction* m_recentProjectsAction; - KAction* m_saveAction; - KAction* m_saveAsAction; - KAction* m_printAction; - KAction* m_printPreviewAction; - KAction* m_importAction; - KAction* m_exportAction; - KAction* m_closeAction; - KAction* m_newFolderAction; - KAction* m_newSpreadsheetAction; - KAction* m_newMatrixAction; - KAction* m_newWorksheetAction; - KAction* m_newFileDataSourceAction; - KAction* m_newSqlDataSourceAction; - KAction* m_newScriptAction; - KAction* m_newProjectAction; - KAction* m_historyAction; - KAction* m_undoAction; - KAction* m_redoAction; - KAction* m_tileWindows; - KAction* m_cascadeWindows; + QAction* m_saveAction; + QAction* m_saveAsAction; + QAction* m_printAction; + QAction* m_printPreviewAction; + QAction* m_importAction; + QAction* m_exportAction; + QAction* m_closeAction; + QAction* m_newFolderAction; + QAction* m_newSpreadsheetAction; + QAction* m_newMatrixAction; + QAction* m_newWorksheetAction; + QAction* m_newFileDataSourceAction; + QAction* m_newSqlDataSourceAction; + QAction* m_newScriptAction; + QAction* m_newProjectAction; + QAction* m_historyAction; + QAction* m_undoAction; + QAction* m_redoAction; + QAction* m_tileWindows; + QAction* m_cascadeWindows; = //toggling doch widgets - KAction* m_toggleProjectExplorerDockAction; - KAction* m_togglePropertiesDockAction; + QAction* m_toggleProjectExplorerDocQAction; + QAction* m_togglePropertiesDocQAction; = //worksheet actions - KAction* worksheetZoomInAction; - KAction* worksheetZoomOutAction; - KAction* worksheetZoomOriginAction; - KAction* worksheetZoomFitPageHeightAction; - KAction* worksheetZoomFitPageWidthAction; - KAction* worksheetZoomFitSelectionAction; - - KAction* worksheetNavigationModeAction; - KAction* worksheetZoomModeAction; - KAction* worksheetSelectionModeAction; - - KAction* worksheetVerticalLayoutAction; - KAction* worksheetHorizontalLayoutAction; - KAction* worksheetGridLayoutAction; - KAction* worksheetBreakLayoutAction; - - KAction* m_visibilityFolderAction; - KAction* m_visibilitySubfolderAction; - KAction* m_visibilityAllAction; + QAction* worksheetZoomInAction; + QAction* worksheetZoomOutAction; + QAction* worksheetZoomOriginAction; + QAction* worksheetZoomFitPageHeightAction; + QAction* worksheetZoomFitPageWidthAction; + QAction* worksheetZoomFitSelectionAction; + + QAction* worksheetNavigationModeAction; + QAction* worksheetZoomModeAction; + QAction* worksheetSelectionModeAction; + + QAction* worksheetVerticalLayoutAction; + QAction* worksheetHorizontalLayoutAction; + QAction* worksheetGridLayoutAction; + QAction* worksheetBreakLayoutAction; + + QAction* m_visibilityFolderAction; + QAction* m_visibilitySubfolderAction; + QAction* m_visibilityAllAction; + QAction* m_toggleProjectExplorerDockAction; + QAction* m_togglePropertiesDockAction; = //Menus QMenu* m_visibilityMenu; @@ -173,7 +175,7 @@ private slots: bool newProject(); void openProject(); void openProject(const QString&); - void openRecentProject(const KUrl&); + void openRecentProject(const QUrl&); bool closeProject(); bool saveProject(); bool saveProjectAs(); diff --git a/src/kdefrontend/SettingsDialog.cpp b/src/kdefrontend/SettingsD= ialog.cpp index d309041..7b461ff 100644 --- a/src/kdefrontend/SettingsDialog.cpp +++ b/src/kdefrontend/SettingsDialog.cpp @@ -5,7 +5,7 @@ Copyright : (C) 2008-2013 by Alexander Semke Email (use @ for *) : alexander.semke*web.de Description : general settings dialog - = + *************************************************************************= **/ = /*************************************************************************= ** @@ -36,6 +36,8 @@ #include #include #include +#include +#include = /** * \brief Settings dialog for Labplot. @@ -50,64 +52,86 @@ SettingsDialog::SettingsDialog(QWidget* parent) : setMinimumSize(QSize(512, minSize.height())); = setFaceType(List); - setCaption(i18n("Preferences")); - setButtons(Ok | Apply | Cancel | Default); - setDefaultButton(Ok); - enableButton(Apply, false); + setWindowTitle(i18n("Preferences")); + QDialogButtonBox* dialogButtonBox =3D new QDialogButtonBox; + + QPushButton* okbutton =3D dialogButtonBox->addButton(QDialogButtonBox:= :Ok); + connect( okbutton, &QAbstractButton::clicked, this, &SettingsDialog::o= nOkButton ); + + applybutton =3D dialogButtonBox->addButton(QDialogButtonBox::Apply); + connect( applybutton, &QAbstractButton::clicked, this, &SettingsDialog= ::onApplyButton ); + + dialogButtonBox->addButton(QDialogButtonBox::Cancel); + + QPushButton* defaultbutton =3D dialogButtonBox->addButton(QDialogButto= nBox::RestoreDefaults); + connect( defaultbutton, &QAbstractButton::clicked, this, &SettingsDial= og::onRestoreDefaultsButton ); + + okbutton->setDefault(true); + applybutton->setEnabled(false); + + QVBoxLayout* layout =3D new QVBoxLayout; + layout->addWidget( dialogButtonBox ); + setLayout( layout ); = generalPage =3D new SettingsGeneralPage(this); KPageWidgetItem* generalFrame =3D addPage(generalPage, i18n("General")= ); - generalFrame->setIcon(KIcon("system-run")); - connect(generalPage, SIGNAL(settingsChanged()), this, SLOT(changed())); + generalFrame->setIcon(QIcon("system-run")); + connect(generalPage, SIGNAL(settingsChanged()), this, SLOT(changed())); = // printingPage =3D new SettingsPrintingPage(mainWindow, this); // KPageWidgetItem* printingFrame =3D addPage(printingPage, i18nc("@ti= tle:group", "Print")); // printingFrame->setIcon(KIcon("document-print")); = - const KConfigGroup dialogConfig =3D KGlobal::config()->group("SettingsDia= log"); - restoreDialogSize(dialogConfig); + const KConfigGroup dialogConfig =3D KSharedConfig::openConfig()->group= ("SettingsDialog"); + KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig); } = SettingsDialog::~SettingsDialog(){ - KConfigGroup dialogConfig =3D KGlobal::config()->group("SettingsDialog"); - saveDialogSize(dialogConfig); + KConfigGroup dialogConfig =3D KSharedConfig::openConfig()->group("Sett= ingsDialog"); + KWindowConfig::saveWindowSize(windowHandle(), dialogConfig); +} + +void SettingsDialog::onOkButton(){ + if (m_changed){ + applySettings(); + setWindowTitle(i18n("Preferences")); + applybutton->setEnabled(false); + } } = -void SettingsDialog::slotButtonClicked(int button){ - if ((button =3D=3D Ok) || (button =3D=3D Apply)) { - if (m_changed){ - applySettings(); - setCaption(i18n("Preferences")); - enableButton(Apply, false); - } - } else if (button =3D=3D Default) { - const QString text(i18n("All settings will be reset to default val= ues. Do you want to continue?")); - if (KMessageBox::questionYesNo(this, text) =3D=3D KMessageBox::Yes= ) { - restoreDefaults(); - setCaption(i18n("Preferences")); - enableButton(Apply, false); - } +void SettingsDialog::onApplyButton(){ + if (m_changed){ + applySettings(); + setWindowTitle(i18n("Preferences")); + applybutton->setEnabled(false); } +} = - KPageDialog::slotButtonClicked(button); +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) =3D=3D KMessageBox::Yes) { + restoreDefaults(); + setWindowTitle(i18n("Preferences")); + applybutton->setEnabled(false); + } } = void SettingsDialog::changed() { - m_changed =3D true; - setCaption(i18n("Preferences [Changed]")); - enableButton(Apply, true); + m_changed =3D true; + setWindowTitle(i18n("Preferences [Changed]")); + applybutton->setEnabled(true); } = void SettingsDialog::applySettings(){ - m_changed =3D false; + m_changed =3D false; generalPage->applySettings(); // printingPage->applySettings(); - KGlobal::config()->sync(); = - emit settingsChanged(); + KSharedConfig::openConfig()->sync(); + emit settingsChanged(); } = void SettingsDialog::restoreDefaults(){ - m_changed =3D false; + m_changed =3D false; generalPage->restoreDefaults(); -// printingPage->restoreDefaults(); +// printingPage->restoreDefaults(); } diff --git a/src/kdefrontend/SettingsDialog.h b/src/kdefrontend/SettingsDia= log.h index 8854d6c..bc8ab03 100644 --- a/src/kdefrontend/SettingsDialog.h +++ b/src/kdefrontend/SettingsDialog.h @@ -43,12 +43,16 @@ public: = private slots: void changed(); + void onOkButton(); + void onApplyButton(); + void onRestoreDefaultsButton(); = protected slots: virtual void slotButtonClicked(int button); = private: bool m_changed; + QPushButton* applybutton; SettingsGeneralPage* generalPage; // SettingsPrintingPage* printingPage; = diff --git a/src/kdefrontend/SettingsGeneralPage.cpp b/src/kdefrontend/Sett= ingsGeneralPage.cpp index 3049266..e3ce1ea 100644 --- a/src/kdefrontend/SettingsGeneralPage.cpp +++ b/src/kdefrontend/SettingsGeneralPage.cpp @@ -55,7 +55,7 @@ SettingsGeneralPage::SettingsGeneralPage(QWidget* parent)= : } = void SettingsGeneralPage::applySettings(){ - KConfigGroup group =3D KGlobal::config()->group( "General" ); + KConfigGroup group =3D KSharedConfig::openConfig()->group( "General" ); group.writeEntry("LoadOnStart", ui.cbLoadOnStart->currentIndex()); group.writeEntry("ViewMode", ui.cbInterface->currentIndex()); group.writeEntry("TabPosition", ui.cbTabPosition->currentIndex()); @@ -69,7 +69,7 @@ void SettingsGeneralPage::restoreDefaults(){ } = void SettingsGeneralPage::loadSettings(){ - const KConfigGroup group =3D KGlobal::config()->group( "General" ); + const KConfigGroup group =3D KSharedConfig::openConfig()->group( "Gene= ral" ); ui.cbLoadOnStart->setCurrentIndex(group.readEntry("LoadOnStart", 0)); ui.cbInterface->setCurrentIndex(group.readEntry("ViewMode", 0)); ui.cbTabPosition->setCurrentIndex(group.readEntry("TabPosition", 0)); diff --git a/src/kdefrontend/SettingsPage.h b/src/kdefrontend/SettingsPage.h index ae22cf4..bf7d60e 100644 --- a/src/kdefrontend/SettingsPage.h +++ b/src/kdefrontend/SettingsPage.h @@ -28,7 +28,7 @@ #ifndef SETTINGSPAGE_H #define SETTINGSPAGE_H = -#include +#include = class SettingsPage : public QWidget { Q_OBJECT diff --git a/src/kdefrontend/TemplateHandler.cpp b/src/kdefrontend/Template= Handler.cpp index bc4805c..1aae237 100644 --- a/src/kdefrontend/TemplateHandler.cpp +++ b/src/kdefrontend/TemplateHandler.cpp @@ -28,9 +28,9 @@ *************************************************************************= **/ = #include "TemplateHandler.h" -#include -#include -#include +#include +#include +#include #include #include #include @@ -40,7 +40,6 @@ #include #include #include - /*! \class TemplateHandler \brief Provides a widget with buttons for saving and loading of template= s. @@ -78,11 +77,11 @@ TemplateHandler::TemplateHandler(QWidget *parent, Class= Name name): QWidget(paren tbPaste->setEnabled(false); horizontalLayout->addWidget(tbPaste); = - tbLoad->setIcon(KIcon("document-open")); - tbSave->setIcon(KIcon("document-save")); - tbSaveDefault->setIcon(KIcon("document-save-as")); - tbCopy->setIcon(KIcon("edit-copy")); - tbPaste->setIcon(KIcon("edit-paste")); + tbLoad->setIcon(QIcon("document-open")); + tbSave->setIcon(QIcon("document-save")); + tbSaveDefault->setIcon(QIcon("document-save-as")); + tbCopy->setIcon(QIcon("edit-copy")); + tbPaste->setIcon(QIcon("edit-paste")); = connect( tbLoad, SIGNAL(clicked()), this, SLOT(loadMenu())); connect( tbSave, SIGNAL(clicked()), this, SLOT(saveMenu())); @@ -96,7 +95,7 @@ TemplateHandler::TemplateHandler(QWidget *parent, ClassNa= me name): QWidget(paren this->retranslateUi(); = //disable the load-button if no templates are available yet - QStringList list =3D KGlobal::dirs()->findAllResources("appdata", "templa= tes/" + dirNames.at(className) + "/*"); + QStringList list =3D QStandardPaths::locateAll(QStandardPaths::Applica= tionsLocation, "templates/" + dirNames.at(className) + "/*"); tbLoad->setEnabled(list.size()); } = @@ -115,7 +114,7 @@ void TemplateHandler::loadMenu() { KMenu menu; menu.addTitle(i18n("Load from")); = - QStringList list =3D KGlobal::dirs()->findAllResources("appdata", "templa= tes/" + dirNames.at(className) + "/*"); + QStringList list =3D QStandardPaths::locateAll(QStandardPaths::Applica= tionsLocation, "templates/" + dirNames.at(className) + "/*"); for (int i =3D 0; i < list.size(); ++i) { QFileInfo fileinfo(list.at(i)); QAction* action =3D menu.addAction(fileinfo.fileName()); @@ -138,7 +137,7 @@ void TemplateHandler::saveMenu() { KMenu menu; menu.addTitle(i18n("Save as")); = - QStringList list =3D KGlobal::dirs()->findAllResources("appdata", "templa= tes/"+ dirNames.at(className) + "/*"); + QStringList list =3D QStandardPaths::locateAll(QStandardPaths::Applica= tionsLocation, "templates/"+ dirNames.at(className) + "/*"); for (int i =3D 0; i < list.size(); ++i) { QFileInfo fileinfo(list.at(i)); QAction* action =3D menu.addAction(fileinfo.fileName()); @@ -175,7 +174,7 @@ void TemplateHandler::saveMenu() { * Emits \c saveConfigRequested, the receiver of the signal has to config.= sync(). */ void TemplateHandler::saveNewSelected(const QString& filename) { - KConfig config(KGlobal::dirs()->locateLocal("appdata", "templates") + '/'= + dirNames.at(className) + '/' + filename, KConfig::SimpleConfig); + KConfig config(QStandardPaths::locate(QStandardPaths::ApplicationsLoca= tion, "templates") + '/' + dirNames.at(className) + '/' + filename, KConfig= ::SimpleConfig); emit (saveConfigRequested(config)); = //we have at least one saved template now -> enable the load button diff --git a/src/kdefrontend/TemplateHandler.h b/src/kdefrontend/TemplateHa= ndler.h index 99256f5..71cbc96 100644 --- a/src/kdefrontend/TemplateHandler.h +++ b/src/kdefrontend/TemplateHandler.h @@ -30,7 +30,7 @@ #ifndef TEMPLATEHANDLER_H #define TEMPLATEHANDLER_H = -#include +#include class QHBoxLayout; class QToolButton; class QSpacerItem; diff --git a/src/kdefrontend/datasources/FileInfoDialog.cpp b/src/kdefronte= nd/datasources/FileInfoDialog.cpp index d7d5ed7..0199789 100644 --- a/src/kdefrontend/datasources/FileInfoDialog.cpp +++ b/src/kdefrontend/datasources/FileInfoDialog.cpp @@ -48,7 +48,7 @@ FileInfoDialog::FileInfoDialog(QWidget* parent) : KDialog= (parent) { textEditWidget.setLineWrapMode(QTextEdit::NoWrap); setMainWidget( &textEditWidget ); setButtons( KDialog::Ok); - setWindowIcon(KIcon("help-about")); + setWindowIcon(QIcon("help-about")); setCaption(i18n("File info")); resize( QSize(500,300) ); } diff --git a/src/kdefrontend/datasources/ImportFileDialog.cpp b/src/kdefron= tend/datasources/ImportFileDialog.cpp index 244ac9a..c7cf0e6 100644 --- a/src/kdefrontend/datasources/ImportFileDialog.cpp +++ b/src/kdefrontend/datasources/ImportFileDialog.cpp @@ -40,6 +40,8 @@ #include #include #include + #include +#include = /*! \class ImportFileDialog @@ -73,7 +75,7 @@ ImportFileDialog::ImportFileDialog(QWidget* parent) : KDi= alog(parent), cbPositio connect(this,SIGNAL(user1Clicked()), this, SLOT(toggleOptions())); = setCaption(i18n("Import Data to Spreadsheet/Matrix")); - setWindowIcon(KIcon("document-import-database")); + setWindowIcon(QIcon("document-import-database")); resize( QSize(500,0).expandedTo(minimumSize()) ); } = @@ -109,7 +111,7 @@ void ImportFileDialog::setModel(std::auto_ptr model){ cbAddTo->setSelectableClasses(list); = bNewSpreadsheet =3D new QPushButton(frameAddTo); - bNewSpreadsheet->setIcon(KIcon("insert-table")); + bNewSpreadsheet->setIcon(QIcon("insert-table")); bNewSpreadsheet->setToolTip(i18n("Add new spreadsheet")); hLayout->addWidget( bNewSpreadsheet); connect( bNewSpreadsheet, SIGNAL(clicked()), this, SLOT(newSpreadsheet())= ); @@ -250,7 +252,7 @@ void ImportFileDialog::newSpreadsheet(){ QInputDialog* dlg =3D new QInputDialog(this); = // this->setWindowIcon( QIcon(KIcon("insert-table")) ); - dlg->setWindowIcon( QIcon(KIcon("insert-table")) ); + dlg->setWindowIcon( QIcon(QIcon("insert-table")) ); name =3D dlg->getText(this, i18n("Add new Spreadsheet"), i18n("Spreadshee= t name:"), QLineEdit::Normal, name, &ok); // name =3D KInputDialog::getText( i18n("Add new Spreadsheet"), i18n("Spr= eadsheet name:"), name, &ok); if (ok) diff --git a/src/kdefrontend/datasources/ImportFileWidget.cpp b/src/kdefron= tend/datasources/ImportFileWidget.cpp index 8814aec..a03ab01 100644 --- a/src/kdefrontend/datasources/ImportFileWidget.cpp +++ b/src/kdefrontend/datasources/ImportFileWidget.cpp @@ -39,6 +39,8 @@ #include #include #include +#include + #include = /*! \class ImportFileWidget @@ -71,11 +73,11 @@ ImportFileWidget::ImportFileWidget(QWidget* parent) : Q= Widget(parent) { = ui.gbOptions->hide(); = - ui.bOpen->setIcon( KIcon("document-open") ); - ui.bFileInfo->setIcon( KIcon("help-about") ); - ui.bManageFilters->setIcon( KIcon("configure") ); - ui.bSaveFilter->setIcon( KIcon("document-save") ); - ui.bRefreshPreview->setIcon( KIcon("view-refresh") ); + ui.bOpen->setIcon( QIcon("document-open") ); + ui.bFileInfo->setIcon( QIcon("help-about") ); + ui.bManageFilters->setIcon( QIcon("configure") ); + ui.bSaveFilter->setIcon( QIcon("document-save") ); + ui.bRefreshPreview->setIcon( QIcon("view-refresh") ); = connect( ui.kleFileName, SIGNAL(textChanged(QString)), SLOT(fileNameCh= anged(QString)) ); connect( ui.bOpen, SIGNAL(clicked()), this, SLOT (selectFile()) ); @@ -88,7 +90,7 @@ ImportFileWidget::ImportFileWidget(QWidget* parent) : QWi= dget(parent) { connect( asciiOptionsWidget.chbHeader, SIGNAL(stateChanged(int)), SLOT= (headerChanged(int)) ); = //load last used settings - KConfigGroup conf(KSharedConfig::openConfig(),"Import"); + KConfigGroup conf(KSharedConfig::openConfig(),"Import"); = //general settings ui.kleFileName->setText(conf.readEntry("LastImportedFile", "")); @@ -219,7 +221,7 @@ AbstractFileFilter* ImportFileWidget::currentFileFilter= () const{ opens a file dialog and lets the user select the file data source. */ void ImportFileWidget::selectFile() { - KConfigGroup conf(KSharedConfig::openConfig(), "ImportFileWidget"); + KConfigGroup conf(KSharedConfig::openConfig(), "ImportFileWidget"); QString dir =3D conf.readEntry("LastDir", ""); QString path =3D QFileDialog::getOpenFileName(this, i18n("Select the F= ile Data Source"), dir); if (path.isEmpty()) diff --git a/src/kdefrontend/dockwidgets/AxisDock.cpp b/src/kdefrontend/doc= kwidgets/AxisDock.cpp index b2a5f19..0c93d86 100644 --- a/src/kdefrontend/dockwidgets/AxisDock.cpp +++ b/src/kdefrontend/dockwidgets/AxisDock.cpp @@ -40,6 +40,7 @@ #include #include #include +#include = #include = diff --git a/src/kdefrontend/dockwidgets/AxisDock.h b/src/kdefrontend/dockw= idgets/AxisDock.h index c791738..0433900 100644 --- a/src/kdefrontend/dockwidgets/AxisDock.h +++ b/src/kdefrontend/dockwidgets/AxisDock.h @@ -31,6 +31,7 @@ = #include "ui_axisdock.h" #include "backend/worksheet/plots/cartesian/Axis.h" +#include = class AbstractAspect; class LabelWidget; diff --git a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp b/src/kdefro= ntend/dockwidgets/CartesianPlotDock.cpp index 7f25157..e18abcb 100644 --- a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp +++ b/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp @@ -39,6 +39,7 @@ #include #include #include +#include = #include = @@ -50,464 +51,464 @@ */ = CartesianPlotDock::CartesianPlotDock(QWidget *parent): QWidget(parent), - m_initializing(false){ - - ui.setupUi(this); - - //"Coordinate system"-tab - ui.bAddXBreak->setIcon( KIcon("list-add") ); - ui.bRemoveXBreak->setIcon( KIcon("list-remove") ); - ui.cbXBreak->addItem("1"); - - ui.bAddYBreak->setIcon( KIcon("list-add") ); - ui.bRemoveYBreak->setIcon( KIcon("list-remove") ); - ui.cbYBreak->addItem("1"); - - //"Background"-tab - ui.kleBackgroundFileName->setClearButtonShown(true); - ui.bOpen->setIcon( KIcon("document-open") ); - - KUrlCompletion *comp =3D new KUrlCompletion(); - ui.kleBackgroundFileName->setCompletionObject(comp); - - //"Title"-tab - QHBoxLayout* hboxLayout =3D new QHBoxLayout(ui.tabTitle); - labelWidget=3Dnew LabelWidget(ui.tabTitle); - hboxLayout->addWidget(labelWidget); - hboxLayout->setContentsMargins(2,2,2,2); - hboxLayout->setSpacing(2); - - //adjust layouts in the tabs - for (int i=3D0; icount(); ++i){ - QGridLayout* layout =3D dynamic_cast(ui.tabWidget->widget(= i)->layout()); - if (!layout) - continue; - - layout->setContentsMargins(2,2,2,2); - layout->setHorizontalSpacing(2); - layout->setVerticalSpacing(2); - } - - //Validators - ui.leXBreakStart->setValidator( new QDoubleValidator(ui.leXBreakStart) ); - ui.leXBreakEnd->setValidator( new QDoubleValidator(ui.leXBreakEnd) ); - ui.leYBreakStart->setValidator( new QDoubleValidator(ui.leYBreakStart) ); - ui.leYBreakEnd->setValidator( new QDoubleValidator(ui.leYBreakEnd) ); - - //SIGNAL/SLOT - //General - connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) ); - connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged= ()) ); - connect( ui.chkVisible, SIGNAL(stateChanged(int)), this, SLOT(visibilityC= hanged(int)) ); - connect( ui.sbLeft, SIGNAL(valueChanged(double)), this, SLOT(geometryChan= ged()) ); - connect( ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryChang= ed()) ); - connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometryCha= nged()) ); - connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometryCh= anged()) ); - - connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, SLOT(autoScal= eXChanged(int)) ); - connect( ui.kleXMin, SIGNAL(returnPressed()), this, SLOT(xMinChanged()) ); - connect( ui.kleXMax, SIGNAL(returnPressed()), this, SLOT(xMaxChanged()) ); - connect( ui.cbXScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(xSca= leChanged(int)) ); - - connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, SLOT(autoScal= eYChanged(int)) ); - connect( ui.kleYMin, SIGNAL(returnPressed()), this, SLOT(yMinChanged()) ); - connect( ui.kleYMax, SIGNAL(returnPressed()), this, SLOT(yMaxChanged()) ); - connect( ui.cbYScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(ySca= leChanged(int)) ); - - //Scale breakings - connect( ui.chkXBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleXBreak= (int)) ); - connect( ui.bAddXBreak, SIGNAL(clicked()), this, SLOT(addXBreak()) ); - connect( ui.bRemoveXBreak, SIGNAL(clicked()), this, SLOT(removeXBreak()) = ); - connect( ui.cbXBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(curren= tXBreakChanged(int)) ); - connect( ui.leXBreakStart, SIGNAL(returnPressed()), this, SLOT(xBreakStar= tChanged()) ); - connect( ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEndCha= nged()) ); - connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(xBrea= kPositionChanged(int)) ); - - connect( ui.chkYBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleYBreak= (int)) ); - connect( ui.bAddYBreak, SIGNAL(clicked()), this, SLOT(addYBreak()) ); - connect( ui.bRemoveYBreak, SIGNAL(clicked()), this, SLOT(removeYBreak()) = ); - connect( ui.cbYBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(curren= tYBreakChanged(int)) ); - connect( ui.leYBreakStart, SIGNAL(returnPressed()), this, SLOT(yBreakStar= tChanged()) ); - connect( ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEndCha= nged()) ); - connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(yBrea= kPositionChanged(int)) ); - - //Background - connect( ui.cbBackgroundType, SIGNAL(currentIndexChanged(int)), this, SLO= T(backgroundTypeChanged(int)) ); - connect( ui.cbBackgroundColorStyle, SIGNAL(currentIndexChanged(int)), thi= s, SLOT(backgroundColorStyleChanged(int)) ); - connect( ui.cbBackgroundImageStyle, SIGNAL(currentIndexChanged(int)), thi= s, SLOT(backgroundImageStyleChanged(int)) ); - connect( ui.cbBackgroundBrushStyle, SIGNAL(currentIndexChanged(int)), thi= s, SLOT(backgroundBrushStyleChanged(int)) ); - connect(ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile())); - connect( ui.kleBackgroundFileName, SIGNAL(returnPressed()), this, SLOT(fi= leNameChanged()) ); - connect( ui.kleBackgroundFileName, SIGNAL(clearButtonClicked()), this, SL= OT(fileNameChanged()) ); - connect( ui.kcbBackgroundFirstColor, SIGNAL(changed(QColor)), this, SLOT(= backgroundFirstColorChanged(QColor)) ); - connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, SLOT= (backgroundSecondColorChanged(QColor)) ); - connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, SLOT(ba= ckgroundOpacityChanged(int)) ); - - //Border - connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(b= orderStyleChanged(int)) ); - connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, SLOT(borderCol= orChanged(QColor)) ); - connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(borde= rWidthChanged(double)) ); - connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, SLO= T(borderCornerRadiusChanged(double)) ); - connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, SLOT(border= OpacityChanged(int)) ); - - //Padding - connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, SLOT= (horizontalPaddingChanged(double)) ); - connect( ui.sbPaddingVertical, SIGNAL(valueChanged(double)), this, SLOT(v= erticalPaddingChanged(double)) ); - - TemplateHandler* templateHandler =3D new TemplateHandler(this, TemplateHa= ndler::CartesianPlot); - ui.verticalLayout->addWidget(templateHandler); - templateHandler->show(); - connect(templateHandler, SIGNAL(loadConfigRequested(KConfig&)), this, SLO= T(loadConfigFromTemplate(KConfig&))); - connect(templateHandler, SIGNAL(saveConfigRequested(KConfig&)), this, SLO= T(saveConfig(KConfig&))); - connect(templateHandler, SIGNAL(info(QString)), this, SIGNAL(info(QString= ))); - - init(); - - //TODO: activate the tab again once the functionality is implemented - ui.tabWidget->removeTab(2); + m_initializing(false){ + + ui.setupUi(this); + + //"Coordinate system"-tab + ui.bAddXBreak->setIcon( QIcon("list-add") ); + ui.bRemoveXBreak->setIcon( QIcon("list-remove") ); + ui.cbXBreak->addItem("1"); + + ui.bAddYBreak->setIcon( QIcon("list-add") ); + ui.bRemoveYBreak->setIcon( QIcon("list-remove") ); + ui.cbYBreak->addItem("1"); + + //"Background"-tab + ui.kleBackgroundFileName->setClearButtonShown(true); + ui.bOpen->setIcon( QIcon("document-open") ); + + KUrlCompletion *comp =3D new KUrlCompletion(); + ui.kleBackgroundFileName->setCompletionObject(comp); + + //"Title"-tab + QHBoxLayout* hboxLayout =3D new QHBoxLayout(ui.tabTitle); + labelWidget=3Dnew LabelWidget(ui.tabTitle); + hboxLayout->addWidget(labelWidget); + hboxLayout->setContentsMargins(2,2,2,2); + hboxLayout->setSpacing(2); + + //adjust layouts in the tabs + for (int i=3D0; icount(); ++i){ + QGridLayout* layout =3D dynamic_cast(ui.tabWidget->w= idget(i)->layout()); + if (!layout) + continue; + + layout->setContentsMargins(2,2,2,2); + layout->setHorizontalSpacing(2); + layout->setVerticalSpacing(2); + } + + //Validators + ui.leXBreakStart->setValidator( new QDoubleValidator(ui.leXBreakStart)= ); + ui.leXBreakEnd->setValidator( new QDoubleValidator(ui.leXBreakEnd) ); + ui.leYBreakStart->setValidator( new QDoubleValidator(ui.leYBreakStart)= ); + ui.leYBreakEnd->setValidator( new QDoubleValidator(ui.leYBreakEnd) ); + + //SIGNAL/SLOT + //General + connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged())= ); + connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChan= ged()) ); + connect( ui.chkVisible, SIGNAL(stateChanged(int)), this, SLOT(visibili= tyChanged(int)) ); + connect( ui.sbLeft, SIGNAL(valueChanged(double)), this, SLOT(geometryC= hanged()) ); + connect( ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryCh= anged()) ); + connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometry= Changed()) ); + connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometr= yChanged()) ); + + connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, SLOT(autoS= caleXChanged(int)) ); + connect( ui.kleXMin, SIGNAL(returnPressed()), this, SLOT(xMinChanged()= ) ); + connect( ui.kleXMax, SIGNAL(returnPressed()), this, SLOT(xMaxChanged()= ) ); + connect( ui.cbXScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(x= ScaleChanged(int)) ); + + connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, SLOT(autoS= caleYChanged(int)) ); + connect( ui.kleYMin, SIGNAL(returnPressed()), this, SLOT(yMinChanged()= ) ); + connect( ui.kleYMax, SIGNAL(returnPressed()), this, SLOT(yMaxChanged()= ) ); + connect( ui.cbYScaling, SIGNAL(currentIndexChanged(int)), this, SLOT(y= ScaleChanged(int)) ); + + //Scale breakings + connect( ui.chkXBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleXBr= eak(int)) ); + connect( ui.bAddXBreak, SIGNAL(clicked()), this, SLOT(addXBreak()) ); + connect( ui.bRemoveXBreak, SIGNAL(clicked()), this, SLOT(removeXBreak(= )) ); + connect( ui.cbXBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(cur= rentXBreakChanged(int)) ); + connect( ui.leXBreakStart, SIGNAL(returnPressed()), this, SLOT(xBreakS= tartChanged()) ); + connect( ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEnd= Changed()) ); + connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(xB= reakPositionChanged(int)) ); + + connect( ui.chkYBreak, SIGNAL(stateChanged(int)), this, SLOT(toggleYBr= eak(int)) ); + connect( ui.bAddYBreak, SIGNAL(clicked()), this, SLOT(addYBreak()) ); + connect( ui.bRemoveYBreak, SIGNAL(clicked()), this, SLOT(removeYBreak(= )) ); + connect( ui.cbYBreak, SIGNAL(currentIndexChanged(int)), this, SLOT(cur= rentYBreakChanged(int)) ); + connect( ui.leYBreakStart, SIGNAL(returnPressed()), this, SLOT(yBreakS= tartChanged()) ); + connect( ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEnd= Changed()) ); + connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, SLOT(yB= reakPositionChanged(int)) ); + + //Background + connect( ui.cbBackgroundType, SIGNAL(currentIndexChanged(int)), this, = SLOT(backgroundTypeChanged(int)) ); + connect( ui.cbBackgroundColorStyle, SIGNAL(currentIndexChanged(int)), = this, SLOT(backgroundColorStyleChanged(int)) ); + connect( ui.cbBackgroundImageStyle, SIGNAL(currentIndexChanged(int)), = this, SLOT(backgroundImageStyleChanged(int)) ); + connect( ui.cbBackgroundBrushStyle, SIGNAL(currentIndexChanged(int)), = this, SLOT(backgroundBrushStyleChanged(int)) ); + connect(ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile())); + connect( ui.kleBackgroundFileName, SIGNAL(returnPressed()), this, SLOT= (fileNameChanged()) ); + connect( ui.kleBackgroundFileName, SIGNAL(clearButtonClicked()), this,= SLOT(fileNameChanged()) ); + connect( ui.kcbBackgroundFirstColor, SIGNAL(changed(QColor)), this, SL= OT(backgroundFirstColorChanged(QColor)) ); + connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, S= LOT(backgroundSecondColorChanged(QColor)) ); + connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, SLOT= (backgroundOpacityChanged(int)) ); + + //Border + connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLO= T(borderStyleChanged(int)) ); + connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, SLOT(border= ColorChanged(QColor)) ); + connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(bo= rderWidthChanged(double)) ); + connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, = SLOT(borderCornerRadiusChanged(double)) ); + connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, SLOT(bor= derOpacityChanged(int)) ); + + //Padding + connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, S= LOT(horizontalPaddingChanged(double)) ); + connect( ui.sbPaddingVertical, SIGNAL(valueChanged(double)), this, SLO= T(verticalPaddingChanged(double)) ); + + TemplateHandler* templateHandler =3D new TemplateHandler(this, Templat= eHandler::CartesianPlot); + ui.verticalLayout->addWidget(templateHandler); + templateHandler->show(); + connect(templateHandler, SIGNAL(loadConfigRequested(KConfig&)), this, = SLOT(loadConfigFromTemplate(KConfig&))); + connect(templateHandler, SIGNAL(saveConfigRequested(KConfig&)), this, = SLOT(saveConfig(KConfig&))); + connect(templateHandler, SIGNAL(info(QString)), this, SIGNAL(info(QStr= ing))); + + init(); + + //TODO: activate the tab again once the functionality is implemented + ui.tabWidget->removeTab(2); } = void CartesianPlotDock::init(){ - this->retranslateUi(); - - //create icons for the different styles for scale breaking - QPainter pa; - pa.setPen( QPen(Qt::SolidPattern, 0) ); - QPixmap pm(20, 20); - ui.cbXBreakStyle->setIconSize( QSize(20,20) ); - ui.cbYBreakStyle->setIconSize( QSize(20,20) ); - - //simple - pm.fill(Qt::transparent); - pa.begin( &pm ); - pa.setRenderHint(QPainter::Antialiasing); - pa.setBrush(Qt::SolidPattern); - pa.drawLine(3,10,8,10); - pa.drawLine(12,10,17,10); - pa.end(); - ui.cbXBreakStyle->setItemIcon(0, pm); - ui.cbYBreakStyle->setItemIcon(0, pm); - - //vertical - pm.fill(Qt::transparent); - pa.begin( &pm ); - pa.setRenderHint(QPainter::Antialiasing); - pa.setBrush(Qt::SolidPattern); - pa.drawLine(3,10,8,10); - pa.drawLine(12,10,17,10); - pa.drawLine(8,14,8,6); - pa.drawLine(12,14,12,6); - pa.end(); - ui.cbXBreakStyle->setItemIcon(1, pm); - ui.cbYBreakStyle->setItemIcon(1, pm); - - //sloped - pm.fill(Qt::transparent); - pa.begin( &pm ); - pa.setRenderHint(QPainter::Antialiasing); - pa.setBrush(Qt::SolidPattern); - pa.drawLine(3,10,8,10); - pa.drawLine(12,10,17,10); - pa.drawLine(6,14,10,6); - pa.drawLine(10,14,14,6); - pa.end(); - ui.cbXBreakStyle->setItemIcon(2, pm); - ui.cbYBreakStyle->setItemIcon(2, pm); + this->retranslateUi(); + + //create icons for the different styles for scale breaking + QPainter pa; + pa.setPen( QPen(Qt::SolidPattern, 0) ); + QPixmap pm(20, 20); + ui.cbXBreakStyle->setIconSize( QSize(20,20) ); + ui.cbYBreakStyle->setIconSize( QSize(20,20) ); + + //simple + pm.fill(Qt::transparent); + pa.begin( &pm ); + pa.setRenderHint(QPainter::Antialiasing); + pa.setBrush(Qt::SolidPattern); + pa.drawLine(3,10,8,10); + pa.drawLine(12,10,17,10); + pa.end(); + ui.cbXBreakStyle->setItemIcon(0, pm); + ui.cbYBreakStyle->setItemIcon(0, pm); + + //vertical + pm.fill(Qt::transparent); + pa.begin( &pm ); + pa.setRenderHint(QPainter::Antialiasing); + pa.setBrush(Qt::SolidPattern); + pa.drawLine(3,10,8,10); + pa.drawLine(12,10,17,10); + pa.drawLine(8,14,8,6); + pa.drawLine(12,14,12,6); + pa.end(); + ui.cbXBreakStyle->setItemIcon(1, pm); + ui.cbYBreakStyle->setItemIcon(1, pm); + + //sloped + pm.fill(Qt::transparent); + pa.begin( &pm ); + pa.setRenderHint(QPainter::Antialiasing); + pa.setBrush(Qt::SolidPattern); + pa.drawLine(3,10,8,10); + pa.drawLine(12,10,17,10); + pa.drawLine(6,14,10,6); + pa.drawLine(10,14,14,6); + pa.end(); + ui.cbXBreakStyle->setItemIcon(2, pm); + ui.cbYBreakStyle->setItemIcon(2, pm); } = void CartesianPlotDock::setPlots(QList list){ - m_initializing =3D true; - m_plotList =3D list; - - m_plot=3Dlist.first(); - - QList labels; - foreach(CartesianPlot* plot, list) - labels.append(plot->title()); - - labelWidget->setLabels(labels); - - //if there is more then one curve in the list, disable the tab "general" - if (list.size()=3D=3D1){ - ui.lName->setEnabled(true); - ui.leName->setEnabled(true); - ui.lComment->setEnabled(true); - ui.leComment->setEnabled(true); - - ui.leName->setText(m_plot->name()); - ui.leComment->setText(m_plot->comment()); - }else{ - ui.lName->setEnabled(false); - ui.leName->setEnabled(false); - ui.lComment->setEnabled(false); - ui.leComment->setEnabled(false); - - ui.leName->setText(""); - ui.leComment->setText(""); - } - - //show the properties of the first curve - this->load(); - - //update active widgets - backgroundTypeChanged(ui.cbBackgroundType->currentIndex()); - - //Deactivate the geometry related widgets, if the worksheet layout is act= ive. - //Currently, a plot can only be a child of the worksheet itself, so we on= ly need to ask the parent aspect (=3Dworksheet). - //TODO redesign this, if the hierarchy will be changend in future (a plot= is a child of a new object group/container or so) - Worksheet* w =3D dynamic_cast(m_plot->parentAspect()); - if (w){ - bool b =3D (w->layout()=3D=3DWorksheet::NoLayout); - ui.sbTop->setEnabled(b); - ui.sbLeft->setEnabled(b); - ui.sbWidth->setEnabled(b); - ui.sbHeight->setEnabled(b); - connect(w, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(layoutCh= anged(Worksheet::Layout))); - } - - //SIGNALs/SLOTs - connect( m_plot, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)),= this, SLOT(plotDescriptionChanged(const AbstractAspect*)) ); - connect( m_plot, SIGNAL(rectChanged(QRectF&)), this, SLOT(plotRectChanged= (QRectF&)) ); - connect( m_plot, SIGNAL(xMinChanged(float)), this, SLOT(plotXMinChanged(f= loat)) ); - connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChanged(f= loat)) ); - connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChanged= (int)) ); - connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChanged(f= loat)) ); - connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChanged(f= loat)) ); - connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChanged= (int)) ); - connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBreaki= ngs)), this, SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreakings))= ); - connect( m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBreaki= ngs)), this, SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreakings))= ); - connect( m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleChan= ged(bool)) ); - - // Plot Area - connect( m_plot->plotArea(), SIGNAL(backgroundTypeChanged(PlotArea::Backg= roundType)), this, SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundType)= ) ); - connect( m_plot->plotArea(), SIGNAL(backgroundColorStyleChanged(PlotArea:= :BackgroundColorStyle)), this, SLOT(plotBackgroundColorStyleChanged(PlotAre= a::BackgroundColorStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundImageStyleChanged(PlotArea:= :BackgroundImageStyle)), this, SLOT(plotBackgroundImageStyleChanged(PlotAre= a::BackgroundImageStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::Brush= Style)), this, SLOT(plotBackgroundBrushStyleChanged(Qt::BrushStyle)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundFirstColorChanged(QColor&))= , this, SLOT(plotBackgroundFirstColorChanged(QColor&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundSecondColorChanged(QColor&)= ), this, SLOT(plotBackgroundSecondColorChanged(QColor&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundFileNameChanged(QString&)),= this, SLOT(plotBackgroundFileNameChanged(QString&)) ); - connect( m_plot->plotArea(), SIGNAL(backgroundOpacityChanged(float)), thi= s, SLOT(plotBackgroundOpacityChanged(float)) ); - connect( m_plot->plotArea(), SIGNAL(borderPenChanged(QPen&)), this, SLOT(= plotBorderPenChanged(QPen&)) ); - connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this, S= LOT(plotBorderOpacityChanged(float)) ); - connect( m_plot, SIGNAL(horizontalPaddingChanged(float)), this, SLOT(plot= HorizontalPaddingChanged(float)) ); - connect( m_plot, SIGNAL(verticalPaddingChanged(float)), this, SLOT(plotVe= rticalPaddingChanged(float)) ); - - m_initializing =3D false; + m_initializing =3D true; + m_plotList =3D list; + + m_plot=3Dlist.first(); + + QList labels; + foreach(CartesianPlot* plot, list) + labels.append(plot->title()); + + labelWidget->setLabels(labels); + + //if there is more then one curve in the list, disable the tab "genera= l" + if (list.size()=3D=3D1){ + ui.lName->setEnabled(true); + ui.leName->setEnabled(true); + ui.lComment->setEnabled(true); + ui.leComment->setEnabled(true); + + ui.leName->setText(m_plot->name()); + ui.leComment->setText(m_plot->comment()); + }else{ + ui.lName->setEnabled(false); + ui.leName->setEnabled(false); + ui.lComment->setEnabled(false); + ui.leComment->setEnabled(false); + + ui.leName->setText(""); + ui.leComment->setText(""); + } + + //show the properties of the first curve + this->load(); + + //update active widgets + backgroundTypeChanged(ui.cbBackgroundType->currentIndex()); + + //Deactivate the geometry related widgets, if the worksheet layout is = active. + //Currently, a plot can only be a child of the worksheet itself, so we= only need to ask the parent aspect (=3Dworksheet). + //TODO redesign this, if the hierarchy will be changend in future (a p= lot is a child of a new object group/container or so) + Worksheet* w =3D dynamic_cast(m_plot->parentAspect()); + if (w){ + bool b =3D (w->layout()=3D=3DWorksheet::NoLayout); + ui.sbTop->setEnabled(b); + ui.sbLeft->setEnabled(b); + ui.sbWidth->setEnabled(b); + ui.sbHeight->setEnabled(b); + connect(w, SIGNAL(layoutChanged(Worksheet::Layout)), this, SLOT(la= youtChanged(Worksheet::Layout))); + } + + //SIGNALs/SLOTs + connect( m_plot, SIGNAL(aspectDescriptionChanged(const AbstractAspect*= )), this, SLOT(plotDescriptionChanged(const AbstractAspect*)) ); + connect( m_plot, SIGNAL(rectChanged(QRectF&)), this, SLOT(plotRectChan= ged(QRectF&)) ); + connect( m_plot, SIGNAL(xMinChanged(float)), this, SLOT(plotXMinChange= d(float)) ); + connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChange= d(float)) ); + connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChan= ged(int)) ); + connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChange= d(float)) ); + connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChange= d(float)) ); + connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChan= ged(int)) ); + connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBre= akings)), this, SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreaking= s)) ); + connect( m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBre= akings)), this, SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreaking= s)) ); + connect( m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleC= hanged(bool)) ); + + // Plot Area + connect( m_plot->plotArea(), SIGNAL(backgroundTypeChanged(PlotArea::Ba= ckgroundType)), this, SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundTy= pe)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundColorStyleChanged(PlotAr= ea::BackgroundColorStyle)), this, SLOT(plotBackgroundColorStyleChanged(Plot= Area::BackgroundColorStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundImageStyleChanged(PlotAr= ea::BackgroundImageStyle)), this, SLOT(plotBackgroundImageStyleChanged(Plot= Area::BackgroundImageStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::Br= ushStyle)), this, SLOT(plotBackgroundBrushStyleChanged(Qt::BrushStyle)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundFirstColorChanged(QColor= &)), this, SLOT(plotBackgroundFirstColorChanged(QColor&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundSecondColorChanged(QColo= r&)), this, SLOT(plotBackgroundSecondColorChanged(QColor&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundFileNameChanged(QString&= )), this, SLOT(plotBackgroundFileNameChanged(QString&)) ); + connect( m_plot->plotArea(), SIGNAL(backgroundOpacityChanged(float)), = this, SLOT(plotBackgroundOpacityChanged(float)) ); + connect( m_plot->plotArea(), SIGNAL(borderPenChanged(QPen&)), this, SL= OT(plotBorderPenChanged(QPen&)) ); + connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this= , SLOT(plotBorderOpacityChanged(float)) ); + connect( m_plot, SIGNAL(horizontalPaddingChanged(float)), this, SLOT(p= lotHorizontalPaddingChanged(float)) ); + connect( m_plot, SIGNAL(verticalPaddingChanged(float)), this, SLOT(plo= tVerticalPaddingChanged(float)) ); + + m_initializing =3D false; } = void CartesianPlotDock::activateTitleTab(){ - ui.tabWidget->setCurrentWidget(ui.tabTitle); + ui.tabWidget->setCurrentWidget(ui.tabTitle); } = //************************************************************ //**** SLOTs for changes triggered in CartesianPlotDock ****** //************************************************************ void CartesianPlotDock::retranslateUi(){ - m_initializing =3D true; + m_initializing =3D true; = - //general - ui.cbXScaling->addItem( i18n("linear") ); - ui.cbXScaling->addItem( i18n("log(x)") ); - ui.cbXScaling->addItem( i18n("log2(x)") ); - ui.cbXScaling->addItem( i18n("ln(x)") ); + //general + ui.cbXScaling->addItem( i18n("linear") ); + ui.cbXScaling->addItem( i18n("log(x)") ); + ui.cbXScaling->addItem( i18n("log2(x)") ); + ui.cbXScaling->addItem( i18n("ln(x)") ); = - ui.cbYScaling->addItem( i18n("linear") ); - ui.cbYScaling->addItem( i18n("log(y)") ); - ui.cbYScaling->addItem( i18n("log2(y)") ); - ui.cbYScaling->addItem( i18n("ln(y)") ); + ui.cbYScaling->addItem( i18n("linear") ); + ui.cbYScaling->addItem( i18n("log(y)") ); + ui.cbYScaling->addItem( i18n("log2(y)") ); + ui.cbYScaling->addItem( i18n("ln(y)") ); = - //scale breakings - ui.cbXBreakStyle->addItem( i18n("simple") ); - ui.cbXBreakStyle->addItem( i18n("vertical") ); - ui.cbXBreakStyle->addItem( i18n("sloped") ); + //scale breakings + ui.cbXBreakStyle->addItem( i18n("simple") ); + ui.cbXBreakStyle->addItem( i18n("vertical") ); + ui.cbXBreakStyle->addItem( i18n("sloped") ); = - ui.cbYBreakStyle->addItem( i18n("simple") ); - ui.cbYBreakStyle->addItem( i18n("vertical") ); - ui.cbYBreakStyle->addItem( i18n("sloped") ); + ui.cbYBreakStyle->addItem( i18n("simple") ); + ui.cbYBreakStyle->addItem( i18n("vertical") ); + ui.cbYBreakStyle->addItem( i18n("sloped") ); = - //plot area - ui.cbBackgroundType->addItem(i18n("color")); - ui.cbBackgroundType->addItem(i18n("image")); - ui.cbBackgroundType->addItem(i18n("pattern")); + //plot area + ui.cbBackgroundType->addItem(i18n("color")); + ui.cbBackgroundType->addItem(i18n("image")); + ui.cbBackgroundType->addItem(i18n("pattern")); = - ui.cbBackgroundColorStyle->addItem(i18n("single color")); - ui.cbBackgroundColorStyle->addItem(i18n("horizontal linear gradient")); - ui.cbBackgroundColorStyle->addItem(i18n("vertical linear gradient")); - ui.cbBackgroundColorStyle->addItem(i18n("diagonal linear gradient (start = from top left)")); - ui.cbBackgroundColorStyle->addItem(i18n("diagonal linear gradient (start = from bottom left)")); - ui.cbBackgroundColorStyle->addItem(i18n("radial gradient")); + ui.cbBackgroundColorStyle->addItem(i18n("single color")); + ui.cbBackgroundColorStyle->addItem(i18n("horizontal linear gradient")); + ui.cbBackgroundColorStyle->addItem(i18n("vertical linear gradient")); + ui.cbBackgroundColorStyle->addItem(i18n("diagonal linear gradient (sta= rt from top left)")); + ui.cbBackgroundColorStyle->addItem(i18n("diagonal linear gradient (sta= rt from bottom left)")); + ui.cbBackgroundColorStyle->addItem(i18n("radial gradient")); = - ui.cbBackgroundImageStyle->addItem(i18n("scaled and cropped")); - ui.cbBackgroundImageStyle->addItem(i18n("scaled")); - ui.cbBackgroundImageStyle->addItem(i18n("scaled, keep proportions")); - ui.cbBackgroundImageStyle->addItem(i18n("centered")); - ui.cbBackgroundImageStyle->addItem(i18n("tiled")); - ui.cbBackgroundImageStyle->addItem(i18n("center tiled")); + ui.cbBackgroundImageStyle->addItem(i18n("scaled and cropped")); + ui.cbBackgroundImageStyle->addItem(i18n("scaled")); + ui.cbBackgroundImageStyle->addItem(i18n("scaled, keep proportions")); + ui.cbBackgroundImageStyle->addItem(i18n("centered")); + ui.cbBackgroundImageStyle->addItem(i18n("tiled")); + ui.cbBackgroundImageStyle->addItem(i18n("center tiled")); = - GuiTools::updatePenStyles(ui.cbBorderStyle, Qt::black); - GuiTools::updateBrushStyles(ui.cbBackgroundBrushStyle, Qt::SolidPattern); + GuiTools::updatePenStyles(ui.cbBorderStyle, Qt::black); + GuiTools::updateBrushStyles(ui.cbBackgroundBrushStyle, Qt::SolidPatter= n); = - m_initializing =3D false; + m_initializing =3D false; } = // "General"-tab void CartesianPlotDock::nameChanged(){ if (m_initializing) - return; + return; = m_plot->setName(ui.leName->text()); } = void CartesianPlotDock::commentChanged(){ if (m_initializing) - return; + return; = m_plot->setComment(ui.leComment->text()); } = void CartesianPlotDock::visibilityChanged(int state){ if (m_initializing) - return; + return; = bool b =3D (state=3D=3DQt::Checked); foreach(CartesianPlot* plot, m_plotList){ - plot->setVisible(b); + plot->setVisible(b); } } = void CartesianPlotDock::geometryChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - float x =3D Worksheet::convertToSceneUnits(ui.sbLeft->value(), Worksheet:= :Centimeter); - float y =3D Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::= Centimeter); - float w =3D Worksheet::convertToSceneUnits(ui.sbWidth->value(), Worksheet= ::Centimeter); - float h =3D Worksheet::convertToSceneUnits(ui.sbHeight->value(), Workshee= t::Centimeter); + float x =3D Worksheet::convertToSceneUnits(ui.sbLeft->value(), Workshe= et::Centimeter); + float y =3D Worksheet::convertToSceneUnits(ui.sbTop->value(), Workshee= t::Centimeter); + float w =3D Worksheet::convertToSceneUnits(ui.sbWidth->value(), Worksh= eet::Centimeter); + float h =3D Worksheet::convertToSceneUnits(ui.sbHeight->value(), Works= heet::Centimeter); = - QRectF rect(x,y,w,h); - m_plot->setRect(rect); + QRectF rect(x,y,w,h); + m_plot->setRect(rect); } = /*! - Called when the layout in the worksheet gets changed. - Enables/disables the geometry widgets if the layout was deactivated/activ= ated. - Shows the new geometry values of the first plot if the layout was activat= ed. + Called when the layout in the worksheet gets changed. + Enables/disables the geometry widgets if the layout was deactivated/ac= tivated. + Shows the new geometry values of the first plot if the layout was acti= vated. */ void CartesianPlotDock::layoutChanged(Worksheet::Layout layout){ - bool b =3D (layout =3D=3D Worksheet::NoLayout); - ui.sbTop->setEnabled(b); - ui.sbLeft->setEnabled(b); - ui.sbWidth->setEnabled(b); - ui.sbHeight->setEnabled(b); - if (!b){ - m_initializing =3D true; - ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().x(),= Worksheet::Centimeter)); - ui.sbTop->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().y(), = Worksheet::Centimeter)); - ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().wid= th(), Worksheet::Centimeter)); - ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().he= ight(), Worksheet::Centimeter)); - m_initializing =3D false; - } + bool b =3D (layout =3D=3D Worksheet::NoLayout); + ui.sbTop->setEnabled(b); + ui.sbLeft->setEnabled(b); + ui.sbWidth->setEnabled(b); + ui.sbHeight->setEnabled(b); + if (!b){ + m_initializing =3D true; + ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(m_plot->rect(= ).x(), Worksheet::Centimeter)); + ui.sbTop->setValue(Worksheet::convertFromSceneUnits(m_plot->rect()= .y(), Worksheet::Centimeter)); + ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(m_plot->rect= ().width(), Worksheet::Centimeter)); + ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(m_plot->rec= t().height(), Worksheet::Centimeter)); + m_initializing =3D false; + } } = = void CartesianPlotDock::autoScaleXChanged(int state){ - bool checked =3D (state=3D=3DQt::Checked); - ui.kleXMin->setEnabled(!checked); - ui.kleXMax->setEnabled(!checked); + bool checked =3D (state=3D=3DQt::Checked); + ui.kleXMin->setEnabled(!checked); + ui.kleXMax->setEnabled(!checked); = - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(CartesianPlot* plot, m_plotList) - plot->setAutoScaleX(checked); + foreach(CartesianPlot* plot, m_plotList) + plot->setAutoScaleX(checked); } = void CartesianPlotDock::xMinChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - float value =3D ui.kleXMin->text().toDouble(); - foreach(CartesianPlot* plot, m_plotList) - plot->setXMin(value); + float value =3D ui.kleXMin->text().toDouble(); + foreach(CartesianPlot* plot, m_plotList) + plot->setXMin(value); } = void CartesianPlotDock::xMaxChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - float value =3D ui.kleXMax->text().toDouble(); - foreach(CartesianPlot* plot, m_plotList) - plot->setXMax(value); + float value =3D ui.kleXMax->text().toDouble(); + foreach(CartesianPlot* plot, m_plotList) + plot->setXMax(value); } = /*! - called on scale changes (linear, log) for the x-axis + called on scale changes (linear, log) for the x-axis */ void CartesianPlotDock::xScaleChanged(int scale){ if (m_initializing) - return; + return; = foreach(CartesianPlot* plot, m_plotList) - plot->setXScale((CartesianPlot::Scale) scale); + plot->setXScale((CartesianPlot::Scale) scale); } = void CartesianPlotDock::autoScaleYChanged(int state){ - bool checked =3D (state=3D=3DQt::Checked); - ui.kleYMin->setEnabled(!checked); - ui.kleYMax->setEnabled(!checked); + bool checked =3D (state=3D=3DQt::Checked); + ui.kleYMin->setEnabled(!checked); + ui.kleYMax->setEnabled(!checked); = - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(CartesianPlot* plot, m_plotList) - plot->setAutoScaleY(checked); + foreach(CartesianPlot* plot, m_plotList) + plot->setAutoScaleY(checked); } = void CartesianPlotDock::yMinChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - float value =3D ui.kleYMin->text().toDouble(); - foreach(CartesianPlot* plot, m_plotList) - plot->setYMin(value); + float value =3D ui.kleYMin->text().toDouble(); + foreach(CartesianPlot* plot, m_plotList) + plot->setYMin(value); } = void CartesianPlotDock::yMaxChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - float value =3D ui.kleYMax->text().toDouble(); - foreach(CartesianPlot* plot, m_plotList) - plot->setYMax(value); + float value =3D ui.kleYMax->text().toDouble(); + foreach(CartesianPlot* plot, m_plotList) + plot->setYMax(value); } = /*! - called on scale changes (linear, log) for the y-axis + called on scale changes (linear, log) for the y-axis */ void CartesianPlotDock::yScaleChanged(int index){ if (m_initializing) - return; + return; = CartesianPlot::Scale scale =3D (CartesianPlot::Scale)index; foreach(CartesianPlot* plot, m_plotList) - plot->setYScale(scale); + plot->setYScale(scale); } = // "Scale Breakings"-tab void CartesianPlotDock::toggleXBreak(int state){ - bool b =3D (state=3D=3DQt::Checked); - ui.frameXBreakEdit->setVisible(b); - ui.lXBreakStart->setVisible(b); - ui.leXBreakStart->setVisible(b); - ui.lXBreakEnd->setVisible(b); - ui.leXBreakEnd->setVisible(b); + bool b =3D (state=3D=3DQt::Checked); + ui.frameXBreakEdit->setVisible(b); + ui.lXBreakStart->setVisible(b); + ui.leXBreakStart->setVisible(b); + ui.lXBreakEnd->setVisible(b); + ui.leXBreakEnd->setVisible(b); ui.lXBreakPosition->setVisible(b); - ui.sbXBreakPosition->setVisible(b); + ui.sbXBreakPosition->setVisible(b); ui.lXBreakStyle->setVisible(b); - ui.cbXBreakStyle->setVisible(b); + ui.cbXBreakStyle->setVisible(b); = - if (m_initializing) - return; + if (m_initializing) + return; } = void CartesianPlotDock::addXBreak() { @@ -515,7 +516,7 @@ void CartesianPlotDock::addXBreak() { } = void CartesianPlotDock::removeXBreak() { -// ui.bRemoveXBreak->setVisible(m_plot->xScaleBreakings().size()!=3D0); +// ui.bRemoveXBreak->setVisible(m_plot->xScaleBreakings().size()!=3D0); } = void CartesianPlotDock::currentXBreakChanged(int) { @@ -523,62 +524,62 @@ void CartesianPlotDock::currentXBreakChanged(int) { } = void CartesianPlotDock::xBreakStartChanged() { - if (m_initializing) - return; + if (m_initializing) + return; = - int index =3D ui.cbXBreak->currentIndex(); - CartesianPlot::ScaleBreakings breakings =3D m_plot->xScaleBreakings(); - if (index=3D=3D0 && breakings.list.size()=3D=3D0) { - //no scale breaking avaiable yet, create a new one - CartesianPlot::ScaleBreaking breaking; - breaking.start =3D ui.leXBreakStart->text().toDouble(); - breakings.list<text().toDouble(); - } + int index =3D ui.cbXBreak->currentIndex(); + CartesianPlot::ScaleBreakings breakings =3D m_plot->xScaleBreakings(); + if (index=3D=3D0 && breakings.list.size()=3D=3D0) { + //no scale breaking avaiable yet, create a new one + CartesianPlot::ScaleBreaking breaking; + breaking.start =3D ui.leXBreakStart->text().toDouble(); + breakings.list<text().toDouble(= ); + } = - foreach(CartesianPlot* plot, m_plotList) - plot->setXScaleBreakings(breakings); + foreach(CartesianPlot* plot, m_plotList) + plot->setXScaleBreakings(breakings); } = void CartesianPlotDock::xBreakEndChanged() { - if (m_initializing) - return; + if (m_initializing) + return; = - int index =3D ui.cbXBreak->currentIndex(); - CartesianPlot::ScaleBreakings breakings =3D m_plot->xScaleBreakings(); - if (index=3D=3D0 && breakings.list.size()=3D=3D0) { - //no scale breaking avaiable yet, create a new one - CartesianPlot::ScaleBreaking breaking; - breaking.end =3D ui.leXBreakEnd->text().toDouble(); - breakings.list<text().toDouble(); - } + int index =3D ui.cbXBreak->currentIndex(); + CartesianPlot::ScaleBreakings breakings =3D m_plot->xScaleBreakings(); + if (index=3D=3D0 && breakings.list.size()=3D=3D0) { + //no scale breaking avaiable yet, create a new one + CartesianPlot::ScaleBreaking breaking; + breaking.end =3D ui.leXBreakEnd->text().toDouble(); + breakings.list<text().toDouble(); + } = - foreach(CartesianPlot* plot, m_plotList) - plot->setXScaleBreakings(breakings); + foreach(CartesianPlot* plot, m_plotList) + plot->setXScaleBreakings(breakings); } = void CartesianPlotDock::xBreakPositionChanged(int) { - if (m_initializing) - return; + if (m_initializing) + return; } = void CartesianPlotDock::toggleYBreak(int state){ - bool b =3D (state=3D=3DQt::Checked); - ui.frameYBreakEdit->setVisible(b); - ui.lYBreakStart->setVisible(b); - ui.leYBreakStart->setVisible(b); - ui.lYBreakEnd->setVisible(b); - ui.leYBreakEnd->setVisible(b); + bool b =3D (state=3D=3DQt::Checked); + ui.frameYBreakEdit->setVisible(b); + ui.lYBreakStart->setVisible(b); + ui.leYBreakStart->setVisible(b); + ui.lYBreakEnd->setVisible(b); + ui.leYBreakEnd->setVisible(b); ui.lYBreakPosition->setVisible(b); - ui.sbYBreakPosition->setVisible(b); + ui.sbYBreakPosition->setVisible(b); ui.lYBreakStyle->setVisible(b); - ui.cbYBreakStyle->setVisible(b); + ui.cbYBreakStyle->setVisible(b); = - if (m_initializing) - return; + if (m_initializing) + return; } = void CartesianPlotDock::addYBreak() { @@ -607,203 +608,203 @@ void CartesianPlotDock::yBreakPositionChanged(int) { = // "Plot area"-tab void CartesianPlotDock::backgroundTypeChanged(int index){ - PlotArea::BackgroundType type =3D (PlotArea::BackgroundType)index; - - if (type =3D=3D PlotArea::Color){ - ui.lBackgroundColorStyle->show(); - ui.cbBackgroundColorStyle->show(); - ui.lBackgroundImageStyle->hide(); - ui.cbBackgroundImageStyle->hide(); - ui.lBackgroundBrushStyle->hide(); - ui.cbBackgroundBrushStyle->hide(); - - ui.lBackgroundFileName->hide(); - ui.kleBackgroundFileName->hide(); - ui.bOpen->hide(); - - ui.lBackgroundFirstColor->show(); - ui.kcbBackgroundFirstColor->show(); - - PlotArea::BackgroundColorStyle style =3D - (PlotArea::BackgroundColorStyle) ui.cbBackgroundColorStyle->currentInde= x(); - if (style =3D=3D PlotArea::SingleColor){ - ui.lBackgroundFirstColor->setText(i18n("Color")); - ui.lBackgroundSecondColor->hide(); - ui.kcbBackgroundSecondColor->hide(); - }else{ - ui.lBackgroundFirstColor->setText(i18n("First Color")); - ui.lBackgroundSecondColor->show(); - ui.kcbBackgroundSecondColor->show(); - } - }else if(type =3D=3D PlotArea::Image){ - ui.lBackgroundColorStyle->hide(); - ui.cbBackgroundColorStyle->hide(); - ui.lBackgroundImageStyle->show(); - ui.cbBackgroundImageStyle->show(); - ui.lBackgroundBrushStyle->hide(); - ui.cbBackgroundBrushStyle->hide(); - ui.lBackgroundFileName->show(); - ui.kleBackgroundFileName->show(); - ui.bOpen->show(); - - ui.lBackgroundFirstColor->hide(); - ui.kcbBackgroundFirstColor->hide(); - ui.lBackgroundSecondColor->hide(); - ui.kcbBackgroundSecondColor->hide(); - }else if(type =3D=3D PlotArea::Pattern) { - ui.lBackgroundFirstColor->setText(i18n("Color")); - ui.lBackgroundColorStyle->hide(); - ui.cbBackgroundColorStyle->hide(); - ui.lBackgroundImageStyle->hide(); - ui.cbBackgroundImageStyle->hide(); - ui.lBackgroundBrushStyle->show(); - ui.cbBackgroundBrushStyle->show(); - ui.lBackgroundFileName->hide(); - ui.kleBackgroundFileName->hide(); - ui.bOpen->hide(); - - ui.lBackgroundFirstColor->show(); - ui.kcbBackgroundFirstColor->show(); - ui.lBackgroundSecondColor->hide(); - ui.kcbBackgroundSecondColor->hide(); - } - - if (m_initializing) - return; - - foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundType(type); + PlotArea::BackgroundType type =3D (PlotArea::BackgroundType)index; + + if (type =3D=3D PlotArea::Color){ + ui.lBackgroundColorStyle->show(); + ui.cbBackgroundColorStyle->show(); + ui.lBackgroundImageStyle->hide(); + ui.cbBackgroundImageStyle->hide(); + ui.lBackgroundBrushStyle->hide(); + ui.cbBackgroundBrushStyle->hide(); + + ui.lBackgroundFileName->hide(); + ui.kleBackgroundFileName->hide(); + ui.bOpen->hide(); + + ui.lBackgroundFirstColor->show(); + ui.kcbBackgroundFirstColor->show(); + + PlotArea::BackgroundColorStyle style =3D + (PlotArea::BackgroundColorStyle) ui.cbBackgroundColorStyle->cu= rrentIndex(); + if (style =3D=3D PlotArea::SingleColor){ + ui.lBackgroundFirstColor->setText(i18n("Color")); + ui.lBackgroundSecondColor->hide(); + ui.kcbBackgroundSecondColor->hide(); + }else{ + ui.lBackgroundFirstColor->setText(i18n("First Color")); + ui.lBackgroundSecondColor->show(); + ui.kcbBackgroundSecondColor->show(); + } + }else if(type =3D=3D PlotArea::Image){ + ui.lBackgroundColorStyle->hide(); + ui.cbBackgroundColorStyle->hide(); + ui.lBackgroundImageStyle->show(); + ui.cbBackgroundImageStyle->show(); + ui.lBackgroundBrushStyle->hide(); + ui.cbBackgroundBrushStyle->hide(); + ui.lBackgroundFileName->show(); + ui.kleBackgroundFileName->show(); + ui.bOpen->show(); + + ui.lBackgroundFirstColor->hide(); + ui.kcbBackgroundFirstColor->hide(); + ui.lBackgroundSecondColor->hide(); + ui.kcbBackgroundSecondColor->hide(); + }else if(type =3D=3D PlotArea::Pattern) { + ui.lBackgroundFirstColor->setText(i18n("Color")); + ui.lBackgroundColorStyle->hide(); + ui.cbBackgroundColorStyle->hide(); + ui.lBackgroundImageStyle->hide(); + ui.cbBackgroundImageStyle->hide(); + ui.lBackgroundBrushStyle->show(); + ui.cbBackgroundBrushStyle->show(); + ui.lBackgroundFileName->hide(); + ui.kleBackgroundFileName->hide(); + ui.bOpen->hide(); + + ui.lBackgroundFirstColor->show(); + ui.kcbBackgroundFirstColor->show(); + ui.lBackgroundSecondColor->hide(); + ui.kcbBackgroundSecondColor->hide(); + } + + if (m_initializing) + return; + + foreach(CartesianPlot* plot, m_plotList){ + plot->plotArea()->setBackgroundType(type); } } = void CartesianPlotDock::backgroundColorStyleChanged(int index){ - PlotArea::BackgroundColorStyle style =3D (PlotArea::BackgroundColorStyle)= index; - - if (style =3D=3D PlotArea::SingleColor){ - ui.lBackgroundFirstColor->setText(i18n("Color")); - ui.lBackgroundSecondColor->hide(); - ui.kcbBackgroundSecondColor->hide(); - ui.lBackgroundBrushStyle->show(); - ui.cbBackgroundBrushStyle->show(); - }else{ - ui.lBackgroundFirstColor->setText(i18n("First Color")); - ui.lBackgroundSecondColor->show(); - ui.kcbBackgroundSecondColor->show(); - ui.lBackgroundBrushStyle->hide(); - ui.cbBackgroundBrushStyle->hide(); - } - - if (m_initializing) - return; - - foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundColorStyle(style); + PlotArea::BackgroundColorStyle style =3D (PlotArea::BackgroundColorSty= le)index; + + if (style =3D=3D PlotArea::SingleColor){ + ui.lBackgroundFirstColor->setText(i18n("Color")); + ui.lBackgroundSecondColor->hide(); + ui.kcbBackgroundSecondColor->hide(); + ui.lBackgroundBrushStyle->show(); + ui.cbBackgroundBrushStyle->show(); + }else{ + ui.lBackgroundFirstColor->setText(i18n("First Color")); + ui.lBackgroundSecondColor->show(); + ui.kcbBackgroundSecondColor->show(); + ui.lBackgroundBrushStyle->hide(); + ui.cbBackgroundBrushStyle->hide(); + } + + if (m_initializing) + return; + + foreach(CartesianPlot* plot, m_plotList){ + plot->plotArea()->setBackgroundColorStyle(style); } } = void CartesianPlotDock::backgroundImageStyleChanged(int index){ - if (m_initializing) - return; + if (m_initializing) + return; = - PlotArea::BackgroundImageStyle style =3D (PlotArea::BackgroundImageStyle)= index; - foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundImageStyle(style); + PlotArea::BackgroundImageStyle style =3D (PlotArea::BackgroundImageSty= le)index; + foreach(CartesianPlot* plot, m_plotList){ + plot->plotArea()->setBackgroundImageStyle(style); } } = void CartesianPlotDock::backgroundBrushStyleChanged(int index){ - if (m_initializing) - return; + if (m_initializing) + return; = - Qt::BrushStyle style =3D (Qt::BrushStyle)index; - foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundBrushStyle(style); + Qt::BrushStyle style =3D (Qt::BrushStyle)index; + foreach(CartesianPlot* plot, m_plotList){ + plot->plotArea()->setBackgroundBrushStyle(style); } } = void CartesianPlotDock::backgroundFirstColorChanged(const QColor& c){ if (m_initializing) - return; + return; = foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundFirstColor(c); + plot->plotArea()->setBackgroundFirstColor(c); } } = void CartesianPlotDock::backgroundSecondColorChanged(const QColor& c){ if (m_initializing) - return; + return; = foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundSecondColor(c); + plot->plotArea()->setBackgroundSecondColor(c); } } = /*! - 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 =3D conf.readEntry("LastImageDir", ""); + KConfigGroup conf(KSharedConfig::openConfig(), "CartesianPlotDock"); + QString dir =3D conf.readEntry("LastImageDir", ""); QString path =3D QFileDialog::getOpenFileName(this, i18n("Select the i= mage file"), dir); if (path.isEmpty()) return; //cancel was clicked in the file-dialog = - int pos =3D path.lastIndexOf(QDir::separator()); - if (pos!=3D-1) { - QString newDir =3D path.left(pos); - if (newDir!=3Ddir) - conf.writeEntry("LastImageDir", newDir); - } + int pos =3D path.lastIndexOf(QDir::separator()); + if (pos!=3D-1) { + QString newDir =3D path.left(pos); + if (newDir!=3Ddir) + conf.writeEntry("LastImageDir", newDir); + } = ui.kleBackgroundFileName->setText( path ); = - foreach(CartesianPlot* plot, m_plotList) - plot->plotArea()->setBackgroundFileName(path); + foreach(CartesianPlot* plot, m_plotList) + plot->plotArea()->setBackgroundFileName(path); } = void CartesianPlotDock::fileNameChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - QString fileName =3D ui.kleBackgroundFileName->text(); - foreach(CartesianPlot* plot, m_plotList){ - plot->plotArea()->setBackgroundFileName(fileName); + QString fileName =3D ui.kleBackgroundFileName->text(); + foreach(CartesianPlot* plot, m_plotList){ + plot->plotArea()->setBackgroundFileName(fileName); } } = void CartesianPlotDock::backgroundOpacityChanged(int value){ - if (m_initializing) - return; + if (m_initializing) + return; = - qreal opacity =3D (float)value/100.; - foreach(CartesianPlot* plot, m_plotList) - plot->plotArea()->setBackgroundOpacity(opacity); + qreal opacity =3D (float)value/100.; + foreach(CartesianPlot* plot, m_plotList) + plot->plotArea()->setBackgroundOpacity(opacity); } = // "Border"-tab void CartesianPlotDock::borderStyleChanged(int index){ if (m_initializing) - return; + return; = Qt::PenStyle penStyle=3DQt::PenStyle(index); QPen pen; foreach(CartesianPlot* plot, m_plotList){ - pen=3Dplot->plotArea()->borderPen(); - pen.setStyle(penStyle); - plot->plotArea()->setBorderPen(pen); + pen=3Dplot->plotArea()->borderPen(); + pen.setStyle(penStyle); + plot->plotArea()->setBorderPen(pen); } } = void CartesianPlotDock::borderColorChanged(const QColor& color){ if (m_initializing) - return; + return; = QPen pen; foreach(CartesianPlot* plot, m_plotList){ - pen=3Dplot->plotArea()->borderPen(); - pen.setColor(color); - plot->plotArea()->setBorderPen(pen); + pen=3Dplot->plotArea()->borderPen(); + pen.setColor(color); + plot->plotArea()->setBorderPen(pen); } = m_initializing=3Dtrue; @@ -813,47 +814,47 @@ void CartesianPlotDock::borderColorChanged(const QCol= or& color){ = void CartesianPlotDock::borderWidthChanged(double value){ if (m_initializing) - return; + return; = QPen pen; foreach(CartesianPlot* plot, m_plotList){ - pen=3Dplot->plotArea()->borderPen(); - pen.setWidthF( Worksheet::convertToSceneUnits(value, Worksheet::Point) ); - plot->plotArea()->setBorderPen(pen); + pen=3Dplot->plotArea()->borderPen(); + pen.setWidthF( Worksheet::convertToSceneUnits(value, Worksheet::Point)= ); + plot->plotArea()->setBorderPen(pen); } } = void CartesianPlotDock::borderCornerRadiusChanged(double value){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(CartesianPlot* plot, m_plotList) - plot->plotArea()->setBorderCornerRadius(Worksheet::convertToSceneUnits(v= alue, Worksheet::Centimeter)); + foreach(CartesianPlot* plot, m_plotList) + plot->plotArea()->setBorderCornerRadius(Worksheet::convertToSceneU= nits(value, Worksheet::Centimeter)); } = void CartesianPlotDock::borderOpacityChanged(int value){ - if (m_initializing) - return; + if (m_initializing) + return; = - qreal opacity =3D (float)value/100.; - foreach(CartesianPlot* plot, m_plotList) - plot->plotArea()->setBorderOpacity(opacity); + qreal opacity =3D (float)value/100.; + foreach(CartesianPlot* plot, m_plotList) + plot->plotArea()->setBorderOpacity(opacity); } = void CartesianPlotDock::horizontalPaddingChanged(double value){ if (m_initializing) - return; + return; = foreach(CartesianPlot* plot, m_plotList) - plot->setHorizontalPadding(Worksheet::convertToSceneUnits(value, Workshee= t::Centimeter)); + plot->setHorizontalPadding(Worksheet::convertToSceneUnits(value, Works= heet::Centimeter)); } = void CartesianPlotDock::verticalPaddingChanged(double value){ if (m_initializing) - return; + return; = foreach(CartesianPlot* plot, m_plotList) - plot->setVerticalPadding(Worksheet::convertToSceneUnits(value, Worksheet:= :Centimeter)); + plot->setVerticalPadding(Worksheet::convertToSceneUnits(value, Workshe= et::Centimeter)); } = //************************************************************* @@ -861,351 +862,351 @@ void CartesianPlotDock::verticalPaddingChanged(doub= le value){ //************************************************************* //general void CartesianPlotDock::plotDescriptionChanged(const AbstractAspect* aspec= t) { - if (m_plot !=3D aspect) - return; + if (m_plot !=3D aspect) + return; = - m_initializing =3D true; - if (aspect->name() !=3D ui.leName->text()) { - ui.leName->setText(aspect->name()); - } else if (aspect->comment() !=3D ui.leComment->text()) { - ui.leComment->setText(aspect->comment()); - } - m_initializing =3D false; + m_initializing =3D true; + if (aspect->name() !=3D ui.leName->text()) { + ui.leName->setText(aspect->name()); + } else if (aspect->comment() !=3D ui.leComment->text()) { + ui.leComment->setText(aspect->comment()); + } + m_initializing =3D false; } = void CartesianPlotDock::plotRectChanged(QRectF& rect){ - m_initializing =3D true; - ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(rect.x(), Worksheet:= :Centimeter)); - ui.sbTop->setValue(Worksheet::convertFromSceneUnits(rect.y(), Worksheet::= Centimeter)); - ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(rect.width(), Works= heet::Centimeter)); - ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), Wor= ksheet::Centimeter)); - m_initializing =3D false; + m_initializing =3D true; + ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(rect.x(), Workshe= et::Centimeter)); + ui.sbTop->setValue(Worksheet::convertFromSceneUnits(rect.y(), Workshee= t::Centimeter)); + ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(rect.width(), Wo= rksheet::Centimeter)); + ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), = Worksheet::Centimeter)); + m_initializing =3D false; } = void CartesianPlotDock::plotXMinChanged(float value){ - m_initializing =3D true; - ui.kleXMin->setText( QString::number(value) ); - m_initializing =3D false; + m_initializing =3D true; + ui.kleXMin->setText( QString::number(value) ); + m_initializing =3D false; } = void CartesianPlotDock::plotXMaxChanged(float value){ - m_initializing =3D true; - ui.kleXMax->setText( QString::number(value) ); - m_initializing =3D false; + m_initializing =3D true; + ui.kleXMax->setText( QString::number(value) ); + m_initializing =3D false; } = void CartesianPlotDock::plotXScaleChanged(int scale){ - m_initializing =3D true; - ui.cbXScaling->setCurrentIndex( scale ); - m_initializing =3D false; + m_initializing =3D true; + ui.cbXScaling->setCurrentIndex( scale ); + m_initializing =3D false; } = void CartesianPlotDock::plotYMinChanged(float value){ - m_initializing =3D true; - ui.kleYMin->setText( QString::number(value) ); - m_initializing =3D false; + m_initializing =3D true; + ui.kleYMin->setText( QString::number(value) ); + m_initializing =3D false; } = void CartesianPlotDock::plotYMaxChanged(float value){ - m_initializing =3D true; - ui.kleYMax->setText( QString::number(value) ); - m_initializing =3D false; + m_initializing =3D true; + ui.kleYMax->setText( QString::number(value) ); + m_initializing =3D false; } = void CartesianPlotDock::plotYScaleChanged(int scale){ - m_initializing =3D true; - ui.cbYScaling->setCurrentIndex( scale ); - m_initializing =3D false; + m_initializing =3D true; + ui.cbYScaling->setCurrentIndex( scale ); + m_initializing =3D false; } = void CartesianPlotDock::plotVisibleChanged(bool on){ - m_initializing =3D true; - ui.chkVisible->setChecked(on); - m_initializing =3D false; + m_initializing =3D true; + ui.chkVisible->setChecked(on); + m_initializing =3D false; } = //scale breakings void CartesianPlotDock::plotXScaleBreakingChanged(const CartesianPlot::Sca= leBreakings& breakings) { - Q_UNUSED(breakings); + Q_UNUSED(breakings); } = void CartesianPlotDock::plotYScaleBreakingChanged(const CartesianPlot::Sca= leBreakings& breakings) { - Q_UNUSED(breakings); + Q_UNUSED(breakings); } = //background void CartesianPlotDock::plotBackgroundTypeChanged(PlotArea::BackgroundType= type){ - m_initializing =3D true; - ui.cbBackgroundType->setCurrentIndex(type); - m_initializing =3D false; + m_initializing =3D true; + ui.cbBackgroundType->setCurrentIndex(type); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundColorStyleChanged(PlotArea::Backgrou= ndColorStyle style){ - m_initializing =3D true; - ui.cbBackgroundColorStyle->setCurrentIndex(style); - m_initializing =3D false; + m_initializing =3D true; + ui.cbBackgroundColorStyle->setCurrentIndex(style); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundImageStyleChanged(PlotArea::Backgrou= ndImageStyle style){ - m_initializing =3D true; - ui.cbBackgroundImageStyle->setCurrentIndex(style); - m_initializing =3D false; + m_initializing =3D true; + ui.cbBackgroundImageStyle->setCurrentIndex(style); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundBrushStyleChanged(Qt::BrushStyle sty= le){ - m_initializing =3D true; - ui.cbBackgroundBrushStyle->setCurrentIndex(style); - m_initializing =3D false; + m_initializing =3D true; + ui.cbBackgroundBrushStyle->setCurrentIndex(style); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundFirstColorChanged(QColor& color){ - m_initializing =3D true; - ui.kcbBackgroundFirstColor->setColor(color); - m_initializing =3D false; + m_initializing =3D true; + ui.kcbBackgroundFirstColor->setColor(color); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundSecondColorChanged(QColor& color){ - m_initializing =3D true; - ui.kcbBackgroundSecondColor->setColor(color); - m_initializing =3D false; + m_initializing =3D true; + ui.kcbBackgroundSecondColor->setColor(color); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundFileNameChanged(QString& filename){ - m_initializing =3D true; - ui.kleBackgroundFileName->setText(filename); - m_initializing =3D false; + m_initializing =3D true; + ui.kleBackgroundFileName->setText(filename); + m_initializing =3D false; } = void CartesianPlotDock::plotBackgroundOpacityChanged(float opacity){ - m_initializing =3D true; - ui.sbBackgroundOpacity->setValue( round(opacity*100.0) ); - m_initializing =3D false; + m_initializing =3D true; + ui.sbBackgroundOpacity->setValue( round(opacity*100.0) ); + m_initializing =3D false; } = void CartesianPlotDock::plotBorderPenChanged(QPen& pen){ - m_initializing =3D true; - if(ui.cbBorderStyle->currentIndex() !=3D pen.style()) - ui.cbBorderStyle->setCurrentIndex(pen.style()); - if(ui.kcbBorderColor->color() !=3D pen.color()) - ui.kcbBorderColor->setColor(pen.color()); - if(ui.sbBorderWidth->value() !=3D pen.widthF()) - ui.sbBorderWidth->setValue(Worksheet::convertFromSceneUnits(pen.widthF()= ,Worksheet::Point)); - m_initializing =3D false; + m_initializing =3D true; + if(ui.cbBorderStyle->currentIndex() !=3D pen.style()) + ui.cbBorderStyle->setCurrentIndex(pen.style()); + if(ui.kcbBorderColor->color() !=3D pen.color()) + ui.kcbBorderColor->setColor(pen.color()); + if(ui.sbBorderWidth->value() !=3D pen.widthF()) + ui.sbBorderWidth->setValue(Worksheet::convertFromSceneUnits(pen.wi= dthF(),Worksheet::Point)); + m_initializing =3D false; } = void CartesianPlotDock::plotBorderCornerRadiusChanged(float value){ - m_initializing =3D true; - ui.sbBorderCornerRadius->setValue(Worksheet::convertFromSceneUnits(value,= Worksheet::Centimeter)); - m_initializing =3D false; + m_initializing =3D true; + ui.sbBorderCornerRadius->setValue(Worksheet::convertFromSceneUnits(val= ue, Worksheet::Centimeter)); + m_initializing =3D false; } = void CartesianPlotDock::plotBorderOpacityChanged(float value){ - m_initializing =3D true; - float v =3D (float)value*100.; - ui.sbBorderOpacity->setValue(v); - m_initializing =3D false; + m_initializing =3D true; + float v =3D (float)value*100.; + ui.sbBorderOpacity->setValue(v); + m_initializing =3D false; } = void CartesianPlotDock::plotHorizontalPaddingChanged(float value){ - m_initializing =3D true; - ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(value, = Worksheet::Centimeter)); - m_initializing =3D false; + m_initializing =3D true; + ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(valu= e, Worksheet::Centimeter)); + m_initializing =3D false; } = void CartesianPlotDock::plotVerticalPaddingChanged(float value){ - m_initializing =3D true; - ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(value, Wo= rksheet::Centimeter)); - m_initializing =3D false; + m_initializing =3D true; + ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(value,= Worksheet::Centimeter)); + m_initializing =3D false; } = //************************************************************* //******************** SETTINGS ******************************* //************************************************************* void CartesianPlotDock::loadConfigFromTemplate(KConfig& config) { - //extract the name of the template from the file name - QString name; - int index =3D config.name().lastIndexOf(QDir::separator()); - if (index!=3D-1) - name =3D config.name().right(config.name().size() - index - 1); - else - name =3D config.name(); + //extract the name of the template from the file name + QString name; + int index =3D config.name().lastIndexOf(QDir::separator()); + if (index!=3D-1) + name =3D config.name().right(config.name().size() - index - 1); + else + name =3D config.name(); = - int size =3D m_plotList.size(); - if (size>1) - m_plot->beginMacro(i18n("%1 cartesian plots: template \"%2\" loaded", si= ze, name)); - else - m_plot->beginMacro(i18n("%1: template \"%2\" loaded", m_plot->name(), na= me)); + int size =3D m_plotList.size(); + if (size>1) + m_plot->beginMacro(i18n("%1 cartesian plots: template \"%2\" loade= d", size, name)); + else + m_plot->beginMacro(i18n("%1: template \"%2\" loaded", m_plot->name= (), name)); = - this->loadConfig(config); + this->loadConfig(config); = - m_plot->endMacro(); + m_plot->endMacro(); } = void CartesianPlotDock::load(){ - //General-tab - ui.chkVisible->setChecked(m_plot->isVisible()); - ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().x(), = Worksheet::Centimeter)); - ui.sbTop->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().y(), W= orksheet::Centimeter)); - ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().widt= h(), Worksheet::Centimeter)); - ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().hei= ght(), Worksheet::Centimeter)); - - ui.chkAutoScaleX->setChecked(m_plot->autoScaleX()); - ui.kleXMin->setText( QString::number(m_plot->xMin()) ); - ui.kleXMax->setText( QString::number(m_plot->xMax()) ); - ui.cbXScaling->setCurrentIndex( (int) m_plot->xScale() ); - - ui.chkAutoScaleY->setChecked(m_plot->autoScaleY()); - ui.kleYMin->setText( QString::number(m_plot->yMin()) ); - ui.kleYMax->setText( QString::number(m_plot->yMax()) ); - ui.cbYScaling->setCurrentIndex( (int)m_plot->yScale() ); - - //Title - labelWidget->load(); - - //Scale breakings - ui.chkXBreak->setChecked(m_plot->xScaleBreakingEnabled()); - this->toggleXBreak(m_plot->xScaleBreakingEnabled()); - if (m_plot->xScaleBreakings().list.size()) { - - } else { - ui.leXBreakStart->setText(""); - ui.leXBreakEnd->setText(""); - ui.sbXBreakPosition->setValue(50); - ui.cbXBreakStyle->setCurrentIndex(0); - } - - ui.chkYBreak->setChecked(m_plot->yScaleBreakingEnabled()); - this->toggleYBreak(m_plot->yScaleBreakingEnabled()); - - //"Plot Area"-tab - //Background - ui.cbBackgroundType->setCurrentIndex( (int)m_plot->plotArea()->background= Type() ); - ui.cbBackgroundColorStyle->setCurrentIndex( (int) m_plot->plotArea()->bac= kgroundColorStyle() ); - ui.cbBackgroundImageStyle->setCurrentIndex( (int) m_plot->plotArea()->bac= kgroundImageStyle() ); - ui.cbBackgroundBrushStyle->setCurrentIndex( (int) m_plot->plotArea()->bac= kgroundBrushStyle() ); - ui.kleBackgroundFileName->setText( m_plot->plotArea()->backgroundFileName= () ); - ui.kcbBackgroundFirstColor->setColor( m_plot->plotArea()->backgroundFirst= Color() ); - ui.kcbBackgroundSecondColor->setColor( m_plot->plotArea()->backgroundSeco= ndColor() ); - ui.sbBackgroundOpacity->setValue( round(m_plot->plotArea()->backgroundOpa= city()*100.0) ); - - //Padding - ui.sbPaddingHorizontal->setValue( Worksheet::convertFromSceneUnits(m_plot= ->horizontalPadding(), Worksheet::Centimeter) ); - ui.sbPaddingVertical->setValue( Worksheet::convertFromSceneUnits(m_plot->= verticalPadding(), Worksheet::Centimeter) ); - - //Border - ui.kcbBorderColor->setColor( m_plot->plotArea()->borderPen().color() ); - ui.cbBorderStyle->setCurrentIndex( (int) m_plot->plotArea()->borderPen().= style() ); - ui.sbBorderWidth->setValue( Worksheet::convertFromSceneUnits(m_plot->plot= Area()->borderPen().widthF(), Worksheet::Point) ); - ui.sbBorderCornerRadius->setValue( Worksheet::convertFromSceneUnits(m_plo= t->plotArea()->borderCornerRadius(), Worksheet::Centimeter) ); - ui.sbBorderOpacity->setValue( round(m_plot->plotArea()->borderOpacity()*1= 00) ); - - m_initializing=3Dtrue; - GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color()); - m_initializing=3Dfalse; + //General-tab + ui.chkVisible->setChecked(m_plot->isVisible()); + ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().x(= ), Worksheet::Centimeter)); + ui.sbTop->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().y()= , Worksheet::Centimeter)); + ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().w= idth(), Worksheet::Centimeter)); + ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().= height(), Worksheet::Centimeter)); + + ui.chkAutoScaleX->setChecked(m_plot->autoScaleX()); + ui.kleXMin->setText( QString::number(m_plot->xMin()) ); + ui.kleXMax->setText( QString::number(m_plot->xMax()) ); + ui.cbXScaling->setCurrentIndex( (int) m_plot->xScale() ); + + ui.chkAutoScaleY->setChecked(m_plot->autoScaleY()); + ui.kleYMin->setText( QString::number(m_plot->yMin()) ); + ui.kleYMax->setText( QString::number(m_plot->yMax()) ); + ui.cbYScaling->setCurrentIndex( (int)m_plot->yScale() ); + + //Title + labelWidget->load(); + + //Scale breakings + ui.chkXBreak->setChecked(m_plot->xScaleBreakingEnabled()); + this->toggleXBreak(m_plot->xScaleBreakingEnabled()); + if (m_plot->xScaleBreakings().list.size()) { + + } else { + ui.leXBreakStart->setText(""); + ui.leXBreakEnd->setText(""); + ui.sbXBreakPosition->setValue(50); + ui.cbXBreakStyle->setCurrentIndex(0); + } + + ui.chkYBreak->setChecked(m_plot->yScaleBreakingEnabled()); + this->toggleYBreak(m_plot->yScaleBreakingEnabled()); + + //"Plot Area"-tab + //Background + ui.cbBackgroundType->setCurrentIndex( (int)m_plot->plotArea()->backgro= undType() ); + ui.cbBackgroundColorStyle->setCurrentIndex( (int) m_plot->plotArea()->= backgroundColorStyle() ); + ui.cbBackgroundImageStyle->setCurrentIndex( (int) m_plot->plotArea()->= backgroundImageStyle() ); + ui.cbBackgroundBrushStyle->setCurrentIndex( (int) m_plot->plotArea()->= backgroundBrushStyle() ); + ui.kleBackgroundFileName->setText( m_plot->plotArea()->backgroundFileN= ame() ); + ui.kcbBackgroundFirstColor->setColor( m_plot->plotArea()->backgroundFi= rstColor() ); + ui.kcbBackgroundSecondColor->setColor( m_plot->plotArea()->backgroundS= econdColor() ); + ui.sbBackgroundOpacity->setValue( round(m_plot->plotArea()->background= Opacity()*100.0) ); + + //Padding + ui.sbPaddingHorizontal->setValue( Worksheet::convertFromSceneUnits(m_p= lot->horizontalPadding(), Worksheet::Centimeter) ); + ui.sbPaddingVertical->setValue( Worksheet::convertFromSceneUnits(m_plo= t->verticalPadding(), Worksheet::Centimeter) ); + + //Border + ui.kcbBorderColor->setColor( m_plot->plotArea()->borderPen().color() ); + ui.cbBorderStyle->setCurrentIndex( (int) m_plot->plotArea()->borderPen= ().style() ); + ui.sbBorderWidth->setValue( Worksheet::convertFromSceneUnits(m_plot->p= lotArea()->borderPen().widthF(), Worksheet::Point) ); + ui.sbBorderCornerRadius->setValue( Worksheet::convertFromSceneUnits(m_= plot->plotArea()->borderCornerRadius(), Worksheet::Centimeter) ); + ui.sbBorderOpacity->setValue( round(m_plot->plotArea()->borderOpacity(= )*100) ); + + m_initializing=3Dtrue; + GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color()= ); + m_initializing=3Dfalse; } = void CartesianPlotDock::loadConfig(KConfig& config){ -// KConfigGroup group =3D config.group( "CartesianPlot" ); - - //General-tab - //TODO: decide whether to load properties, not related to the appearance/= style of the plot. - //most probably we don't want: when loading a new template we only want t= o change the style of the plot - //and not the plot region that depends on the data currently shown in the= plot. -// ui.chkVisible->setChecked( group.readEntry("Visible", m_plot->isVisibl= e()) ); -// ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(group.readEntry("= Left", m_plot->rect().x()), Worksheet::Centimeter)); -// ui.sbTop->setValue(Worksheet::convertFromSceneUnits(group.readEntry("T= op", m_plot->rect().y()), Worksheet::Centimeter)); -// ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(group.readEntry(= "Width", m_plot->rect().width()), Worksheet::Centimeter)); -// ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(group.readEntry= ("Height", m_plot->rect().height()), Worksheet::Centimeter)); +// KConfigGroup group =3D config.group( "CartesianPlot" ); + + //General-tab + //TODO: decide whether to load properties, not related to the appearan= ce/style of the plot. + //most probably we don't want: when loading a new template we only wan= t to change the style of the plot + //and not the plot region that depends on the data currently shown in = the plot. +// ui.chkVisible->setChecked( group.readEntry("Visible", m_plot->isVisibl= e()) ); +// ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(group.readEntry("= Left", m_plot->rect().x()), Worksheet::Centimeter)); +// ui.sbTop->setValue(Worksheet::convertFromSceneUnits(group.readEntry("T= op", m_plot->rect().y()), Worksheet::Centimeter)); +// ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(group.readEntry(= "Width", m_plot->rect().width()), Worksheet::Centimeter)); +// ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(group.readEntry= ("Height", m_plot->rect().height()), Worksheet::Centimeter)); // -// ui.chkAutoScaleX->setChecked(group.readEntry("AutoScaleX", m_plot->aut= oScaleX())); -// ui.kleXMin->setText( QString::number( group.readEntry("xMin", m_plot= ->xMin())) ); -// ui.kleXMax->setText( QString::number( group.readEntry("xMax", m_plot->= xMax())) ); -// ui.cbXScaling->setCurrentIndex( group.readEntry("xScale", (int) m_plot= ->xScale()) ); +// ui.chkAutoScaleX->setChecked(group.readEntry("AutoScaleX", m_plot->aut= oScaleX())); +// ui.kleXMin->setText( QString::number( group.readEntry("xMin", m_pl= ot->xMin())) ); +// ui.kleXMax->setText( QString::number( group.readEntry("xMax", m_plot->= xMax())) ); +// ui.cbXScaling->setCurrentIndex( group.readEntry("xScale", (int) m_plot= ->xScale()) ); // -// ui.chkAutoScaleY->setChecked(group.readEntry("AutoScaleY", m_plot->aut= oScaleY())); -// ui.kleYMin->setText( QString::number( group.readEntry("yMin", m_plot= ->yMin())) ); -// ui.kleYMax->setText( QString::number( group.readEntry("yMax", m_plot->= yMax())) ); -// ui.cbYScaling->setCurrentIndex( group.readEntry("yScale", (int) m_plot= ->yScale()) ); - - //Title - KConfigGroup group =3D config.group("PlotTitle"); - labelWidget->loadConfig(group); - - //Scale breakings - //TODO - - //Background-tab - group =3D config.group("PlotArea"); - ui.cbBackgroundType->setCurrentIndex( group.readEntry("BackgroundType", (= int) m_plot->plotArea()->backgroundType()) ); - ui.cbBackgroundColorStyle->setCurrentIndex( group.readEntry("BackgroundCo= lorStyle", (int) m_plot->plotArea()->backgroundColorStyle()) ); - ui.cbBackgroundImageStyle->setCurrentIndex( group.readEntry("BackgroundIm= ageStyle", (int) m_plot->plotArea()->backgroundImageStyle()) ); - ui.cbBackgroundBrushStyle->setCurrentIndex( group.readEntry("BackgroundBr= ushStyle", (int) m_plot->plotArea()->backgroundBrushStyle()) ); - ui.kleBackgroundFileName->setText( group.readEntry("BackgroundFileName", = m_plot->plotArea()->backgroundFileName()) ); - ui.kcbBackgroundFirstColor->setColor( group.readEntry("BackgroundFirstCol= or", m_plot->plotArea()->backgroundFirstColor()) ); - ui.kcbBackgroundSecondColor->setColor( group.readEntry("BackgroundSecondC= olor", m_plot->plotArea()->backgroundSecondColor()) ); - ui.sbBackgroundOpacity->setValue( round(group.readEntry("BackgroundOpacit= y", m_plot->plotArea()->backgroundOpacity())*100.0) ); - ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(group.r= eadEntry("HorizontalPadding", m_plot->horizontalPadding()), Worksheet::Cent= imeter)); - ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(group.rea= dEntry("VerticalPadding", m_plot->verticalPadding()), Worksheet::Centimeter= )); - - //Border-tab - ui.kcbBorderColor->setColor( group.readEntry("BorderColor", m_plot->plotA= rea()->borderPen().color()) ); - ui.cbBorderStyle->setCurrentIndex( group.readEntry("BorderStyle", (int) m= _plot->plotArea()->borderPen().style()) ); - ui.sbBorderWidth->setValue( Worksheet::convertFromSceneUnits(group.readEn= try("BorderWidth", m_plot->plotArea()->borderPen().widthF()), Worksheet::Po= int) ); - ui.sbBorderCornerRadius->setValue( Worksheet::convertFromSceneUnits(group= .readEntry("BorderCornerRadius", m_plot->plotArea()->borderCornerRadius()),= Worksheet::Centimeter) ); - ui.sbBorderOpacity->setValue( group.readEntry("BorderOpacity", m_plot->pl= otArea()->borderOpacity())*100 ); - - m_initializing=3Dtrue; - GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color()); - m_initializing=3Dfalse; +// ui.chkAutoScaleY->setChecked(group.readEntry("AutoScaleY", m_plot->aut= oScaleY())); +// ui.kleYMin->setText( QString::number( group.readEntry("yMin", m_pl= ot->yMin())) ); +// ui.kleYMax->setText( QString::number( group.readEntry("yMax", m_plot->= yMax())) ); +// ui.cbYScaling->setCurrentIndex( group.readEntry("yScale", (int) m_plot= ->yScale()) ); + + //Title + KConfigGroup group =3D config.group("PlotTitle"); + labelWidget->loadConfig(group); + + //Scale breakings + //TODO + + //Background-tab + group =3D config.group("PlotArea"); + ui.cbBackgroundType->setCurrentIndex( group.readEntry("BackgroundType"= , (int) m_plot->plotArea()->backgroundType()) ); + ui.cbBackgroundColorStyle->setCurrentIndex( group.readEntry("Backgroun= dColorStyle", (int) m_plot->plotArea()->backgroundColorStyle()) ); + ui.cbBackgroundImageStyle->setCurrentIndex( group.readEntry("Backgroun= dImageStyle", (int) m_plot->plotArea()->backgroundImageStyle()) ); + ui.cbBackgroundBrushStyle->setCurrentIndex( group.readEntry("Backgroun= dBrushStyle", (int) m_plot->plotArea()->backgroundBrushStyle()) ); + ui.kleBackgroundFileName->setText( group.readEntry("BackgroundFileName= ", m_plot->plotArea()->backgroundFileName()) ); + ui.kcbBackgroundFirstColor->setColor( group.readEntry("BackgroundFirst= Color", m_plot->plotArea()->backgroundFirstColor()) ); + ui.kcbBackgroundSecondColor->setColor( group.readEntry("BackgroundSeco= ndColor", m_plot->plotArea()->backgroundSecondColor()) ); + ui.sbBackgroundOpacity->setValue( round(group.readEntry("BackgroundOpa= city", m_plot->plotArea()->backgroundOpacity())*100.0) ); + ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(grou= p.readEntry("HorizontalPadding", m_plot->horizontalPadding()), Worksheet::C= entimeter)); + ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(group.= readEntry("VerticalPadding", m_plot->verticalPadding()), Worksheet::Centime= ter)); + + //Border-tab + ui.kcbBorderColor->setColor( group.readEntry("BorderColor", m_plot->pl= otArea()->borderPen().color()) ); + ui.cbBorderStyle->setCurrentIndex( group.readEntry("BorderStyle", (int= ) m_plot->plotArea()->borderPen().style()) ); + ui.sbBorderWidth->setValue( Worksheet::convertFromSceneUnits(group.rea= dEntry("BorderWidth", m_plot->plotArea()->borderPen().widthF()), Worksheet:= :Point) ); + ui.sbBorderCornerRadius->setValue( Worksheet::convertFromSceneUnits(gr= oup.readEntry("BorderCornerRadius", m_plot->plotArea()->borderCornerRadius(= )), Worksheet::Centimeter) ); + ui.sbBorderOpacity->setValue( group.readEntry("BorderOpacity", m_plot-= >plotArea()->borderOpacity())*100 ); + + m_initializing=3Dtrue; + GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color()= ); + m_initializing=3Dfalse; } = void CartesianPlotDock::saveConfig(KConfig& config){ -// KConfigGroup group =3D 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->val= ue(), Worksheet::Centimeter)); -// group.writeEntry("Top", Worksheet::convertToSceneUnits(ui.sbTop->value= (), Worksheet::Centimeter)); -// group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->v= alue(), Worksheet::Centimeter)); -// group.writeEntry("Height", Worksheet::convertToSceneUnits(ui.sbHeight-= >value(), Worksheet::Centimeter)); +// KConfigGroup group =3D config.group( "CartesianPlot" ); + + //General-tab + //TODO: decide whether to save properties, not related to the appearan= ce/style of the plot +// group.writeEntry("Visible", ui.chkVisible->isChecked()); +// group.writeEntry("Left", Worksheet::convertToSceneUnits(ui.sbLeft->val= ue(), Worksheet::Centimeter)); +// group.writeEntry("Top", Worksheet::convertToSceneUnits(ui.sbTop->value= (), Worksheet::Centimeter)); +// group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->v= alue(), 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 =3D config.group("PlotTitle"); - labelWidget->saveConfig(group); - - //Scale breakings - //TODO - - //Background - group =3D config.group("PlotArea"); - group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex()); - group.writeEntry("BackgroundColorStyle", ui.cbBackgroundColorStyle->curre= ntIndex()); - group.writeEntry("BackgroundImageStyle", ui.cbBackgroundImageStyle->curre= ntIndex()); - group.writeEntry("BackgroundBrushStyle", ui.cbBackgroundBrushStyle->curre= ntIndex()); - group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text()); - group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->colo= r()); - group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor->co= lor()); - group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/100= .0); - group.writeEntry("HorizontalPadding", Worksheet::convertToSceneUnits(ui.s= bPaddingHorizontal->value(), Worksheet::Centimeter)); - group.writeEntry("VerticalPadding", Worksheet::convertToSceneUnits(ui.sbP= addingVertical->value(), Worksheet::Centimeter)); - - //Border - group.writeEntry("BorderStyle", ui.cbBorderStyle->currentIndex()); - group.writeEntry("BorderColor", ui.kcbBorderColor->color()); - group.writeEntry("BorderWidth", Worksheet::convertToSceneUnits(ui.sbBorde= rWidth->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 =3D config.group("PlotTitle"); + labelWidget->saveConfig(group); + + //Scale breakings + //TODO + + //Background + group =3D config.group("PlotArea"); + group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex()= ); + group.writeEntry("BackgroundColorStyle", ui.cbBackgroundColorStyle->cu= rrentIndex()); + group.writeEntry("BackgroundImageStyle", ui.cbBackgroundImageStyle->cu= rrentIndex()); + group.writeEntry("BackgroundBrushStyle", ui.cbBackgroundBrushStyle->cu= rrentIndex()); + group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text(= )); + group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->c= olor()); + group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor-= >color()); + group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/= 100.0); + group.writeEntry("HorizontalPadding", Worksheet::convertToSceneUnits(u= i.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.sbBo= rderWidth->value(), Worksheet::Point)); + group.writeEntry("BorderCornerRadius", Worksheet::convertToSceneUnits(= ui.sbBorderCornerRadius->value(), Worksheet::Centimeter)); + group.writeEntry("BorderOpacity", ui.sbBorderOpacity->value()/100.0); + + config.sync(); } diff --git a/src/kdefrontend/dockwidgets/CartesianPlotDock.h b/src/kdefront= end/dockwidgets/CartesianPlotDock.h index c055310..6015717 100644 --- a/src/kdefrontend/dockwidgets/CartesianPlotDock.h +++ b/src/kdefrontend/dockwidgets/CartesianPlotDock.h @@ -34,6 +34,7 @@ #include "backend/worksheet/plots/cartesian/CartesianPlot.h" #include "ui_cartesianplotdock.h" #include +#include = class LabelWidget; = diff --git a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp b/src/= kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp index 174df23..8fd62a1 100644 --- a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp +++ b/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.cpp @@ -37,6 +37,7 @@ #include #include #include +#include = #include = @@ -62,7 +63,7 @@ CartesianPlotLegendDock::CartesianPlotLegendDock(QWidget = *parent): QWidget(paren = //"Background"-tab ui.kleBackgroundFileName->setClearButtonShown(true); - ui.bOpen->setIcon( KIcon("document-open") ); + ui.bOpen->setIcon( QIcon("document-open") ); = KUrlCompletion *comp =3D new KUrlCompletion(); ui.kleBackgroundFileName->setCompletionObject(comp); diff --git a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h b/src/kd= efrontend/dockwidgets/CartesianPlotLegendDock.h index 3fab3b1..69dd891 100644 --- a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h +++ b/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h @@ -31,6 +31,7 @@ #define CARTESIANPLOTLEGENDDOCK_H = #include +#include #include "ui_cartesianplotlegenddock.h" #include "backend/worksheet/plots/PlotArea.h" #include "backend/worksheet/plots/cartesian/CartesianPlotLegend.h" diff --git a/src/kdefrontend/dockwidgets/ColumnDock.cpp b/src/kdefrontend/d= ockwidgets/ColumnDock.cpp index 979d171..a93367a 100644 --- a/src/kdefrontend/dockwidgets/ColumnDock.cpp +++ b/src/kdefrontend/dockwidgets/ColumnDock.cpp @@ -38,6 +38,8 @@ #include "backend/datasources/FileDataSource.h" #include "backend/spreadsheet/Spreadsheet.h" = +#include + /*! \class ColumnDock \brief Provides a widget for editing the properties of the spreadsheet c= olumns currently selected in the project explorer. diff --git a/src/kdefrontend/dockwidgets/ProjectDock.cpp b/src/kdefrontend/= dockwidgets/ProjectDock.cpp index 4f88df3..ce199a8 100644 --- a/src/kdefrontend/dockwidgets/ProjectDock.cpp +++ b/src/kdefrontend/dockwidgets/ProjectDock.cpp @@ -30,6 +30,7 @@ #include "ProjectDock.h" #include "backend/core/Project.h" #include "kdefrontend/TemplateHandler.h" +#include = /*! \class ProjectDock diff --git a/src/kdefrontend/dockwidgets/ProjectDock.h b/src/kdefrontend/do= ckwidgets/ProjectDock.h index 8c000ce..320d40c 100644 --- a/src/kdefrontend/dockwidgets/ProjectDock.h +++ b/src/kdefrontend/dockwidgets/ProjectDock.h @@ -30,6 +30,7 @@ #define PROJECTDOCK_H = #include "ui_projectdock.h" +#include class Project; class AbstractAspect; = diff --git a/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp b/src/kdefront= end/dockwidgets/SpreadsheetDock.cpp index dd18308..954b8db 100644 --- a/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp +++ b/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp @@ -32,6 +32,8 @@ #include "backend/spreadsheet/Spreadsheet.h" #include "kdefrontend/TemplateHandler.h" #include +#include +#include = /*! \class SpreadsheetDock diff --git a/src/kdefrontend/dockwidgets/SpreadsheetDock.h b/src/kdefronten= d/dockwidgets/SpreadsheetDock.h index 8d11771..d308d0e 100644 --- a/src/kdefrontend/dockwidgets/SpreadsheetDock.h +++ b/src/kdefrontend/dockwidgets/SpreadsheetDock.h @@ -30,7 +30,7 @@ #ifndef SPREADSHEETDOCK_H #define SPREADSHEETDOCK_H = -#include +#include #include #include #include "ui_spreadsheetdock.h" diff --git a/src/kdefrontend/dockwidgets/WorksheetDock.cpp b/src/kdefronten= d/dockwidgets/WorksheetDock.cpp index 761afb7..75c07c5 100644 --- a/src/kdefrontend/dockwidgets/WorksheetDock.cpp +++ b/src/kdefrontend/dockwidgets/WorksheetDock.cpp @@ -34,6 +34,8 @@ #include #include #include +#include +#include = #include = @@ -85,7 +87,7 @@ WorksheetDock::WorksheetDock(QWidget *parent): QWidget(pa= rent){ //Background-tab ui.cbBackgroundColorStyle->setSizeAdjustPolicy(QComboBox::AdjustToMinimum= ContentsLengthWithIcon); ui.kleBackgroundFileName->setClearButtonShown(true); - ui.bOpen->setIcon( KIcon("document-open") ); + ui.bOpen->setIcon( QIcon("document-open") ); = KUrlCompletion *comp =3D new KUrlCompletion(); ui.kleBackgroundFileName->setCompletionObject(comp); diff --git a/src/kdefrontend/dockwidgets/WorksheetDock.h b/src/kdefrontend/= dockwidgets/WorksheetDock.h index 4d7e974..0f4665c 100644 --- a/src/kdefrontend/dockwidgets/WorksheetDock.h +++ b/src/kdefrontend/dockwidgets/WorksheetDock.h @@ -33,6 +33,7 @@ #include "backend/worksheet/Worksheet.h" #include "backend/worksheet/plots/PlotArea.h" #include "ui_worksheetdock.h" +#include = class Worksheet; class AbstractAspect; diff --git a/src/kdefrontend/dockwidgets/XYCurveDock.cpp b/src/kdefrontend/= dockwidgets/XYCurveDock.cpp index e40ab0f..bf0964c 100644 --- a/src/kdefrontend/dockwidgets/XYCurveDock.cpp +++ b/src/kdefrontend/dockwidgets/XYCurveDock.cpp @@ -44,6 +44,8 @@ #include #include #include +#include +#include = /*! \class XYCurveDock diff --git a/src/kdefrontend/dockwidgets/XYCurveDock.h b/src/kdefrontend/do= ckwidgets/XYCurveDock.h index 5d36209..b811f99 100644 --- a/src/kdefrontend/dockwidgets/XYCurveDock.h +++ b/src/kdefrontend/dockwidgets/XYCurveDock.h @@ -34,6 +34,7 @@ #include "backend/worksheet/plots/cartesian/XYCurve.h" #include "ui_xycurvedock.h" #include "ui_xycurvedockgeneraltab.h" +#include = class XYCurve; class TreeViewComboBox; diff --git a/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp b/src/kdef= rontend/dockwidgets/XYEquationCurveDock.cpp index c9f00d3..55b6793 100644 --- a/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp +++ b/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp @@ -39,6 +39,7 @@ #include #include #include +#include = /*! \class XYEquationCurveDock @@ -75,18 +76,18 @@ void XYEquationCurveDock::setupGeneral() { layout->setMargin(0); layout->addWidget(generalTab); = - uiGeneralTab.tbConstants1->setIcon( KIcon("format-text-symbol") ); - uiGeneralTab.tbFunctions1->setIcon( KIcon("preferences-desktop-font") ); + uiGeneralTab.tbConstants1->setIcon( QIcon("format-text-symbol") ); + uiGeneralTab.tbFunctions1->setIcon( QIcon("preferences-desktop-font") = ); = - uiGeneralTab.tbConstants2->setIcon( KIcon("format-text-symbol") ); - uiGeneralTab.tbFunctions2->setIcon( KIcon("preferences-desktop-font") ); + uiGeneralTab.tbConstants2->setIcon( QIcon("format-text-symbol") ); + uiGeneralTab.tbFunctions2->setIcon( QIcon("preferences-desktop-font") = ); = uiGeneralTab.cbType->addItem(i18n("cartesian")); uiGeneralTab.cbType->addItem(i18n("polar")); uiGeneralTab.cbType->addItem(i18n("parametric")); // uiGeneralTab.cbType->addItem(i18n("implicit")); = - uiGeneralTab.pbRecalculate->setIcon(KIcon("run-build")); + uiGeneralTab.pbRecalculate->setIcon(QIcon("run-build")); = uiGeneralTab.teEquation2->setExpressionType(XYEquationCurve::Parametric); = diff --git a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp b/src/kdefronte= nd/dockwidgets/XYFitCurveDock.cpp index 117df23..2b31ece 100644 --- a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp +++ b/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp @@ -39,7 +39,7 @@ #include #include #include - +#include /*! \class XYFitCurveDock \brief Provides a widget for editing the properties of the XYFitCurves @@ -90,9 +90,9 @@ void XYFitCurveDock::setupGeneral() { uiGeneralTab.cbModel->addItem(i18n("Maxwell-Boltzmann")); uiGeneralTab.cbModel->addItem(i18n("Custom")); = - uiGeneralTab.tbConstants->setIcon( KIcon("format-text-symbol") ); - uiGeneralTab.tbFunctions->setIcon( KIcon("preferences-desktop-font") ); - uiGeneralTab.pbRecalculate->setIcon(KIcon("run-build")); + uiGeneralTab.tbConstants->setIcon( QIcon("format-text-symbol") ); + uiGeneralTab.tbFunctions->setIcon( QIcon("preferences-desktop-font") ); + uiGeneralTab.pbRecalculate->setIcon(QIcon("run-build")); = QHBoxLayout* layout =3D new QHBoxLayout(ui.tabGeneral); layout->setMargin(0); diff --git a/src/kdefrontend/spreadsheet/EquidistantValuesDialog.cpp b/src/= kdefrontend/spreadsheet/EquidistantValuesDialog.cpp index 7951370..1642fd4 100644 --- a/src/kdefrontend/spreadsheet/EquidistantValuesDialog.cpp +++ b/src/kdefrontend/spreadsheet/EquidistantValuesDialog.cpp @@ -29,6 +29,7 @@ #include "backend/core/column/Column.h" #include "backend/lib/macros.h" #include "backend/spreadsheet/Spreadsheet.h" +#include = /*! \class EquidistantValuesDialog diff --git a/src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp b/src/= kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp index fc87b96..d0164a9 100644 --- a/src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp +++ b/src/kdefrontend/spreadsheet/ExportSpreadsheetDialog.cpp @@ -33,6 +33,9 @@ #include #include #include +#include +#include +#include = /*! \class ExportSpreadsheetDialog @@ -67,7 +70,7 @@ ExportSpreadsheetDialog::ExportSpreadsheetDialog(QWidget*= parent) : KDialog(pare ui.cbSeparator->addItem(";SPACE"); ui.cbSeparator->addItem(":SPACE"); = - ui.bOpen->setIcon( KIcon("document-open") ); + ui.bOpen->setIcon( QIcon("document-open") ); = setMainWidget( mainWidget ); = @@ -79,7 +82,7 @@ ExportSpreadsheetDialog::ExportSpreadsheetDialog(QWidget*= parent) : KDialog(pare connect(this,SIGNAL(user1Clicked()), this, SLOT(toggleOptions())); = setCaption(i18n("Export spreadsheet")); - setWindowIcon(KIcon("document-export-database")); + setWindowIcon(QIcon("document-export-database")); = KConfigGroup conf(KSharedConfig::openConfig(), "ExportSpreadsheetDialog"); ui.cbFormat->setCurrentIndex(conf.readEntry("Format", 0)); diff --git a/src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp b/src/kde= frontend/spreadsheet/FunctionValuesDialog.cpp index 47f114a..48b2488 100644 --- a/src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp +++ b/src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp @@ -38,6 +38,7 @@ = #include #include +#include = = /*! @@ -60,8 +61,8 @@ FunctionValuesDialog::FunctionValuesDialog(Spreadsheet* s= , QWidget* parent, Qt:: Q_ASSERT(gridLayout); gridLayout->addWidget(cbXDataColumn, 0, 2, 1, 1); = - ui.tbConstants->setIcon( KIcon("format-text-symbol") ); - ui.tbFunctions->setIcon( KIcon("preferences-desktop-font") ); + ui.tbConstants->setIcon( QIcon("format-text-symbol") ); + ui.tbFunctions->setIcon( QIcon("preferences-desktop-font") ); = QStringList vars; vars<<"x"; diff --git a/src/kdefrontend/spreadsheet/RandomValuesDialog.cpp b/src/kdefr= ontend/spreadsheet/RandomValuesDialog.cpp index 3e436e6..c0f141d 100644 --- a/src/kdefrontend/spreadsheet/RandomValuesDialog.cpp +++ b/src/kdefrontend/spreadsheet/RandomValuesDialog.cpp @@ -33,6 +33,7 @@ #include #include #include +#include = /*! \class RandomValuesDialog diff --git a/src/kdefrontend/widgets/ConstantsWidget.cpp b/src/kdefrontend/= widgets/ConstantsWidget.cpp index 3509d33..b0bed4d 100644 --- a/src/kdefrontend/widgets/ConstantsWidget.cpp +++ b/src/kdefrontend/widgets/ConstantsWidget.cpp @@ -37,8 +37,8 @@ */ ConstantsWidget::ConstantsWidget(QWidget *parent): QWidget(parent) { ui.setupUi(this); - ui.bInsert->setIcon(KIcon("edit-paste")); - ui.bCancel->setIcon(KIcon("dialog-cancel")); + ui.bInsert->setIcon(QIcon("edit-paste")); + ui.bCancel->setIcon(QIcon("dialog-cancel")); m_expressionParser =3D ExpressionParser::getInstance(); ui.cbGroup->addItems(m_expressionParser->constantsGroups()); = diff --git a/src/kdefrontend/widgets/FitOptionsWidget.cpp b/src/kdefrontend= /widgets/FitOptionsWidget.cpp index bd9f6ff..7b3a9c8 100644 --- a/src/kdefrontend/widgets/FitOptionsWidget.cpp +++ b/src/kdefrontend/widgets/FitOptionsWidget.cpp @@ -35,8 +35,8 @@ */ FitOptionsWidget::FitOptionsWidget(QWidget *parent, XYFitCurve::FitData* f= itData): QWidget(parent), m_fitData(fitData) { ui.setupUi(this); - ui.pbApply->setIcon(KIcon("dialog-ok-apply")); - ui.pbCancel->setIcon(KIcon("dialog-cancel")); + ui.pbApply->setIcon(QIcon("dialog-ok-apply")); + ui.pbCancel->setIcon(QIcon("dialog-cancel")); = //TODO: show "robust" option when robust fitting is possible // ui.cbRobust->addItem(i18n("on")); diff --git a/src/kdefrontend/widgets/FitParametersWidget.cpp b/src/kdefront= end/widgets/FitParametersWidget.cpp index 7ad2778..9bb431a 100644 --- a/src/kdefrontend/widgets/FitParametersWidget.cpp +++ b/src/kdefrontend/widgets/FitParametersWidget.cpp @@ -27,6 +27,7 @@ *************************************************************************= **/ #include "FitParametersWidget.h" #include +#include = /*! \class FitParametersWidget @@ -38,8 +39,8 @@ */ FitParametersWidget::FitParametersWidget(QWidget* parent, XYFitCurve::FitD= ata* data) : QWidget(parent), m_fitData(data) { ui.setupUi(this); - ui.pbApply->setIcon(KIcon("dialog-ok-apply")); - ui.pbCancel->setIcon(KIcon("dialog-cancel")); + ui.pbApply->setIcon(QIcon("dialog-ok-apply")); + ui.pbCancel->setIcon(QIcon("dialog-cancel")); = ui.tableWidget->setColumnCount(2); = @@ -85,9 +86,9 @@ FitParametersWidget::FitParametersWidget(QWidget* parent,= XYFitCurve::FitData* d ui.tableWidget->setItem(0, 1, new QTableWidgetItem()); } ui.tableWidget->setCurrentCell(0, 0); - ui.pbAdd->setIcon(KIcon("list-add")); + ui.pbAdd->setIcon(QIcon("list-add")); ui.pbAdd->setVisible(true); - ui.pbRemove->setIcon(KIcon("list-remove")); + ui.pbRemove->setIcon(QIcon("list-remove")); ui.pbRemove->setVisible(true); ui.pbRemove->setEnabled(m_fitData->paramNames.size()>1); } diff --git a/src/kdefrontend/widgets/FunctionsWidget.cpp b/src/kdefrontend/= widgets/FunctionsWidget.cpp index 12ac525..5ff877a 100644 --- a/src/kdefrontend/widgets/FunctionsWidget.cpp +++ b/src/kdefrontend/widgets/FunctionsWidget.cpp @@ -37,8 +37,8 @@ */ FunctionsWidget::FunctionsWidget(QWidget *parent): QWidget(parent) { ui.setupUi(this); - ui.bInsert->setIcon(KIcon("edit-paste")); - ui.bCancel->setIcon(KIcon("dialog-cancel")); + ui.bInsert->setIcon(QIcon("edit-paste")); + ui.bCancel->setIcon(QIcon("dialog-cancel")); m_expressionParser =3D ExpressionParser::getInstance(); ui.cbGroup->addItems(m_expressionParser->functionsGroups()); = diff --git a/src/kdefrontend/widgets/LabelWidget.cpp b/src/kdefrontend/widg= ets/LabelWidget.cpp index cb12e24..328f3bc 100644 --- a/src/kdefrontend/widgets/LabelWidget.cpp +++ b/src/kdefrontend/widgets/LabelWidget.cpp @@ -34,134 +34,135 @@ #include = #include +#include #include = /*! - \class LabelWidget - \brief Widget for editing the properties of a TextLabel object, mostly u= sed in an an appropriate dock widget. + \class LabelWidget + \brief Widget for editing the properties of a TextLabel object, mostly= used in an an appropriate dock widget. = - In order the properties of the label to be shown, \c loadConfig() has to= be called with the correspondig KConfigGroup - (settings for a label in *Plot, Axis etc. or for an independent label on= the worksheet). + In order the properties of the label to be shown, \c loadConfig() has = to be called with the correspondig KConfigGroup + (settings for a label in *Plot, Axis etc. or for an independent label = on the worksheet). = - \ingroup kdefrontend + \ingroup kdefrontend */ = // see legacy/LabelWidget.cpp LabelWidget::LabelWidget(QWidget *parent): QWidget(parent), m_dateTimeMenu= (new KMenu(this)) { - ui.setupUi(this); - - m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the firs= t separator to be removed - - QGridLayout* layout =3Dstatic_cast(this->layout()); - layout->setContentsMargins(2,2,2,2); - layout->setHorizontalSpacing(2); - layout->setVerticalSpacing(2); - ui.kcbFontColor->setColor(Qt::black); // default color - - //Icons - ui.tbFontBold->setIcon( KIcon("format-text-bold") ); - ui.tbFontItalic->setIcon( KIcon("format-text-italic") ); - ui.tbFontUnderline->setIcon( KIcon("format-text-underline") ); - ui.tbFontStrikeOut->setIcon( KIcon("format-text-strikethrough") ); - ui.tbFontSuperScript->setIcon( KIcon("format-text-superscript") ); - ui.tbFontSubScript->setIcon( KIcon("format-text-subscript") ); - ui.tbSymbols->setIcon( KIcon("format-text-symbol") ); - ui.tbDateTime->setIcon( KIcon("chronometer") ); - ui.tbTexUsed->setIconSize(QSize(20, 20)); - ui.tbTexUsed->setIcon( KIcon("TeX_logo") ); - - //Positioning and alignment - ui.cbPositionX->addItem(i18n("left")); - ui.cbPositionX->addItem(i18n("center")); - ui.cbPositionX->addItem(i18n("right")); - ui.cbPositionX->addItem(i18n("custom")); - - ui.cbPositionY->addItem(i18n("top")); - ui.cbPositionY->addItem(i18n("center")); - ui.cbPositionY->addItem(i18n("bottom")); - ui.cbPositionY->addItem(i18n("custom")); - - ui.cbHorizontalAlignment->addItem(i18n("left")); - ui.cbHorizontalAlignment->addItem(i18n("center")); - ui.cbHorizontalAlignment->addItem(i18n("right")); - - ui.cbVerticalAlignment->addItem(i18n("top")); - ui.cbVerticalAlignment->addItem(i18n("center")); - ui.cbVerticalAlignment->addItem(i18n("bottom")); - - //SLOTS - // text properties - connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged(bo= ol)) ); - connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged())); - connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)), - this, SLOT(charFormatChanged(QTextCharFormat))); - connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColorCha= nged(QColor))); - connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(= bool))); - connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicChan= ged(bool))); - connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnderli= neChanged(bool))); - connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStrikeO= utChanged(bool))); - connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSuper= ScriptChanged(bool))); - connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubScri= ptChanged(bool))); - connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu())); - connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu())); - connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertDat= eTime(QAction*)) ); - connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fontCh= anged(QFont))); - connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChan= ged(int)) ); - - // geometry - connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(pos= itionXChanged(int)) ); - connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(pos= itionYChanged(int)) ); - connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(customP= ositionXChanged(double)) ); - connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(customP= ositionYChanged(double)) ); - connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), this= , SLOT(horizontalAlignmentChanged(int)) ); - connect( ui.cbVerticalAlignment, SIGNAL(currentIndexChanged(int)), this, = SLOT(verticalAlignmentChanged(int)) ); - connect( ui.sbRotation, SIGNAL(valueChanged(int)), this, SLOT(rotationCha= nged(int)) ); - connect( ui.sbOffset, SIGNAL(valueChanged(double)), this, SLOT(offsetChan= ged(double)) ); - - connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChang= ed(bool)) ); + ui.setupUi(this); + + m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the f= irst separator to be removed + + QGridLayout* layout =3Dstatic_cast(this->layout()); + layout->setContentsMargins(2,2,2,2); + layout->setHorizontalSpacing(2); + layout->setVerticalSpacing(2); + ui.kcbFontColor->setColor(Qt::black); // default color + + //Icons + ui.tbFontBold->setIcon( QIcon("format-text-bold") ); + ui.tbFontItalic->setIcon( QIcon("format-text-italic") ); + ui.tbFontUnderline->setIcon( QIcon("format-text-underline") ); + ui.tbFontStrikeOut->setIcon( QIcon("format-text-strikethrough") ); + ui.tbFontSuperScript->setIcon( QIcon("format-text-superscript") ); + ui.tbFontSubScript->setIcon( QIcon("format-text-subscript") ); + ui.tbSymbols->setIcon( QIcon("format-text-symbol") ); + ui.tbDateTime->setIcon( QIcon("chronometer") ); + ui.tbTexUsed->setIconSize(QSize(20, 20)); + ui.tbTexUsed->setIcon( QIcon("TeX_logo") ); + + //Positioning and alignment + ui.cbPositionX->addItem(i18n("left")); + ui.cbPositionX->addItem(i18n("center")); + ui.cbPositionX->addItem(i18n("right")); + ui.cbPositionX->addItem(i18n("custom")); + + ui.cbPositionY->addItem(i18n("top")); + ui.cbPositionY->addItem(i18n("center")); + ui.cbPositionY->addItem(i18n("bottom")); + ui.cbPositionY->addItem(i18n("custom")); + + ui.cbHorizontalAlignment->addItem(i18n("left")); + ui.cbHorizontalAlignment->addItem(i18n("center")); + ui.cbHorizontalAlignment->addItem(i18n("right")); + + ui.cbVerticalAlignment->addItem(i18n("top")); + ui.cbVerticalAlignment->addItem(i18n("center")); + ui.cbVerticalAlignment->addItem(i18n("bottom")); + + //SLOTS + // text properties + connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged= (bool)) ); + connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged())); + connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)), + this, SLOT(charFormatChanged(QTextCharFormat))); + connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColor= Changed(QColor))); + connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChang= ed(bool))); + connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicC= hanged(bool))); + connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnde= rlineChanged(bool))); + connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStri= keOutChanged(bool))); + connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSu= perScriptChanged(bool))); + connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubS= criptChanged(bool))); + connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu())); + connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu(= ))); + connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insert= DateTime(QAction*)) ); + connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fon= tChanged(QFont))); + connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeC= hanged(int)) ); + + // geometry + connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(= positionXChanged(int)) ); + connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(= positionYChanged(int)) ); + connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(cust= omPositionXChanged(double)) ); + connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(cust= omPositionYChanged(double)) ); + connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), t= his, SLOT(horizontalAlignmentChanged(int)) ); + connect( ui.cbVerticalAlignment, SIGNAL(currentIndexChanged(int)), thi= s, SLOT(verticalAlignmentChanged(int)) ); + connect( ui.sbRotation, SIGNAL(valueChanged(int)), this, SLOT(rotation= Changed(int)) ); + connect( ui.sbOffset, SIGNAL(valueChanged(double)), this, SLOT(offsetC= hanged(double)) ); + + connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityCh= anged(bool)) ); } = void LabelWidget::setLabels(QList labels){ - m_labelsList =3D labels; - m_label =3D labels.first(); + m_labelsList =3D labels; + m_label =3D labels.first(); = - ui.lOffset->hide(); - ui.sbOffset->hide(); + ui.lOffset->hide(); + ui.sbOffset->hide(); = - this->load(); - initConnections(); + this->load(); + initConnections(); } = void LabelWidget::setAxes(QList axes){ - m_labelsList.clear(); - foreach(Axis* axis, axes) { - m_labelsList.append(axis->title()); - connect(axis, SIGNAL(titleOffsetChanged(float)), this, SLOT(labelOffsetC= hanged(float)) ); - connect(axis->title(), SIGNAL(rotationAngleChanged(float)), this, SLOT(l= abelRotationAngleChanged(float)) ); - } + m_labelsList.clear(); + foreach(Axis* axis, axes) { + m_labelsList.append(axis->title()); + connect(axis, SIGNAL(titleOffsetChanged(float)), this, SLOT(labelO= ffsetChanged(float)) ); + connect(axis->title(), SIGNAL(rotationAngleChanged(float)), this, = SLOT(labelRotationAngleChanged(float)) ); + } = - m_axesList =3D axes; - m_label =3D m_labelsList.first(); + m_axesList =3D axes; + m_label =3D m_labelsList.first(); = - this->load(); - initConnections(); + this->load(); + initConnections(); } = void LabelWidget::initConnections() { - connect( m_label, SIGNAL(textWrapperChanged(TextLabel::TextWrapper)), - this, SLOT(labelTextWrapperChanged(TextLabel::TextWrapper)) ); - connect( m_label, SIGNAL(teXFontSizeChanged(int)), - this, SLOT(labelTeXFontSizeChanged(int)) ); - connect( m_label, SIGNAL(teXFontColorChanged(QColor)), - this, SLOT(labelTeXFontColorChanged(QColor)) ); - connect( m_label, SIGNAL(positionChanged(TextLabel::PositionWrapper)), - this, SLOT(labelPositionChanged(TextLabel::PositionWrapper)) ); - connect( m_label, SIGNAL(horizontalAlignmentChanged(TextLabel::Horizontal= Alignment)), - this, SLOT(labelHorizontalAlignmentChanged(TextLabel::HorizontalAlignm= ent)) ); - connect( m_label, SIGNAL(verticalAlignmentChanged(TextLabel::VerticalAlig= nment)), - this, SLOT(labelVerticalAlignmentChanged(TextLabel::VerticalAlignment)= ) ); - connect( m_label, SIGNAL(rotationAngleChanged(float)), this, SLOT(labelRo= tationAngleChanged(float)) ); - connect( m_label, SIGNAL(visibleChanged(bool)), this, SLOT(labelVisibleCh= anged(bool)) ); + connect( m_label, SIGNAL(textWrapperChanged(TextLabel::TextWrapper)), + this, SLOT(labelTextWrapperChanged(TextLabel::TextWrapper)) ); + connect( m_label, SIGNAL(teXFontSizeChanged(int)), + this, SLOT(labelTeXFontSizeChanged(int)) ); + connect( m_label, SIGNAL(teXFontColorChanged(QColor)), + this, SLOT(labelTeXFontColorChanged(QColor)) ); + connect( m_label, SIGNAL(positionChanged(TextLabel::PositionWrapper)), + this, SLOT(labelPositionChanged(TextLabel::PositionWrapper)) = ); + connect( m_label, SIGNAL(horizontalAlignmentChanged(TextLabel::Horizon= talAlignment)), + this, SLOT(labelHorizontalAlignmentChanged(TextLabel::Horizon= talAlignment)) ); + connect( m_label, SIGNAL(verticalAlignmentChanged(TextLabel::VerticalA= lignment)), + this, SLOT(labelVerticalAlignmentChanged(TextLabel::VerticalA= lignment)) ); + connect( m_label, SIGNAL(rotationAngleChanged(float)), this, SLOT(labe= lRotationAngleChanged(float)) ); + connect( m_label, SIGNAL(visibleChanged(bool)), this, SLOT(labelVisibl= eChanged(bool)) ); } = /*! @@ -171,18 +172,18 @@ void LabelWidget::initConnections() { * and the rotation of the label are available. */ void LabelWidget::setFixedLabelMode(const bool b){ - ui.lPositionX->setVisible(!b); - ui.cbPositionX->setVisible(!b); - ui.sbPositionX->setVisible(!b); - ui.lPositionY->setVisible(!b); - ui.cbPositionY->setVisible(!b); - ui.sbPositionY->setVisible(!b); - ui.lHorizontalAlignment->setVisible(!b); - ui.cbHorizontalAlignment->setVisible(!b); - ui.lVerticalAlignment->setVisible(!b); - ui.cbVerticalAlignment->setVisible(!b); - ui.lOffset->setVisible(b); - ui.sbOffset->setVisible(b); + ui.lPositionX->setVisible(!b); + ui.cbPositionX->setVisible(!b); + ui.sbPositionX->setVisible(!b); + ui.lPositionY->setVisible(!b); + ui.cbPositionY->setVisible(!b); + ui.sbPositionY->setVisible(!b); + ui.lHorizontalAlignment->setVisible(!b); + ui.cbHorizontalAlignment->setVisible(!b); + ui.lVerticalAlignment->setVisible(!b); + ui.cbVerticalAlignment->setVisible(!b); + ui.lOffset->setVisible(b); + ui.sbOffset->setVisible(b); } = /*! @@ -190,21 +191,21 @@ void LabelWidget::setFixedLabelMode(const bool b){ * Used when displaying legend's title label. */ void LabelWidget::setNoGeometryMode(const bool b) { - ui.lGeometry->setVisible(!b); - ui.lPositionX->setVisible(!b); - ui.cbPositionX->setVisible(!b); - ui.sbPositionX->setVisible(!b); - ui.lPositionY->setVisible(!b); - ui.cbPositionY->setVisible(!b); - ui.sbPositionY->setVisible(!b); - ui.lHorizontalAlignment->setVisible(!b); - ui.cbHorizontalAlignment->setVisible(!b); - ui.lVerticalAlignment->setVisible(!b); - ui.cbVerticalAlignment->setVisible(!b); - ui.lOffset->setVisible(!b); - ui.sbOffset->setVisible(!b); - ui.lRotation->setVisible(!b); - ui.sbRotation->setVisible(!b); + ui.lGeometry->setVisible(!b); + ui.lPositionX->setVisible(!b); + ui.cbPositionX->setVisible(!b); + ui.sbPositionX->setVisible(!b); + ui.lPositionY->setVisible(!b); + ui.cbPositionY->setVisible(!b); + ui.sbPositionY->setVisible(!b); + ui.lHorizontalAlignment->setVisible(!b); + ui.cbHorizontalAlignment->setVisible(!b); + ui.lVerticalAlignment->setVisible(!b); + ui.cbVerticalAlignment->setVisible(!b); + ui.lOffset->setVisible(!b); + ui.sbOffset->setVisible(!b); + ui.lRotation->setVisible(!b); + ui.sbRotation->setVisible(!b); } = //********************************************************** @@ -214,487 +215,487 @@ void LabelWidget::setNoGeometryMode(const bool b) { // text formating slots = void LabelWidget::textChanged(){ - if (m_initializing) - return; + if (m_initializing) + return; = - if (ui.tbTexUsed->isChecked()) { - QString text=3Dui.teLabel->toPlainText(); - TextLabel::TextWrapper wrapper(text, true); + if (ui.tbTexUsed->isChecked()) { + QString text=3Dui.teLabel->toPlainText(); + TextLabel::TextWrapper wrapper(text, true); = - foreach(TextLabel* label, m_labelsList) - label->setText(wrapper); - }else{ - //save an empty string instead of a html-string with empty body, if no t= ext available in QTextEdit - QString text; - if (ui.teLabel->toPlainText() =3D=3D "") - text =3D ""; - else - text =3D ui.teLabel->toHtml(); + foreach(TextLabel* label, m_labelsList) + label->setText(wrapper); + }else{ + //save an empty string instead of a html-string with empty body, i= f no text available in QTextEdit + QString text; + if (ui.teLabel->toPlainText() =3D=3D "") + text =3D ""; + else + text =3D ui.teLabel->toHtml(); = - TextLabel::TextWrapper wrapper(text, false); - foreach(TextLabel* label, m_labelsList) - label->setText(wrapper); - } + TextLabel::TextWrapper wrapper(text, false); + foreach(TextLabel* label, m_labelsList) + label->setText(wrapper); + } } = void LabelWidget::charFormatChanged(const QTextCharFormat& format){ - if (m_initializing) - return; - - // update button state - if(format.fontWeight() =3D=3D QFont::Bold) - ui.tbFontBold->setChecked(true); - else - ui.tbFontBold->setChecked(false); - ui.tbFontItalic->setChecked(format.fontItalic()); - ui.tbFontUnderline->setChecked(format.fontUnderline()); - if(format.verticalAlignment() =3D=3D QTextCharFormat::AlignSuperScript) - ui.tbFontSuperScript->setChecked(true); - else - ui.tbFontSuperScript->setChecked(false); - if(format.verticalAlignment() =3D=3D QTextCharFormat::AlignSubScript) - ui.tbFontSubScript->setChecked(true); - else - ui.tbFontSubScript->setChecked(false); - ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); - - if(!ui.tbTexUsed->isChecked()) - ui.kcbFontColor->setColor(format.foreground().color()); - ui.kfontRequester->setFont(format.font()); + if (m_initializing) + return; + + // update button state + if(format.fontWeight() =3D=3D QFont::Bold) + ui.tbFontBold->setChecked(true); + else + ui.tbFontBold->setChecked(false); + ui.tbFontItalic->setChecked(format.fontItalic()); + ui.tbFontUnderline->setChecked(format.fontUnderline()); + if(format.verticalAlignment() =3D=3D QTextCharFormat::AlignSuperScript) + ui.tbFontSuperScript->setChecked(true); + else + ui.tbFontSuperScript->setChecked(false); + if(format.verticalAlignment() =3D=3D QTextCharFormat::AlignSubScript) + ui.tbFontSubScript->setChecked(true); + else + ui.tbFontSubScript->setChecked(false); + ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); + + if(!ui.tbTexUsed->isChecked()) + ui.kcbFontColor->setColor(format.foreground().color()); + ui.kfontRequester->setFont(format.font()); } = void LabelWidget::teXUsedChanged(bool checked){ - //hide text editing elements if TeX-option is used - ui.tbFontBold->setVisible(!checked); - ui.tbFontItalic->setVisible(!checked); - ui.tbFontUnderline->setVisible(!checked); - ui.tbFontSuperScript->setVisible(!checked); - ui.tbFontSubScript->setVisible(!checked); - ui.tbFontStrikeOut->setVisible(!checked); - ui.tbSymbols->setVisible(!checked); + //hide text editing elements if TeX-option is used + ui.tbFontBold->setVisible(!checked); + ui.tbFontItalic->setVisible(!checked); + ui.tbFontUnderline->setVisible(!checked); + ui.tbFontSuperScript->setVisible(!checked); + ui.tbFontSubScript->setVisible(!checked); + ui.tbFontStrikeOut->setVisible(!checked); + ui.tbSymbols->setVisible(!checked); = - ui.lFont->setVisible(!checked); - ui.kfontRequester->setVisible(!checked); - ui.lFontSize->setVisible(checked); - ui.sbFontSize->setVisible(checked); + ui.lFont->setVisible(!checked); + ui.kfontRequester->setVisible(!checked); + ui.lFontSize->setVisible(checked); + ui.sbFontSize->setVisible(checked); = - if (m_initializing) - return; + if (m_initializing) + return; = - QString text =3D checked ? ui.teLabel->toPlainText() : ui.teLabel->toHtml= (); - TextLabel::TextWrapper wrapper(text, checked); - foreach(TextLabel* label, m_labelsList) - label->setText(wrapper); + QString text =3D checked ? ui.teLabel->toPlainText() : ui.teLabel->toH= tml(); + TextLabel::TextWrapper wrapper(text, checked); + foreach(TextLabel* label, m_labelsList) + label->setText(wrapper); } = void LabelWidget::fontColorChanged(const QColor& color){ - if (m_initializing) - return; + if (m_initializing) + return; = - ui.teLabel->setTextColor(color); - foreach(TextLabel* label, m_labelsList) - label->setTeXFontColor(color); + ui.teLabel->setTextColor(color); + foreach(TextLabel* label, m_labelsList) + label->setTeXFontColor(color); } = void LabelWidget::fontSizeChanged(int value){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(TextLabel* label, m_labelsList) - label->setTeXFontSize(value); + foreach(TextLabel* label, m_labelsList) + label->setTeXFontSize(value); } = void LabelWidget::fontBoldChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - if(checked) - ui.teLabel->setFontWeight(QFont::Bold); - else - ui.teLabel->setFontWeight(QFont::Normal); + if(checked) + ui.teLabel->setFontWeight(QFont::Bold); + else + ui.teLabel->setFontWeight(QFont::Normal); } = void LabelWidget::fontItalicChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - ui.teLabel->setFontItalic(checked); + ui.teLabel->setFontItalic(checked); } = void LabelWidget::fontUnderlineChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - ui.teLabel->setFontUnderline(checked); + ui.teLabel->setFontUnderline(checked); } = void LabelWidget::fontStrikeOutChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - QTextCharFormat format =3D ui.teLabel->currentCharFormat(); - format.setFontStrikeOut(checked); - ui.teLabel->setCurrentCharFormat(format); + QTextCharFormat format =3D ui.teLabel->currentCharFormat(); + format.setFontStrikeOut(checked); + ui.teLabel->setCurrentCharFormat(format); } = void LabelWidget::fontSuperScriptChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - QTextCharFormat format =3D ui.teLabel->currentCharFormat(); - if (checked) - format.setVerticalAlignment(QTextCharFormat::AlignSuperScript); - else - format.setVerticalAlignment(QTextCharFormat::AlignNormal); + QTextCharFormat format =3D ui.teLabel->currentCharFormat(); + if (checked) + format.setVerticalAlignment(QTextCharFormat::AlignSuperScript); + else + format.setVerticalAlignment(QTextCharFormat::AlignNormal); = - ui.teLabel->setCurrentCharFormat(format); + ui.teLabel->setCurrentCharFormat(format); } = void LabelWidget::fontSubScriptChanged(bool checked){ - if (m_initializing) - return; + if (m_initializing) + return; = - QTextCharFormat format =3D ui.teLabel->currentCharFormat(); - if (checked) - format.setVerticalAlignment(QTextCharFormat::AlignSubScript); - else - format.setVerticalAlignment(QTextCharFormat::AlignNormal); + QTextCharFormat format =3D ui.teLabel->currentCharFormat(); + if (checked) + format.setVerticalAlignment(QTextCharFormat::AlignSubScript); + else + format.setVerticalAlignment(QTextCharFormat::AlignNormal); = - ui.teLabel->setCurrentCharFormat(format); + ui.teLabel->setCurrentCharFormat(format); } = void LabelWidget::fontChanged(const QFont& font){ - if (m_initializing) - return; + if (m_initializing) + return; = - // underline and strike-out not included - ui.teLabel->setFontFamily(font.family()); - ui.teLabel->setFontPointSize(font.pointSize()); - ui.teLabel->setFontItalic(font.italic()); - ui.teLabel->setFontWeight(font.weight()); + // underline and strike-out not included + ui.teLabel->setFontFamily(font.family()); + ui.teLabel->setFontPointSize(font.pointSize()); + ui.teLabel->setFontItalic(font.italic()); + ui.teLabel->setFontWeight(font.weight()); } = void LabelWidget::charMenu(){ - QMenu menu; - KCharSelect selection(this,0,KCharSelect::SearchLine | KCharSelect::Chara= cterTable | KCharSelect::BlockCombos | KCharSelect::HistoryButtons); - selection.setCurrentFont(ui.teLabel->currentFont()); - connect(&selection, SIGNAL(charSelected(QChar)), this, SLOT(insertChar(QC= har))); - connect(&selection, SIGNAL(charSelected(QChar)), &menu, SLOT(close())); + QMenu menu; + KCharSelect selection(this,0,KCharSelect::SearchLine | KCharSelect::Ch= aracterTable | KCharSelect::BlockCombos | KCharSelect::HistoryButtons); + selection.setCurrentFont(ui.teLabel->currentFont()); + connect(&selection, SIGNAL(charSelected(QChar)), this, SLOT(insertChar= (QChar))); + connect(&selection, SIGNAL(charSelected(QChar)), &menu, SLOT(close())); = - QWidgetAction *widgetAction =3D new QWidgetAction(this); - widgetAction->setDefaultWidget(&selection); - menu.addAction(widgetAction); + QWidgetAction *widgetAction =3D new QWidgetAction(this); + widgetAction->setDefaultWidget(&selection); + menu.addAction(widgetAction); = - QPoint pos(-menu.sizeHint().width()+ui.tbSymbols->width(),-menu.sizeHint(= ).height()); - menu.exec(ui.tbSymbols->mapToGlobal(pos)); + QPoint pos(-menu.sizeHint().width()+ui.tbSymbols->width(),-menu.sizeHi= nt().height()); + menu.exec(ui.tbSymbols->mapToGlobal(pos)); } = void LabelWidget::insertChar(QChar c) { - ui.teLabel->insertPlainText(QString(c)); + ui.teLabel->insertPlainText(QString(c)); } = void LabelWidget::dateTimeMenu() { - m_dateTimeMenu->clear(); + m_dateTimeMenu->clear(); = - QDate date =3D QDate::currentDate(); - m_dateTimeMenu->addSeparator()->setText(i18n("Date")); - m_dateTimeMenu->addAction( date.toString(Qt::TextDate) ); - m_dateTimeMenu->addAction( date.toString(Qt::ISODate) ); - m_dateTimeMenu->addAction( date.toString(Qt::TextDate) ); - m_dateTimeMenu->addAction( date.toString(Qt::SystemLocaleShortDate) ); - m_dateTimeMenu->addAction( date.toString(Qt::SystemLocaleLongDate) ); + QDate date =3D QDate::currentDate(); + m_dateTimeMenu->addSeparator()->setText(i18n("Date")); + m_dateTimeMenu->addAction( date.toString(Qt::TextDate) ); + m_dateTimeMenu->addAction( date.toString(Qt::ISODate) ); + m_dateTimeMenu->addAction( date.toString(Qt::TextDate) ); + m_dateTimeMenu->addAction( date.toString(Qt::SystemLocaleShortDate) ); + m_dateTimeMenu->addAction( date.toString(Qt::SystemLocaleLongDate) ); = - QDateTime time =3D QDateTime::currentDateTime(); - m_dateTimeMenu->addSeparator()->setText(i18n("Date and Time")); - m_dateTimeMenu->addAction( time.toString(Qt::TextDate) ); - m_dateTimeMenu->addAction( time.toString(Qt::ISODate) ); - m_dateTimeMenu->addAction( time.toString(Qt::TextDate) ); - m_dateTimeMenu->addAction( time.toString(Qt::SystemLocaleShortDate) ); - m_dateTimeMenu->addAction( time.toString(Qt::SystemLocaleLongDate) ); + QDateTime time =3D QDateTime::currentDateTime(); + m_dateTimeMenu->addSeparator()->setText(i18n("Date and Time")); + m_dateTimeMenu->addAction( time.toString(Qt::TextDate) ); + m_dateTimeMenu->addAction( time.toString(Qt::ISODate) ); + m_dateTimeMenu->addAction( time.toString(Qt::TextDate) ); + m_dateTimeMenu->addAction( time.toString(Qt::SystemLocaleShortDate) ); + m_dateTimeMenu->addAction( time.toString(Qt::SystemLocaleLongDate) ); = - m_dateTimeMenu->exec( mapToGlobal(ui.tbDateTime->rect().bottomLeft())); + m_dateTimeMenu->exec( mapToGlobal(ui.tbDateTime->rect().bottomLeft())); } = void LabelWidget::insertDateTime(QAction* action) { - ui.teLabel->insertPlainText( action->text().remove('&') ); + ui.teLabel->insertPlainText( action->text().remove('&') ); } = // geometry slots = /*! - called when label's current horizontal position relative to its parent (l= eft, center, right, custom ) is changed. + called when label's current horizontal position relative to its parent= (left, center, right, custom ) is changed. */ void LabelWidget::positionXChanged(int index){ - //Enable/disable the spinbox for the x- oordinates if the "custom positio= n"-item is selected/deselected - if (index =3D=3D ui.cbPositionX->count()-1 ){ - ui.sbPositionX->setEnabled(true); - }else{ - ui.sbPositionX->setEnabled(false); - } + //Enable/disable the spinbox for the x- oordinates if the "custom posi= tion"-item is selected/deselected + if (index =3D=3D ui.cbPositionX->count()-1 ){ + ui.sbPositionX->setEnabled(true); + }else{ + ui.sbPositionX->setEnabled(false); + } = - if (m_initializing) - return; + if (m_initializing) + return; = - TextLabel::PositionWrapper position =3D m_label->position(); - position.horizontalPosition =3D TextLabel::HorizontalPosition(index); - foreach(TextLabel* label, m_labelsList) - label->setPosition(position); + TextLabel::PositionWrapper position =3D m_label->position(); + position.horizontalPosition =3D TextLabel::HorizontalPosition(index); + foreach(TextLabel* label, m_labelsList) + label->setPosition(position); } = /*! - called when label's current horizontal position relative to its parent (t= op, center, bottom, custom ) is changed. + called when label's current horizontal position relative to its parent= (top, center, bottom, custom ) is changed. */ void LabelWidget::positionYChanged(int index){ - //Enable/disable the spinbox for the y- oordinates if the "custom positio= n"-item is selected/deselected - if (index =3D=3D ui.cbPositionY->count()-1 ){ - ui.sbPositionY->setEnabled(true); - }else{ - ui.sbPositionY->setEnabled(false); - } + //Enable/disable the spinbox for the y- oordinates if the "custom posi= tion"-item is selected/deselected + if (index =3D=3D ui.cbPositionY->count()-1 ){ + ui.sbPositionY->setEnabled(true); + }else{ + ui.sbPositionY->setEnabled(false); + } = - if (m_initializing) - return; + if (m_initializing) + return; = - TextLabel::PositionWrapper position =3D m_label->position(); - position.verticalPosition =3D TextLabel::VerticalPosition(index); - foreach(TextLabel* label, m_labelsList) - label->setPosition(position); + TextLabel::PositionWrapper position =3D m_label->position(); + position.verticalPosition =3D TextLabel::VerticalPosition(index); + foreach(TextLabel* label, m_labelsList) + label->setPosition(position); } = void LabelWidget::customPositionXChanged(double value){ - if (m_initializing) - return; + if (m_initializing) + return; = - TextLabel::PositionWrapper position =3D m_label->position(); - position.point.setX(Worksheet::convertToSceneUnits(value, Worksheet::Cent= imeter)); - foreach(TextLabel* label, m_labelsList) - label->setPosition(position); + TextLabel::PositionWrapper position =3D m_label->position(); + position.point.setX(Worksheet::convertToSceneUnits(value, Worksheet::C= entimeter)); + foreach(TextLabel* label, m_labelsList) + label->setPosition(position); } = void LabelWidget::customPositionYChanged(double value){ - if (m_initializing) - return; + if (m_initializing) + return; = - TextLabel::PositionWrapper position =3D m_label->position(); - position.point.setY(Worksheet::convertToSceneUnits(value, Worksheet::Cent= imeter)); - foreach(TextLabel* label, m_labelsList) - label->setPosition(position); + TextLabel::PositionWrapper position =3D m_label->position(); + position.point.setY(Worksheet::convertToSceneUnits(value, Worksheet::C= entimeter)); + foreach(TextLabel* label, m_labelsList) + label->setPosition(position); } = void LabelWidget::horizontalAlignmentChanged(int index){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(TextLabel* label, m_labelsList) - label->setHorizontalAlignment(TextLabel::HorizontalAlignment(index)); + foreach(TextLabel* label, m_labelsList) + label->setHorizontalAlignment(TextLabel::HorizontalAlignment(index= )); } = void LabelWidget::verticalAlignmentChanged(int index){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(TextLabel* label, m_labelsList) - label->setVerticalAlignment(TextLabel::VerticalAlignment(index)); + foreach(TextLabel* label, m_labelsList) + label->setVerticalAlignment(TextLabel::VerticalAlignment(index)); } = void LabelWidget::rotationChanged(int value){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(TextLabel* label, m_labelsList) - label->setRotationAngle(value); + foreach(TextLabel* label, m_labelsList) + label->setRotationAngle(value); } = void LabelWidget::offsetChanged(double value){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(Axis* axis, m_axesList) - axis->setTitleOffset( Worksheet::convertToSceneUnits(value, Worksheet::P= oint) ); + foreach(Axis* axis, m_axesList) + axis->setTitleOffset( Worksheet::convertToSceneUnits(value, Worksh= eet::Point) ); } = void LabelWidget::visibilityChanged(bool state){ - if (m_initializing) - return; + if (m_initializing) + return; = - foreach(TextLabel* label, m_labelsList) - label->setVisible(state); + foreach(TextLabel* label, m_labelsList) + label->setVisible(state); } = //********************************************************* //****** SLOTs for changes triggered in TextLabel ********* //********************************************************* void LabelWidget::labelTextWrapperChanged(const TextLabel::TextWrapper& te= xt){ - m_initializing =3D true; + m_initializing =3D true; = - //save and restore the current cursor position after changing the text - QTextCursor cursor =3D ui.teLabel->textCursor(); - int position =3D cursor.position(); - ui.teLabel->setText(text.text); - cursor.movePosition(QTextCursor::Start); - cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, position= ); - ui.teLabel->setTextCursor(cursor); + //save and restore the current cursor position after changing the text + QTextCursor cursor =3D ui.teLabel->textCursor(); + int position =3D cursor.position(); + ui.teLabel->setText(text.text); + cursor.movePosition(QTextCursor::Start); + cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, posit= ion); + ui.teLabel->setTextCursor(cursor); = - ui.tbTexUsed->setChecked(text.teXUsed); - this->teXUsedChanged(text.teXUsed); - m_initializing =3D false; + ui.tbTexUsed->setChecked(text.teXUsed); + this->teXUsedChanged(text.teXUsed); + m_initializing =3D false; } = void LabelWidget::labelTeXFontSizeChanged(const int size){ - m_initializing =3D true; - ui.sbFontSize->setValue(size); - m_initializing =3D false; + m_initializing =3D true; + ui.sbFontSize->setValue(size); + m_initializing =3D false; } = void LabelWidget::labelTeXFontColorChanged(const QColor color){ - m_initializing =3D true; - ui.kcbFontColor->setColor(color); - m_initializing =3D false; + m_initializing =3D true; + ui.kcbFontColor->setColor(color); + m_initializing =3D false; } = void LabelWidget::labelPositionChanged(const TextLabel::PositionWrapper& p= osition){ - m_initializing =3D true; - ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(position.point= .x(), Worksheet::Centimeter) ); - ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(position.point= .y(), Worksheet::Centimeter) ); - ui.cbPositionX->setCurrentIndex( position.horizontalPosition ); - ui.cbPositionY->setCurrentIndex( position.verticalPosition ); - m_initializing =3D false; + m_initializing =3D true; + ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(position.po= int.x(), Worksheet::Centimeter) ); + ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(position.po= int.y(), Worksheet::Centimeter) ); + ui.cbPositionX->setCurrentIndex( position.horizontalPosition ); + ui.cbPositionY->setCurrentIndex( position.verticalPosition ); + m_initializing =3D false; } = void LabelWidget::labelHorizontalAlignmentChanged(TextLabel::HorizontalAli= gnment index){ - m_initializing =3D true; - ui.cbHorizontalAlignment->setCurrentIndex(index); - m_initializing =3D false; + m_initializing =3D true; + ui.cbHorizontalAlignment->setCurrentIndex(index); + m_initializing =3D false; } = void LabelWidget::labelVerticalAlignmentChanged(TextLabel::VerticalAlignme= nt index){ - m_initializing =3D true; - ui.cbVerticalAlignment->setCurrentIndex(index); - m_initializing =3D false; + m_initializing =3D true; + ui.cbVerticalAlignment->setCurrentIndex(index); + m_initializing =3D false; } = void LabelWidget::labelOffsetChanged(float offset){ - m_initializing =3D true; - ui.sbOffset->setValue(Worksheet::convertFromSceneUnits(offset, Worksheet:= :Point)); - m_initializing =3D false; + m_initializing =3D true; + ui.sbOffset->setValue(Worksheet::convertFromSceneUnits(offset, Workshe= et::Point)); + m_initializing =3D false; } = void LabelWidget::labelRotationAngleChanged(float angle){ - m_initializing =3D true; - ui.sbRotation->setValue(angle); - m_initializing =3D false; + m_initializing =3D true; + ui.sbRotation->setValue(angle); + m_initializing =3D false; } = void LabelWidget::labelVisibleChanged(bool on){ - m_initializing =3D true; - ui.chbVisible->setChecked(on); - m_initializing =3D false; + m_initializing =3D true; + ui.chbVisible->setChecked(on); + m_initializing =3D false; } = //********************************************************** //******************** SETTINGS **************************** //********************************************************** void LabelWidget::load() { - if(m_label =3D=3D NULL) - return; + if(m_label =3D=3D NULL) + return; = - m_initializing =3D true; + m_initializing =3D true; = - ui.chbVisible->setChecked( m_label->isVisible() ); + ui.chbVisible->setChecked( m_label->isVisible() ); = - //Text - ui.teLabel->setHtml( m_label->text().text ); - ui.teLabel->selectAll(); - ui.teLabel->setFocus(); - ui.tbTexUsed->setChecked( (bool) m_label->text().teXUsed ); - this->teXUsedChanged(m_label->text().teXUsed); - ui.sbFontSize->setValue( m_label->teXFontSize() ); - if(m_label->text().teXUsed) - ui.kcbFontColor->setColor( m_label->teXFontColor() ); + //Text + ui.teLabel->setHtml( m_label->text().text ); + ui.teLabel->selectAll(); + ui.teLabel->setFocus(); + ui.tbTexUsed->setChecked( (bool) m_label->text().teXUsed ); + this->teXUsedChanged(m_label->text().teXUsed); + ui.sbFontSize->setValue( m_label->teXFontSize() ); + if(m_label->text().teXUsed) + ui.kcbFontColor->setColor( m_label->teXFontColor() ); = - //Set text format - ui.tbFontBold->setChecked(ui.teLabel->fontWeight()=3D=3DQFont::Bold); - ui.tbFontItalic->setChecked(ui.teLabel->fontItalic()); - ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline()); - QTextCharFormat format =3D ui.teLabel->currentCharFormat(); - ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); - ui.tbFontSuperScript->setChecked(format.verticalAlignment() =3D=3D QTextC= harFormat::AlignSuperScript); - ui.tbFontSubScript->setChecked(format.verticalAlignment() =3D=3D QTextCha= rFormat::AlignSubScript); - ui.kfontRequester->setFont(format.font()); + //Set text format + ui.tbFontBold->setChecked(ui.teLabel->fontWeight()=3D=3DQFont::Bold); + ui.tbFontItalic->setChecked(ui.teLabel->fontItalic()); + ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline()); + QTextCharFormat format =3D ui.teLabel->currentCharFormat(); + ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); + ui.tbFontSuperScript->setChecked(format.verticalAlignment() =3D=3D QTe= xtCharFormat::AlignSuperScript); + ui.tbFontSubScript->setChecked(format.verticalAlignment() =3D=3D QText= CharFormat::AlignSubScript); + ui.kfontRequester->setFont(format.font()); = - // Geometry - ui.cbPositionX->setCurrentIndex( (int) m_label->position().horizontalPosi= tion ); - ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(m_label->posit= ion().point.x(),Worksheet::Centimeter) ); - ui.cbPositionY->setCurrentIndex( (int) m_label->position().verticalPositi= on ); - ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(m_label->posit= ion().point.y(),Worksheet::Centimeter) ); + // Geometry + ui.cbPositionX->setCurrentIndex( (int) m_label->position().horizontalP= osition ); + ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(m_label->po= sition().point.x(),Worksheet::Centimeter) ); + ui.cbPositionY->setCurrentIndex( (int) m_label->position().verticalPos= ition ); + ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(m_label->po= sition().point.y(),Worksheet::Centimeter) ); = - if (m_axesList.size()) - ui.sbOffset->setValue( Worksheet::convertFromSceneUnits(m_axesList.first= ()->titleOffset(), Worksheet::Point) ); + if (m_axesList.size()) + ui.sbOffset->setValue( Worksheet::convertFromSceneUnits(m_axesList= .first()->titleOffset(), Worksheet::Point) ); = - ui.cbHorizontalAlignment->setCurrentIndex( (int) m_label->horizontalAlign= ment() ); - ui.cbVerticalAlignment->setCurrentIndex( (int) m_label->verticalAlignment= () ); - ui.sbRotation->setValue( m_label->rotationAngle() ); + ui.cbHorizontalAlignment->setCurrentIndex( (int) m_label->horizontalAl= ignment() ); + ui.cbVerticalAlignment->setCurrentIndex( (int) m_label->verticalAlignm= ent() ); + ui.sbRotation->setValue( m_label->rotationAngle() ); = = - m_initializing =3D false; + m_initializing =3D false; } = void LabelWidget::loadConfig(KConfigGroup &group) { - if(m_label =3D=3D NULL) - return; + if(m_label =3D=3D NULL) + return; = - m_initializing =3D true; + m_initializing =3D true; = - ui.chbVisible->setChecked( group.readEntry("Visible", m_label->isVisible(= )) ); + ui.chbVisible->setChecked( group.readEntry("Visible", m_label->isVisib= le()) ); = - //Text - ui.tbTexUsed->setChecked(group.readEntry("TeXUsed", (bool) m_label->text(= ).teXUsed)); - ui.sbFontSize->setValue( group.readEntry("TeXFontSize", m_label->teXFontS= ize()) ); - if(m_label->text().teXUsed) - ui.kcbFontColor->setColor(group.readEntry("TeXFontColor", m_label->teXFo= ntColor())); + //Text + ui.tbTexUsed->setChecked(group.readEntry("TeXUsed", (bool) m_label->te= xt().teXUsed)); + ui.sbFontSize->setValue( group.readEntry("TeXFontSize", m_label->teXFo= ntSize()) ); + if(m_label->text().teXUsed) + ui.kcbFontColor->setColor(group.readEntry("TeXFontColor", m_label-= >teXFontColor())); = - //Set text format - ui.tbFontBold->setChecked(ui.teLabel->fontWeight()=3D=3DQFont::Bold); - ui.tbFontItalic->setChecked(ui.teLabel->fontItalic()); - ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline()); - QTextCharFormat format =3D ui.teLabel->currentCharFormat(); - ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); - ui.tbFontSuperScript->setChecked(format.verticalAlignment() =3D=3D QTextC= harFormat::AlignSuperScript); - ui.tbFontSubScript->setChecked(format.verticalAlignment() =3D=3D QTextCha= rFormat::AlignSubScript); - ui.kfontRequester->setFont(format.font()); + //Set text format + ui.tbFontBold->setChecked(ui.teLabel->fontWeight()=3D=3DQFont::Bold); + ui.tbFontItalic->setChecked(ui.teLabel->fontItalic()); + ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline()); + QTextCharFormat format =3D ui.teLabel->currentCharFormat(); + ui.tbFontStrikeOut->setChecked(format.fontStrikeOut()); + ui.tbFontSuperScript->setChecked(format.verticalAlignment() =3D=3D QTe= xtCharFormat::AlignSuperScript); + ui.tbFontSubScript->setChecked(format.verticalAlignment() =3D=3D QText= CharFormat::AlignSubScript); + ui.kfontRequester->setFont(format.font()); = - // Geometry - ui.cbPositionX->setCurrentIndex( group.readEntry("PositionX", (int) m_lab= el->position().horizontalPosition ) ); - ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(group.readEntr= y("PositionXValue", m_label->position().point.x()),Worksheet::Centimeter) ); - ui.cbPositionY->setCurrentIndex( group.readEntry("PositionY", (int) m_lab= el->position().verticalPosition ) ); - ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(group.readEntr= y("PositionYValue", m_label->position().point.y()),Worksheet::Centimeter) ); + // Geometry + ui.cbPositionX->setCurrentIndex( group.readEntry("PositionX", (int) m_= label->position().horizontalPosition ) ); + ui.sbPositionX->setValue( Worksheet::convertFromSceneUnits(group.readE= ntry("PositionXValue", m_label->position().point.x()),Worksheet::Centimeter= ) ); + ui.cbPositionY->setCurrentIndex( group.readEntry("PositionY", (int) m_= label->position().verticalPosition ) ); + ui.sbPositionY->setValue( Worksheet::convertFromSceneUnits(group.readE= ntry("PositionYValue", m_label->position().point.y()),Worksheet::Centimeter= ) ); = - if (m_axesList.size()) - ui.sbOffset->setValue( Worksheet::convertFromSceneUnits(group.readEntry(= "Offset", m_axesList.first()->titleOffset()), Worksheet::Point) ); + if (m_axesList.size()) + ui.sbOffset->setValue( Worksheet::convertFromSceneUnits(group.read= Entry("Offset", m_axesList.first()->titleOffset()), Worksheet::Point) ); = - ui.cbHorizontalAlignment->setCurrentIndex( group.readEntry("HorizontalAli= gnment", (int) m_label->horizontalAlignment()) ); - ui.cbVerticalAlignment->setCurrentIndex( group.readEntry("VerticalAlignme= nt", (int) m_label->verticalAlignment()) ); - ui.sbRotation->setValue( group.readEntry("Rotation", m_label->rotationAng= le()) ); + ui.cbHorizontalAlignment->setCurrentIndex( group.readEntry("Horizontal= Alignment", (int) m_label->horizontalAlignment()) ); + ui.cbVerticalAlignment->setCurrentIndex( group.readEntry("VerticalAlig= nment", (int) m_label->verticalAlignment()) ); + ui.sbRotation->setValue( group.readEntry("Rotation", m_label->rotation= Angle()) ); = - m_initializing =3D false; + m_initializing =3D false; } = void LabelWidget::saveConfig(KConfigGroup &group) { - //Text - group.writeEntry("TeXUsed", ui.tbTexUsed->isChecked()); - group.writeEntry("TeXFontColor", ui.kcbFontColor->color()); - group.writeEntry("TeXFontSize", ui.sbFontSize->value()); - - // Geometry - group.writeEntry("PositionX", ui.cbPositionX->currentIndex()); - group.writeEntry("PositionXValue", Worksheet::convertToSceneUnits(ui.sbPo= sitionX->value(),Worksheet::Centimeter) ); - group.writeEntry("PositionY", ui.cbPositionY->currentIndex()); - group.writeEntry("PositionYValue", Worksheet::convertToSceneUnits(ui.sbP= ositionY->value(),Worksheet::Centimeter) ); - - if (m_axesList.size()) - group.writeEntry("Offset", Worksheet::convertToSceneUnits(ui.sbOffset->= value(), Worksheet::Point) ); - - group.writeEntry("HorizontalAlignment", ui.cbHorizontalAlignment->current= Index()); - group.writeEntry("VerticalAlignment", ui.cbVerticalAlignment->currentInde= x()); - group.writeEntry("Rotation", ui.sbRotation->value()); + //Text + group.writeEntry("TeXUsed", ui.tbTexUsed->isChecked()); + group.writeEntry("TeXFontColor", ui.kcbFontColor->color()); + group.writeEntry("TeXFontSize", ui.sbFontSize->value()); + + // Geometry + group.writeEntry("PositionX", ui.cbPositionX->currentIndex()); + group.writeEntry("PositionXValue", Worksheet::convertToSceneUnits(ui.s= bPositionX->value(),Worksheet::Centimeter) ); + group.writeEntry("PositionY", ui.cbPositionY->currentIndex()); + group.writeEntry("PositionYValue", Worksheet::convertToSceneUnits(ui.= sbPositionY->value(),Worksheet::Centimeter) ); + + if (m_axesList.size()) + group.writeEntry("Offset", Worksheet::convertToSceneUnits(ui.sbOf= fset->value(), Worksheet::Point) ); + + group.writeEntry("HorizontalAlignment", ui.cbHorizontalAlignment->curr= entIndex()); + group.writeEntry("VerticalAlignment", ui.cbVerticalAlignment->currentI= ndex()); + group.writeEntry("Rotation", ui.sbRotation->value()); } diff --git a/src/kdefrontend/widgets/LabelWidget.h b/src/kdefrontend/widget= s/LabelWidget.h index 529720f..498de33 100644 --- a/src/kdefrontend/widgets/LabelWidget.h +++ b/src/kdefrontend/widgets/LabelWidget.h @@ -31,6 +31,7 @@ = #include "ui_labelwidget.h" #include "backend/worksheet/TextLabel.h" +#include = class Label; class Axis; diff --git a/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp b/src/kdef= rontend/worksheet/ExportWorksheetDialog.cpp index 0d4d88d..70efa49 100644 --- a/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp +++ b/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp @@ -34,6 +34,8 @@ #include #include #include +#include +#include = /*! \class ExportWorksheetDialog @@ -50,13 +52,13 @@ ExportWorksheetDialog::ExportWorksheetDialog(QWidget* p= arent) : KDialog(parent) KUrlCompletion *comp =3D new KUrlCompletion(); ui.kleFileName->setCompletionObject(comp); = - ui.bOpen->setIcon( KIcon("document-open") ); + ui.bOpen->setIcon( QIcon("document-open") ); = - ui.cbFormat->addItem(KIcon("application-pdf"), "Portable data format (PDF= )"); - ui.cbFormat->addItem(KIcon("image-x-eps"), "Encapsulated PostScript (EPS)= "); - ui.cbFormat->addItem(KIcon("image-svg+xml"), "Scalable Vector Graphics (S= VG)"); + ui.cbFormat->addItem(QIcon("application-pdf"), "Portable data format (= PDF)"); + ui.cbFormat->addItem(QIcon("image-x-eps"), "Encapsulated PostScript (E= PS)"); + ui.cbFormat->addItem(QIcon("image-svg+xml"), "Scalable Vector Graphics= (SVG)"); ui.cbFormat->insertSeparator(3); - ui.cbFormat->addItem(KIcon("image-x-generic"), "Portable Network Graphics= (PNG)"); + ui.cbFormat->addItem(QIcon("image-x-generic"), "Portable Network Graph= ics (PNG)"); = ui.cbExportArea->addItem("Object's bounding box"); ui.cbExportArea->addItem("Current selection"); @@ -81,7 +83,7 @@ ExportWorksheetDialog::ExportWorksheetDialog(QWidget* par= ent) : KDialog(parent) connect(this,SIGNAL(user1Clicked()), this, SLOT(toggleOptions())); = setCaption(i18n("Export worksheet")); - setWindowIcon(KIcon("document-export-database")); + setWindowIcon(QIcon("document-export-database")); = KConfigGroup conf(KSharedConfig::openConfig(), "ExportWorksheetDialog"); ui.cbFormat->setCurrentIndex(conf.readEntry("Format", "").toInt());