[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot/frameworks] /: kdefrontend Ported along with some of backend files ported
From: Alexander Semke <alexander.semke () web ! de>
Date: 2015-02-28 22:03:00
Message-ID: E1YRpTQ-0000jP-H2 () scm ! kde ! org
[Download RAW message or body]
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 Qml Quick \
QuickWidgets Svg Test) +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE \
COMPONENTS Widgets Qml 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 -Wundef \
-Wpointer-arith -W add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
-add_definitions (-DLVERSION='\"2.0.1\"')
+add_definitions (-DLVERSION="2.0.1")
# add_definitions (-DLDEBUG='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_SOURCES} \
${COMMONFRONTEND_SOURCES} ${TOOLS_SOURCES} ${QTMOC_HDRS})
-target_link_libraries(labplot2 KF5::WidgetsAddons KF5::KIOWidgets ${GSL_LIBRARIES} \
${GSL_CBLAS_LIBRARIES}) +target_link_libraries(labplot2 KF5::KDELibs4Support \
KF5::Archive Qt5::Declarative KF5::Declarative KF5::WidgetsAddons KF5::KIOWidgets \
KF5::XmlGui ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES}) # ${OPJ_LIBRARY}
############## installation ################################
diff --git a/src/backend/core/AbstractColumn.cpp \
b/src/backend/core/AbstractColumn.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 <QtXml/QXmlStreamWriter>
+#include <QXmlStreamWriter>
#include <QtCore/QString>
#include <QtCore/QDateTime>
#include <QtCore/QDate>
diff --git a/src/backend/core/AbstractPart.cpp b/src/backend/core/AbstractPart.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, \
SIGNAL(printRequested()));
- menu->addAction(QIcon(KIcon("document-print-preview")), i18n("Print Preview"), \
this, SIGNAL(printPreviewRequested())); + \
menu->addAction(QIcon(QIcon("document-export-database")), i18n("Export"), this, \
SIGNAL(exportRequested())); + menu->addAction(QIcon(QIcon("document-print")), \
i18n("Print"), this, SIGNAL(printRequested())); + \
menu->addAction(QIcon(QIcon("document-print-preview")), i18n("Print 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/AbstractSimpleFilter.cpp index 383834b..0cea557 100644
--- a/src/backend/core/AbstractSimpleFilter.cpp
+++ b/src/backend/core/AbstractSimpleFilter.cpp
@@ -34,7 +34,7 @@
#include <QtCore/QDateTime>
#include <QtCore/QDate>
#include <QtCore/QTime>
-#include <QtXml/QXmlStreamWriter>
+#include <QXmlStreamWriter>
#include "backend/lib/XmlStreamReader.h"
#include <KLocale>
diff --git a/src/backend/core/column/Column.cpp b/src/backend/core/column/Column.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/datasources/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 = new KAction(KIcon("view-refresh"), i18n("Reload"), this);
+ m_reloadAction = new QAction(KIcon("view-refresh"), i18n("Reload"), this);
connect(m_reloadAction, SIGNAL(triggered()), this, SLOT(read()));
- m_toggleWatchAction = new KAction(i18n("Watch the file"), this);
+ m_toggleWatchAction = new QAction(i18n("Watch the file"), this);
m_toggleWatchAction->setCheckable(true);
connect(m_toggleWatchAction, SIGNAL(triggered()), this, SLOT(watchToggled()));
- m_toggleLinkAction = new KAction(i18n("Link the file"), this);
+ m_toggleLinkAction = 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==AsciiVector || m_fileType==AsciiMatrix)
- icon = KIcon("text-plain");
+ icon = QIcon("text-plain");
else if (m_fileType==BinaryVector || m_fileType==BinaryMatrix)
- icon = KIcon("application-octet-stream");
+ icon = QIcon("application-octet-stream");
else if (m_fileType==Image)
- icon = KIcon("image-x-generic");
+ icon = QIcon("image-x-generic");
else if (m_fileType==Sound)
- icon = KIcon("audio-x-generic");
+ icon = 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[] = {
{"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/commonfrontend/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 <QWidget>
+#include <QPrinter>
#include "backend/core/AbstractColumn.h"
#include "backend/lib/IntervalAttribute.h"
diff --git a/src/commonfrontend/worksheet/WorksheetView.h \
b/src/commonfrontend/worksheet/WorksheetView.h index 5a91052..3de4d50 100644
--- a/src/commonfrontend/worksheet/WorksheetView.h
+++ b/src/commonfrontend/worksheet/WorksheetView.h
@@ -32,6 +32,7 @@
#include <QGraphicsView>
#include "backend/worksheet/Worksheet.h"
#include "backend/worksheet/plots/cartesian/CartesianPlot.h"
+#include <QtPrintSupport/QPrinter>
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 <QStackedWidget>
#include <QToolBar>
#include <KDebug>
+#include <KLocalizedString>
/*!
\class GuiObserver
@@ -287,7 +288,7 @@ GuiObserver::GuiObserver(MainWin* mainWin) : \
m_lastCartesianPlot(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/HistoryDialog.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 = stack;
QUndoView* undoView = 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 <KApplication>
+#include <QApplication>
+#include <QCommandLineParser>
#include <KAboutData>
-#include <KCmdLineArgs>
+#include <KLocalizedString>
#include <KStandardDirs>
#include <KSplashScreen>
-#include <KDebug>
+#include <QDebug>
#include <KMessageBox>
#include <QFile>
@@ -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 analysis 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"), \
"alexander.semke@web.de", 0);
- aboutData.addAuthor(ki18n("Andreas Kainz"), ki18n("icon designer"), \
"kainz.a@gmail.com", 0); + KAboutData aboutData( QStringLiteral("LabPlot2"), \
QString("LabPlot2"), + LVERSION,
+ i18n("LabPlot2 is a KDE-application for interactive graphing 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"), "alexander.semke@web.de", 0); + \
aboutData.addAuthor(i18n("Andreas Kainz"), i18n("icon designer"), \
"kainz.a@gmail.com", 0); + KAboutData::setApplicationData(aboutData);
- KApplication app;
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ QApplication app(argc, argv);
+
+ QCommandLineParser parser;
+ QCommandLineOption nosplashOption("no-splash", i18n( "start in fullscreen \
mode")); + parser.addOption(nosplashOption);
+
+ parser.addPositionalArgument("+[file]", i18n( "open a project file"));
+
+ aboutData.setupCommandLine(&parser);
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
+
+ const QStringList args = parser.positionalArguments();
QString filename;
- if (args->count() > 0)
- filename = args->arg(0);
+ if (args.count() > 0)
+ filename = args[0];
if(!filename.isEmpty() ){
if ( !QFile::exists(filename)) {
@@ -83,7 +92,7 @@ int main (int argc, char *argv[]) {
}
KSplashScreen *splash=0;
- if (args->isSet("-splash")) {
+ if (parser.isSet("-splash")) {
QString file = KStandardDirs::locate("appdata", "splash.png");
QPixmap pixmap(file);
splash= 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 <KFilterDev>
/*!
- \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"<<endl;
+ kDebug()<<"write settings"<<endl;
- //write settings
- m_recentProjectsAction->saveEntries( KGlobal::config()->group("Recent Files") );
+ //write settings
+ m_recentProjectsAction->saveEntries( KSharedConfig::openConfig()->group("Recent \
Files") ); // qDebug()<<"SAVED \
m_recentProjectsAction->urls()="<<m_recentProjectsAction->urls()<<endl;
- //etc...
+ //etc...
- KGlobal::config()->sync();
+ KSharedConfig::openConfig()->sync();
- if (m_project!=0){
- m_mdiArea->closeAllSubWindows();
- disconnect(m_project, 0, this, 0);
- delete m_aspectTreeModel;
- delete m_project;
- }
+ if (m_project!=0){
+ m_mdiArea->closeAllSubWindows();
+ disconnect(m_project, 0, this, 0);
+ delete m_aspectTreeModel;
+ delete m_project;
+ }
}
void MainWin::initGUI(const QString& fileName){
- m_mdiArea = 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 LabPlot \
%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 when placing \
a ProgressBar there.
- statusBar()->setFixedHeight(statusBar()->height());
-
- //load recently used projects
- m_recentProjectsAction->loadEntries( KGlobal::config()->group("Recent Files") );
+ m_mdiArea = 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 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()->group("Recent \
Files") ); // qDebug()<<"LOADED \
m_recentProjectsAction->urls()="<<m_recentProjectsAction->urls()<<endl; // \
qDebug()<<"LOADED m_recentProjectsAction->urls().first()="<<m_recentProjectsAction->urls().first()<<endl;
// for(int i=0;i<m_recentProjectsAction->urls().size();i++) {
@@ -153,232 +153,232 @@ void MainWin::initGUI(const QString& fileName){
// qDebug()<<"LOADED \
m_recentProjectsAction->urls().urls("<<i<<")="<<m_recentProjectsAction->urls().at(i)<<endl;
// }
- //set the view mode of the mdi area
- KConfigGroup group = KGlobal::config()->group("General");
- int viewMode = group.readEntry("ViewMode", 0);
- if (viewMode == 1) {
- m_mdiArea->setViewMode(QMdiArea::TabbedView);
- int tabPosition = 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 = group.readEntry<bool>("AutoSave", 0);
- int interval = group.readEntry("AutoSaveInterval", 1);
- interval = 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 = group.readEntry("LoadOnStart", 0);
- if (load == 1) { //create new project
- newProject();
- } else if (load == 2) { //create new project with a worksheet
- newProject();
- newWorksheet();
- } else if (load == 3) { //open last used project
- if (m_recentProjectsAction->urls().size()){
- qDebug()<<"TO OPEN \
m_recentProjectsAction->urls()="<<m_recentProjectsAction->urls().first()<<endl;
- openRecentProject( m_recentProjectsAction->urls().first() );
- }
- }
- }
- updateGUIOnProjectChanges();
+ //set the view mode of the mdi area
+ KConfigGroup group = KSharedConfig::openConfig()->group("General");
+ int viewMode = group.readEntry("ViewMode", 0);
+ if (viewMode == 1) {
+ m_mdiArea->setViewMode(QMdiArea::TabbedView);
+ int tabPosition = 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 = group.readEntry<bool>("AutoSave", 0);
+ int interval = group.readEntry("AutoSaveInterval", 1);
+ interval = 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 = group.readEntry("LoadOnStart", 0);
+ if (load == 1) { //create new project
+ newProject();
+ } else if (load == 2) { //create new project with a worksheet
+ newProject();
+ newWorksheet();
+ } else if (load == 3) { //open last used project
+ if (m_recentProjectsAction->urls().size()){
+ qDebug()<<"TO OPEN \
m_recentProjectsAction->urls()="<<m_recentProjectsAction->urls().first()<<endl; + \
openRecentProject( m_recentProjectsAction->urls().first() ); + }
+ }
+ }
+ updateGUIOnProjectChanges();
}
void MainWin::initActions() {
- KAction* action;
-
- // ******************** File-menu *******************************
- //add some standard actions
- action = KStandardAction::openNew(this, SLOT(newProject()),actionCollection());
- action = KStandardAction::open(this, SLOT(openProject()),actionCollection());
- m_recentProjectsAction = KStandardAction::openRecent(this, \
SLOT(openRecentProject(KUrl)),actionCollection());
- m_closeAction = KStandardAction::close(this, \
SLOT(closeProject()),actionCollection());
- m_saveAction = KStandardAction::save(this, SLOT(saveProject()),actionCollection());
- m_saveAsAction = KStandardAction::saveAs(this, \
SLOT(saveProjectAs()),actionCollection());
- m_printAction = KStandardAction::print(this, SLOT(print()),actionCollection());
- m_printPreviewAction = KStandardAction::printPreview(this, \
SLOT(printPreview()),actionCollection());
- KStandardAction::fullScreen(this, SLOT(toggleFullScreen()), this, \
actionCollection());
-
- //New Folder/Spreadsheet/Worksheet/Datasources
- m_newSpreadsheetAction = new \
KAction(KIcon("insert-table"),i18n("Spreadsheet"),this); + QAction* action;
+
+ // ******************** File-menu *******************************
+ //add some standard actions
+ action = KStandardAction::openNew(this, SLOT(newProject()),actionCollection());
+ action = KStandardAction::open(this, SLOT(openProject()),actionCollection());
+ m_recentProjectsAction = KStandardAction::openRecent(this, \
SLOT(openRecentProject(KUrl)),actionCollection()); + m_closeAction = \
KStandardAction::close(this, SLOT(closeProject()),actionCollection()); + \
m_saveAction = KStandardAction::save(this, SLOT(saveProject()),actionCollection()); + \
m_saveAsAction = KStandardAction::saveAs(this, \
SLOT(saveProjectAs()),actionCollection()); + m_printAction = \
KStandardAction::print(this, SLOT(print()),actionCollection()); + \
m_printPreviewAction = KStandardAction::printPreview(this, \
SLOT(printPreview()),actionCollection()); + KStandardAction::fullScreen(this, \
SLOT(toggleFullScreen()), this, actionCollection()); +
+ //New Folder/Spreadsheet/Worksheet/Datasources
+ m_newSpreadsheetAction = new \
QAction(QIcon("insert-table"),i18n("Spreadsheet"),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_newSpreadsheetAction);
+ connect(m_newSpreadsheetAction, SIGNAL(triggered()),SLOT(newSpreadsheet()));
-// m_newMatrixAction = new KAction(KIcon("insert-table"),i18n("Matrix"),this);
+// m_newMatrixAction = 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= new KAction(KIcon("archive-insert"),i18n("Worksheet"),this);
+ m_newWorksheetAction= new \
QAction(QIcon("archive-insert"),i18n("Worksheet"),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 = new KAction(KIcon("insert-text"),i18n("Note/Script"),this);
+// m_newScriptAction = new QAction(QIcon("insert-text"),i18n("Note/Script"),this);
// actionCollection()->addAction("new_script", m_newScriptAction);
// connect(m_newScriptAction, SIGNAL(triggered()),SLOT(newScript()));
- m_newFolderAction = new KAction(KIcon("folder-new"),i18n("Folder"),this);
- actionCollection()->addAction("new_folder", m_newFolderAction);
- connect(m_newFolderAction, SIGNAL(triggered()),SLOT(newFolder()));
+ m_newFolderAction = new QAction(QIcon("folder-new"),i18n("Folder"),this);
+ actionCollection()->addAction("new_folder", m_newFolderAction);
+ connect(m_newFolderAction, SIGNAL(triggered()),SLOT(newFolder()));
- //"New file datasources"
- m_newFileDataSourceAction = new \
KAction(KIcon("application-octet-stream"),i18n("File Data \
Source"),this);
- actionCollection()->addAction("new_file_datasource", m_newFileDataSourceAction);
- connect(m_newFileDataSourceAction, SIGNAL(triggered()), this, \
SLOT(newFileDataSourceActionTriggered())); + //"New file datasources"
+ m_newFileDataSourceAction = new \
QAction(QIcon("application-octet-stream"),i18n("File Data Source"),this); + \
actionCollection()->addAction("new_file_datasource", m_newFileDataSourceAction); + \
connect(m_newFileDataSourceAction, SIGNAL(triggered()), this, \
SLOT(newFileDataSourceActionTriggered()));
- //"New database datasources"
-// m_newSqlDataSourceAction = new KAction(KIcon("server-database"),i18n("SQL Data \
Source "),this); + //"New database datasources"
+// m_newSqlDataSourceAction = new QAction(QIcon("server-database"),i18n("SQL Data \
Source "),this); // actionCollection()->addAction("new_database_datasource", \
m_newSqlDataSourceAction); // connect(m_newSqlDataSourceAction, \
SIGNAL(triggered()), this, SLOT(newSqlDataSourceActionTriggered()));
- m_importAction = new KAction(KIcon("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 = new KAction(KIcon("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 = KStandardAction::undo(this, SLOT(undo()), actionCollection());
- m_redoAction = KStandardAction::redo(this, SLOT(redo()), actionCollection());
-
- m_historyAction = new KAction(KIcon("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 = 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 = 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 = 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(tileSubWindows()));
-
- m_cascadeWindows = 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(cascadeSubWindows()));
-
- action = 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(activateNextSubWindow()));
-
- action = 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(activatePreviousSubWindow()));
-
- //"Standard actions"
- KStandardAction::preferences(this, SLOT(settingsDialog()), actionCollection());
- KStandardAction::quit(this, SLOT(close()), actionCollection());
-
- //Actions for window visibility
- QActionGroup* windowVisibilityActions = new QActionGroup(this);
- windowVisibilityActions->setExclusive(true);
-
- m_visibilityFolderAction = new KAction(KIcon("folder"), i18n("Current &Folder \
Only"), windowVisibilityActions);
- m_visibilityFolderAction->setCheckable(true);
- m_visibilityFolderAction->setData(Project::folderOnly);
-
- m_visibilitySubfolderAction = new KAction(KIcon("folder-documents"), i18n("Current \
Folder and &Subfolders"), windowVisibilityActions);
- m_visibilitySubfolderAction->setCheckable(true);
- m_visibilitySubfolderAction->setData(Project::folderAndSubfolders);
-
- m_visibilityAllAction = new KAction(i18n("&All"), windowVisibilityActions);
- 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 = new QActionGroup(this);
- docksActions->setExclusive(false);
-
- m_toggleProjectExplorerDockAction = 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_toggleProjectExplorerDockAction);
-
- m_togglePropertiesDockAction = 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_togglePropertiesDockAction);
-
- connect(docksActions, SIGNAL(triggered(QAction*)), this, \
SLOT(toggleDockWidget(QAction*))); + m_importAction = 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 = 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 = KStandardAction::undo(this, SLOT(undo()), actionCollection());
+ m_redoAction = KStandardAction::redo(this, SLOT(redo()), actionCollection());
+
+ m_historyAction = 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 = 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(closeActiveSubWindow()));
+
+ action = 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(closeAllSubWindows()));
+
+ m_tileWindows = 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(tileSubWindows()));
+
+ m_cascadeWindows = 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(cascadeSubWindows())); +
+ action = 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(activateNextSubWindow()));
+
+ action = new QAction(QIcon("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(activatePreviousSubWindow())); +
+ //"Standard actions"
+ KStandardAction::preferences(this, SLOT(settingsDialog()), actionCollection());
+ KStandardAction::quit(this, SLOT(close()), actionCollection());
+
+ //Actions for window visibility
+ QActionGroup* windowVisibilityActions = new QActionGroup(this);
+ windowVisibilityActions->setExclusive(true);
+
+ m_visibilityFolderAction = new QAction(QIcon("folder"), i18n("Current &Folder \
Only"), windowVisibilityActions); + m_visibilityFolderAction->setCheckable(true);
+ m_visibilityFolderAction->setData(Project::folderOnly);
+
+ m_visibilitySubfolderAction = new QAction(QIcon("folder-documents"), \
i18n("Current Folder and &Subfolders"), windowVisibilityActions); + \
m_visibilitySubfolderAction->setCheckable(true); + \
m_visibilitySubfolderAction->setData(Project::folderAndSubfolders); +
+ m_visibilityAllAction = new QAction(i18n("&All"), windowVisibilityActions);
+ 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 = new QActionGroup(this);
+ docksActions->setExclusive(false);
+
+ m_toggleProjectExplorerDockAction = new QAction(QIcon("view-list-tree"), \
i18n("Project explorer"), docksActions); + \
m_toggleProjectExplorerDockAction->setCheckable(true); + \
m_toggleProjectExplorerDockAction->setChecked(true); + \
actionCollection()->addAction("toggle_project_explorer_dock", \
m_toggleProjectExplorerDockAction); +
+ m_togglePropertiesDockAction = 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_togglePropertiesDockAction); +
+ connect(docksActions, SIGNAL(triggered(QAction*)), this, \
SLOT(toggleDockWidget(QAction*))); }
void MainWin::initMenus(){
- //menu for adding new aspects
- m_newMenu = 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 = 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 = 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 = 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" clicked), \c \
false otherwise.
*/
bool MainWin::warnModified() {
- if(m_project->hasChanged()) {
- int want_save = 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 = 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=this->guiFactory();
- if (factory->container("worksheet", this)==NULL) {
- //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 = (m_project==0);
- 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=this->guiFactory();
+ if (factory->container("worksheet", this)==NULL) {
+ //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 = (m_project==0);
+ 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 closed 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=this->guiFactory();
- if (factory->container("worksheet", this)==NULL) {
- //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 the first time
- //(no subgroup in the group "MainWindow" available)
- //TODO: is this the usual behaviour for toolbars defined in the rc-file?
- KConfigGroup group = KGlobal::config()->group("MainWindow");
-
- Worksheet* w = this->activeWorksheet();
- if (w!=0){
- //enable worksheet related menus
- factory->container("worksheet", this)->setEnabled(true);
+ if (m_closing)
+ return;
+
+ KXMLGUIFactory* factory=this->guiFactory();
+ if (factory->container("worksheet", this)==NULL) {
+ //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 the first time + //(no subgroup in the group "MainWindow" \
available) + //TODO: is this the usual behaviour for toolbars defined in the \
rc-file? + KConfigGroup group = KSharedConfig::openConfig()->group("MainWindow");
+
+ Worksheet* w = this->activeWorksheet();
+ if (w!=0){
+ //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=qobject_cast<WorksheetView*>(w->view());
- QMenu* menu=qobject_cast<QMenu*>(factory->container("worksheet", this));
- menu->clear();
- view->createContextMenu(menu);
-
- //populate worksheet-toolbar
- QToolBar* toolbar=qobject_cast<QToolBar*>(factory->container("worksheet_toolbar", \
this));
- if (group.groupList().indexOf("Toolbar worksheet_toolbar")==-1)
- toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting());
-
- toolbar->setVisible(true);
- toolbar->clear();
- view->fillToolBar(toolbar);
-
- //populate the toolbar for cartesian plots
- toolbar=qobject_cast<QToolBar*>(factory->container("cartesian_plot_toolbar", \
this));
- if (group.groupList().indexOf("Toolbar cartesian_plot_toolbar")==-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);
+ //populate worksheet-menu
+ WorksheetView* view=qobject_cast<WorksheetView*>(w->view());
+ QMenu* menu=qobject_cast<QMenu*>(factory->container("worksheet", this));
+ menu->clear();
+ view->createContextMenu(menu);
+
+ //populate worksheet-toolbar
+ QToolBar* toolbar=qobject_cast<QToolBar*>(factory->container("worksheet_toolbar", \
this)); +// if (group.groupList().indexOf("Toolbar worksheet_toolbar")==-1)
+// toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting());
+
+ toolbar->setVisible(true);
+ toolbar->clear();
+ view->fillToolBar(toolbar);
+
+ //populate the toolbar for cartesian plots
+ toolbar=qobject_cast<QToolBar*>(factory->container("cartesian_plot_toolbar", \
this)); +// if (group.groupList().indexOf("Toolbar \
cartesian_plot_toolbar")==-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(false);
- //Handle the Spreadsheet-object
- Spreadsheet* spreadsheet = this->activeSpreadsheet();
- if (spreadsheet){
- //enable spreadsheet related menus
+ //Handle the Spreadsheet-object
+ Spreadsheet* spreadsheet = 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=qobject_cast<SpreadsheetView*>(spreadsheet->view());
- QMenu* menu=qobject_cast<QMenu*>(factory->container("spreadsheet", this));
- menu->clear();
- view->createContextMenu(menu);
-
- //populate spreadsheet-toolbar
- QToolBar* toolbar=qobject_cast<QToolBar*>(factory->container("spreadsheet_toolbar", \
this));
- if (group.groupList().indexOf("Toolbar spreadsheet_toolbar")==-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=qobject_cast<SpreadsheetView*>(spreadsheet->view()); + QMenu* \
menu=qobject_cast<QMenu*>(factory->container("spreadsheet", this)); + \
menu->clear(); + view->createContextMenu(menu);
+
+ //populate spreadsheet-toolbar
+ QToolBar* \
toolbar=qobject_cast<QToolBar*>(factory->container("spreadsheet_toolbar", this)); +// \
if (group.groupList().indexOf("Toolbar spreadsheet_toolbar")==-1) +// \
toolbar->setToolButtonStyle(KToolBar::toolButtonStyleSetting()); +
+ toolbar->setVisible(true);
+ toolbar->clear();
+ view->fillToolBar(toolbar);
+ }else{
+ //no spreadsheet selected -> deactivate spreadsheet related menus
// 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(false);
+ }
+ }
}
/*!
- creates a new empty project. Returns \c true, if a new project was created.
+ creates a new empty project. Returns \c true, if a new project was created.
*/
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 = new Project();
- m_currentAspect = m_project;
- m_currentFolder = m_project;
-
- KConfigGroup group = KGlobal::config()->group("General");
- Project::MdiWindowVisibility vis = \
Project::MdiWindowVisibility(group.readEntry("MdiWindowVisibility", \
0));
- m_project->setMdiWindowVisibility( vis );
- if (vis == Project::folderOnly)
- m_visibilityFolderAction->setChecked(true);
- else if (vis == Project::folderAndSubfolders)
- m_visibilitySubfolderAction->setChecked(true);
- else
- m_visibilityAllAction->setChecked(true);
-
- m_aspectTreeModel = new AspectTreeModel(m_project, this);
-
- //newProject is called for the first time, there is no project explorer yet
- //-> initialize the project explorer, the GUI-observer and the dock widgets.
- if ( m_projectExplorer==0 ){
- m_projectExplorerDock = new QDockWidget(this);
- m_projectExplorerDock->setObjectName("projectexplorer");
- m_projectExplorerDock->setWindowTitle(i18n("Project Explorer"));
- addDockWidget(Qt::LeftDockWidgetArea, m_projectExplorerDock);
-
- m_projectExplorer = new ProjectExplorer(m_projectExplorerDock);
- m_projectExplorerDock->setWidget(m_projectExplorer);
-
- connect(m_projectExplorer, SIGNAL(currentAspectChanged(AbstractAspect*)),
- this, SLOT(handleCurrentAspectChanged(AbstractAspect*)));
-
- //Properties dock
- m_propertiesDock = new QDockWidget(this);
- m_propertiesDock->setObjectName("aspect_properties_dock");
- m_propertiesDock->setWindowTitle(i18n("Properties"));
- addDockWidget(Qt::RightDockWidgetArea, m_propertiesDock);
-
- stackedWidget = new QStackedWidget(m_propertiesDock);
- m_propertiesDock->setWidget(stackedWidget);
-
- //GUI-observer;
- m_guiObserver = 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 \
AbstractAspect*,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(showMessage(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(updateMdiWindowVisibility()));
-
- m_undoViewEmptyLabel = 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 = new Project();
+ m_currentAspect = m_project;
+ m_currentFolder = m_project;
+
+ KConfigGroup group = KSharedConfig::openConfig()->group("General");
+ Project::MdiWindowVisibility vis = \
Project::MdiWindowVisibility(group.readEntry("MdiWindowVisibility", 0)); + \
m_project->setMdiWindowVisibility( vis ); + if (vis == Project::folderOnly)
+ m_visibilityFolderAction->setChecked(true);
+ else if (vis == Project::folderAndSubfolders)
+ m_visibilitySubfolderAction->setChecked(true);
+ else
+ m_visibilityAllAction->setChecked(true);
+
+ m_aspectTreeModel = new AspectTreeModel(m_project, this);
+
+ //newProject is called for the first time, there is no project explorer yet
+ //-> initialize the project explorer, the GUI-observer and the dock widgets.
+ if ( m_projectExplorer==0 ){
+ m_projectExplorerDock = new QDockWidget(this);
+ m_projectExplorerDock->setObjectName("projectexplorer");
+ m_projectExplorerDock->setWindowTitle(i18n("Project Explorer"));
+ addDockWidget(Qt::LeftDockWidgetArea, m_projectExplorerDock);
+
+ m_projectExplorer = new ProjectExplorer(m_projectExplorerDock);
+ m_projectExplorerDock->setWidget(m_projectExplorer);
+
+ connect(m_projectExplorer, SIGNAL(currentAspectChanged(AbstractAspect*)),
+ this, SLOT(handleCurrentAspectChanged(AbstractAspect*)));
+
+ //Properties dock
+ m_propertiesDock = new QDockWidget(this);
+ m_propertiesDock->setObjectName("aspect_properties_dock");
+ m_propertiesDock->setWindowTitle(i18n("Properties"));
+ addDockWidget(Qt::RightDockWidgetArea, m_propertiesDock);
+
+ stackedWidget = new QStackedWidget(m_propertiesDock);
+ m_propertiesDock->setWidget(stackedWidget);
+
+ //GUI-observer;
+ m_guiObserver = 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 AbstractAspect*,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(showMessage(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(updateMdiWindowVisibility())); +
+ m_undoViewEmptyLabel = i18n("Project %1 created", m_project->name());
+ setCaption(m_project->name());
+
+ return true;
}
void MainWin::openProject(){
- KConfigGroup conf(KSharedConfig::openConfig(), "MainWin");
- QString dir = conf.readEntry("LastOpenDir", "");
- QString path = KFileDialog::getOpenFileName(KUrl(dir),
- i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.GZ \
*.LML.BZ2)"),
- this, i18n("Open project"));
-
- if (!path.isEmpty()) {
- this->openProject(path);
-
- int pos = path.lastIndexOf(QDir::separator());
- if (pos!=-1) {
- QString newDir = path.left(pos);
- if (newDir!=dir)
- conf.writeEntry("LastOpenDir", newDir);
- }
- }
+ KConfigGroup conf(KSharedConfig::openConfig(), "MainWin");
+ QString dir = conf.readEntry("LastOpenDir", "");
+ QString path = QFileDialog::getOpenFileName(this,i18n("Open project"), dir,
+ i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.GZ \
*.LML.BZ2)")); +
+ if (!path.isEmpty()) {
+ this->openProject(path);
+
+ int pos = path.lastIndexOf(QDir::separator());
+ if (pos!=-1) {
+ QString newDir = path.left(pos);
+ if (newDir!=dir)
+ conf.writeEntry("LastOpenDir", newDir);
+ }
+ }
}
void MainWin::openProject(const QString& filename) {
- if (filename == m_currentFileName) {
- KMessageBox::information(this,
- i18n("The project file %1 is already opened.", filename),i18n("Open project"));
- return;
- }
-
- QIODevice *file = KFilterDev::deviceForFile(filename,"application/x-gzip",true);
- if (file==0)
- file = 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 == m_currentFileName) {
+ KMessageBox::information(this,
+ i18n("The project file %1 is already opened.", filename),i18n("Open \
project")); + return;
+ }
+
+ QIODevice *file = KFilterDev::deviceForFile(filename,"application/x-gzip",true);
+ if (file==0)
+ file = 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.
// char* c;
// bool rc = 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 = openXML(file);
- file->close();
- delete file;
- if (!rc) {
- closeProject();
- return;
- }
-
- m_currentFileName = filename;
- m_project->setFileName(filename);
- m_project->undoStack()->clear();
- m_undoViewEmptyLabel = 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 \
seconds).").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 = openXML(file);
+ file->close();
+ delete file;
+ if (!rc) {
+ closeProject();
+ return;
+ }
+
+ m_currentFileName = filename;
+ m_project->setFileName(filename);
+ m_project->undoStack()->clear();
+ m_undoViewEmptyLabel = 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 the open \
project -> update the GUI + m_saveAction->setEnabled(false);
+
+ statusBar()->showMessage( i18n("Project successfully opened (in %1 \
seconds).").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) == false) {
- RESET_CURSOR;
- kDebug()<<"ERROR: reading file content"<<endl;
- QString msg_text = reader.errorString();
- KMessageBox::error(this, msg_text, i18n("Error opening project"));
- statusBar()->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) == false) {
+ RESET_CURSOR;
+ kDebug()<<"ERROR: reading file content"<<endl;
+ QString msg_text = reader.errorString();
+ KMessageBox::error(this, msg_text, i18n("Error opening project"));
+ statusBar()->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 = i18n("The following problems occurred when loading the \
project:\n"); // QStringList warnings = 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 project \
was closed.
*/
bool MainWin::closeProject(){
- if (m_project==0)
- return true; //nothing to close
+ if (m_project==0)
+ return true; //nothing to close
// int b = KMessageBox::warningYesNo( this,
// i18n("The current project %1 will be closed. Do you want to continue?", \
m_project->name()), @@ -735,171 +734,168 @@ bool MainWin::closeProject(){
// if (b==KMessageBox::No)
// return false;
- if(warnModified())
- return false;
-
- delete m_aspectTreeModel;
- m_aspectTreeModel=0;
- delete m_project;
- m_project=0;
- m_currentFileName = "";
-
- //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=0;
- m_currentFolder=0;
- updateGUIOnProjectChanges();
-
- if (m_autoSaveActive)
- m_autoSaveTimer.stop();
- }
-
- return true;
+ if(warnModified())
+ return false;
+
+ delete m_aspectTreeModel;
+ m_aspectTreeModel=0;
+ delete m_project;
+ m_project=0;
+ m_currentFileName = "";
+
+ //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=0;
+ m_currentFolder=0;
+ updateGUIOnProjectChanges();
+
+ if (m_autoSaveActive)
+ m_autoSaveTimer.stop();
+ }
+
+ return true;
}
bool MainWin::saveProject() {
- const QString& fileName = m_project->fileName();
- if(fileName.isEmpty())
- return saveProjectAs();
- else
- return save(fileName);
+ const QString& fileName = m_project->fileName();
+ if(fileName.isEmpty())
+ return saveProjectAs();
+ else
+ return save(fileName);
}
bool MainWin::saveProjectAs() {
- KConfigGroup conf(KSharedConfig::openConfig(), "MainWin");
- QString dir = conf.readEntry("LastOpenDir", "");
- QString fileName = KFileDialog::getSaveFileName(KUrl(dir),
- i18n("LabPlot Projects (*.lml *.lml.gz *.lml.bz2 *.LML *.LML.GZ \
*.LML.BZ2)"),
- this, i18n("Save project as"));
+ QString fileName = QFileDialog::getSaveFileName(this, i18n("Save project \
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) == false )
- fileName.append(".lml");
+ if( fileName.contains(QString(".lml"),Qt::CaseInsensitive) == false )
+ 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 = KFilterDev::deviceForFile(fileName, "application/x-gzip", true);
- if (file == 0)
- file = 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 = true;
-
- //if the project dock is visible, refresh the shown content
- //(version and modification time might have been changed)
- if (stackedWidget->currentWidget() == 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 = false;
- }
-
- if (file != 0)
- delete file;
-
- RESET_CURSOR;
- return ok;
+ WAIT_CURSOR;
+ QIODevice* file = KFilterDev::deviceForFile(fileName, "application/x-gzip", \
true); + if (file == 0)
+ file = 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 = true;
+
+ //if the project dock is visible, refresh the shown content
+ //(version and modification time might have been changed)
+ if (stackedWidget->currentWidget() == 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 = false;
+ }
+
+ if (file != 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=this->activeWorksheet();
- if (w!=0){ //worksheet
- QPrintDialog *dialog = new QPrintDialog(&printer, this);
- dialog->setWindowTitle(i18n("Print worksheet"));
- if (dialog->exec() != QDialog::Accepted)
- return;
-
- WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
- view->print(&printer);
- statusBar()->showMessage(i18n("Worksheet printed"));
- }else{
- //Spreadsheet
- Spreadsheet* s=this->activeSpreadsheet();
- QPrintDialog *dialog = new QPrintDialog(&printer, this);
- dialog->setWindowTitle(i18n("Print spreadsheet"));
- if (dialog->exec() != QDialog::Accepted)
- return;
-
- SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
- view->print(&printer);
-
- statusBar()->showMessage(i18n("Spreadsheet printed"));
- }
+ QPrinter printer;
+
+ //determine first, whether we want to export a worksheet or a spreadsheet
+ Worksheet* w=this->activeWorksheet();
+ if (w!=0){ //worksheet
+ QPrintDialog *dialog = new QPrintDialog(&printer, this);
+ dialog->setWindowTitle(i18n("Print worksheet"));
+ if (dialog->exec() != QDialog::Accepted)
+ return;
+
+ WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
+ view->print(&printer);
+ statusBar()->showMessage(i18n("Worksheet printed"));
+ }else{
+ //Spreadsheet
+ Spreadsheet* s=this->activeSpreadsheet();
+ QPrintDialog *dialog = new QPrintDialog(&printer, this);
+ dialog->setWindowTitle(i18n("Print spreadsheet"));
+ if (dialog->exec() != QDialog::Accepted)
+ return;
+
+ SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
+ view->print(&printer);
+
+ statusBar()->showMessage(i18n("Spreadsheet printed"));
+ }
}
void MainWin::printPreview(){
- Worksheet* w=this->activeWorksheet();
- if (w!=0){ //worksheet
- WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
- QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
- connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(print(QPrinter*)));
- dialog->exec();
- }else{
- //Spreadsheet
- Spreadsheet* s=this->activeSpreadsheet();
- if (s!=0){
- SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
- QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
- connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, SLOT(print(QPrinter*)));
- dialog->exec();
- }
- }
+ Worksheet* w=this->activeWorksheet();
+ if (w!=0){ //worksheet
+ WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
+ QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
+ connect(dialog, SIGNAL(paintRequested(QPrinter*)), view, \
SLOT(print(QPrinter*))); + dialog->exec();
+ }else{
+ //Spreadsheet
+ Spreadsheet* s=this->activeSpreadsheet();
+ if (s!=0){
+ SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
+ QPrintPreviewDialog *dialog = 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 = new Spreadsheet(0, i18n("Spreadsheet"));
- spreadsheet->initDefault();
- this->addAspectToProject(spreadsheet);
+ Spreadsheet* spreadsheet = 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 = new Spreadsheet(0, name);
- spreadsheet->initDefault();
- this->addAspectToProject(spreadsheet);
+ Spreadsheet* spreadsheet = new Spreadsheet(0, name);
+ spreadsheet->initDefault();
+ this->addAspectToProject(spreadsheet);
- std::auto_ptr<QAbstractItemModel> model(new AspectTreeModel(m_project, this));
- m_importFileDialog->updateModel( model );
+ std::auto_ptr<QAbstractItemModel> 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->currentIndex());
}
/*!
- adds a new Worksheet to the project.
+ adds a new Worksheet to the project.
*/
void MainWin::newWorksheet() {
- Worksheet* worksheet= new Worksheet(0, i18n("Worksheet"));
- this->addAspectToProject(worksheet);
+ Worksheet* worksheet= new Worksheet(0, i18n("Worksheet"));
+ this->addAspectToProject(worksheet);
}
/*!
- returns a pointer to a Spreadsheet-object, if the currently active Mdi-Subwindow 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 = m_mdiArea->currentSubWindow();
- if (!win)
- return 0;
+ QMdiSubWindow* win = m_mdiArea->currentSubWindow();
+ if (!win)
+ return 0;
- AbstractPart* part = dynamic_cast<PartMdiView*>(win)->part();
- Q_ASSERT(part);
- return dynamic_cast<Spreadsheet*>(part);
+ AbstractPart* part = dynamic_cast<PartMdiView*>(win)->part();
+ Q_ASSERT(part);
+ return dynamic_cast<Spreadsheet*>(part);
}
/*!
- returns a pointer to a Worksheet-object, if the currently active Mdi-Subwindow is \
\a WorksheetView
- Otherwise returns \a 0.
+ returns a pointer to a Worksheet-object, if the currently active Mdi-Subwindow \
is \a WorksheetView + Otherwise returns \a 0.
*/
Worksheet* MainWin::activeWorksheet() const{
- QMdiSubWindow* win = m_mdiArea->currentSubWindow();
- if (!win)
- return 0;
+ QMdiSubWindow* win = m_mdiArea->currentSubWindow();
+ if (!win)
+ return 0;
- AbstractPart* part = dynamic_cast<PartMdiView*>(win)->part();
- Q_ASSERT(part);
- return dynamic_cast<Worksheet*>(part);
+ AbstractPart* part = dynamic_cast<PartMdiView*>(win)->part();
+ Q_ASSERT(part);
+ return dynamic_cast<Worksheet*>(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 = qobject_cast<PartMdiView*>(win);
- if (!view)
- return;
-
- if (view == m_currentSubWindow){
- //do nothing, if the current sub-window gets selected again.
- //This event happens, when labplot loses the focus (modal window is opened 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 = view;
- }
-
- updateGUI();
- if (!m_suppressCurrentSubWindowChangedEvent)
- m_projectExplorer->setCurrentAspect(view->part());
+ PartMdiView *view = qobject_cast<PartMdiView*>(win);
+ if (!view)
+ return;
+
+ if (view == m_currentSubWindow){
+ //do nothing, if the current sub-window gets selected again.
+ //This event happens, when labplot loses the focus (modal window is opened \
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 = view;
+ }
+
+ updateGUI();
+ if (!m_suppressCurrentSubWindowChangedEvent)
+ m_projectExplorer->setCurrentAspect(view->part());
}
void MainWin::handleAspectAdded(const AbstractAspect* aspect) {
- const AbstractPart* part = dynamic_cast<const AbstractPart*>(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(handleShowSubWindowRequested()));
- }
+ const AbstractPart* part = dynamic_cast<const AbstractPart*>(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(handleShowSubWindowRequested())); + }
}
void MainWin::handleAspectRemoved(const AbstractAspect *parent){
- m_projectExplorer->setCurrentAspect(parent);
+ m_projectExplorer->setCurrentAspect(parent);
}
void MainWin::handleAspectAboutToBeRemoved(const AbstractAspect *aspect){
- const AbstractPart *part = qobject_cast<const AbstractPart*>(aspect);
- if (!part) return;
- PartMdiView *win = part->mdiSubWindow();
- Q_ASSERT(win);
- disconnect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)),
- this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)));
- m_mdiArea->removeSubWindow(win);
- updateGUI();
+ const AbstractPart *part = qobject_cast<const AbstractPart*>(aspect);
+ if (!part) return;
+ PartMdiView *win = part->mdiSubWindow();
+ Q_ASSERT(win);
+ disconnect(win, \
SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)),
+ this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWindowStatus,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 = m_project; // should never happen, just in case
+ if (!aspect)
+ aspect = m_project; // should never happen, just in case
- m_suppressCurrentSubWindowChangedEvent = true;
- if(aspect->folder() != m_currentFolder) {
- m_currentFolder = aspect->folder();
- updateMdiWindowVisibility();
- }
+ m_suppressCurrentSubWindowChangedEvent = true;
+ if(aspect->folder() != m_currentFolder) {
+ m_currentFolder = aspect->folder();
+ updateMdiWindowVisibility();
+ }
- m_currentAspect = aspect;
+ m_currentAspect = aspect;
- //activate the corresponding MDI sub window for the current aspect
- activateSubWindowForAspect(aspect);
- m_suppressCurrentSubWindowChangedEvent = false;
+ //activate the corresponding MDI sub window for the current aspect
+ activateSubWindowForAspect(aspect);
+ m_suppressCurrentSubWindowChangedEvent = false;
}
void MainWin::activateSubWindowForAspect(const AbstractAspect* aspect) const {
- const AbstractPart* part = dynamic_cast<const AbstractPart*>(aspect);
- if (part) {
- if (dynamic_cast<const FileDataSource*>(part))
- return;
-
- PartMdiView* win = part->mdiSubWindow();
- if (m_mdiArea->subWindowList().indexOf(win) == -1) {
- m_mdiArea->addSubWindow(win);
- connect(win, SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)),
- this, SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)));
- }
- win->show();
- m_mdiArea->setActiveSubWindow(win);
- } else {
- AbstractAspect* parent = aspect->parentAspect();
- if (parent)
- activateSubWindowForAspect(parent);
- }
- return;
+ const AbstractPart* part = dynamic_cast<const AbstractPart*>(aspect);
+ if (part) {
+ if (dynamic_cast<const FileDataSource*>(part))
+ return;
+
+ PartMdiView* win = part->mdiSubWindow();
+ if (m_mdiArea->subWindowList().indexOf(win) == -1) {
+ m_mdiArea->addSubWindow(win);
+ connect(win, \
SIGNAL(statusChanged(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)),
+ this, \
SLOT(handleSubWindowStatusChange(PartMdiView*,PartMdiView::SubWindowStatus,PartMdiView::SubWindowStatus)));
+ }
+ win->show();
+ m_mdiArea->setActiveSubWindow(win);
+ } else {
+ AbstractAspect* parent = 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 == m_mdiArea->currentSubWindow()) {
- updateGUI();
- }
+ Q_UNUSED(from);
+ Q_UNUSED(to);
+ if (view == m_mdiArea->currentSubWindow()) {
+ updateGUI();
+ }
}
void MainWin::setMdiWindowVisibility(QAction * action){
- m_project->setMdiWindowVisibility((Project::MdiWindowVisibility)(action->data().toInt()));
+ m_project->setMdiWindowVisibility((Project::MdiWindowVisibility)(action->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 = new Folder(i18n("Folder %1", 1));
- this->addAspectToProject(folder);
+ Folder * folder = 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 explorer
*/
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() != QMdiArea::TabbedView)
- menu->addMenu(m_visibilityMenu);
+ //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() != QMdiArea::TabbedView)
+ menu->addMenu(m_visibilityMenu);
}
/*!
- this is called on a right click on a non-root folder in the project explorer
+ this is called on a right click on a non-root folder in the project explorer
*/
void MainWin::createFolderContextMenu(const Folder* folder, QMenu* menu) const{
- Q_UNUSED(folder);
+ Q_UNUSED(folder);
- //Folder provides it's own context menu. Add a separator before adding additional \
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()==0) {
- 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()==0) {
+ 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() == m_project->undoStack()->count())
- m_redoAction->setEnabled(false);
- RESET_CURSOR;
+ WAIT_CURSOR;
+ m_project->undoStack()->redo();
+ projectChanged();
+ if (m_project->undoStack()->index() == m_project->undoStack()->count())
+ 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<QMdiSubWindow *> windows = m_mdiArea->subWindowList();
- PartMdiView * part_view;
- switch(m_project->mdiWindowVisibility()){
- case Project::allMdiWindows:
- foreach(QMdiSubWindow *window, windows){
- part_view = qobject_cast<PartMdiView *>(window);
- Q_ASSERT(part_view);
- part_view->show();
- }
- break;
- case Project::folderOnly:
- foreach(QMdiSubWindow *window, windows){
- part_view = qobject_cast<PartMdiView *>(window);
- Q_ASSERT(part_view);
- if(part_view->part()->folder() == m_currentFolder)
- part_view->show();
- else
- part_view->hide();
- }
- break;
- case Project::folderAndSubfolders:
- foreach(QMdiSubWindow *window, windows){
- part_view = qobject_cast<PartMdiView *>(window);
- if(part_view->part()->isDescendantOf(m_currentFolder))
- part_view->show();
- else
- part_view->hide();
- }
- break;
- }
+ QList<QMdiSubWindow *> windows = m_mdiArea->subWindowList();
+ PartMdiView * part_view;
+ switch(m_project->mdiWindowVisibility()){
+ case Project::allMdiWindows:
+ foreach(QMdiSubWindow *window, windows){
+ part_view = qobject_cast<PartMdiView *>(window);
+ Q_ASSERT(part_view);
+ part_view->show();
+ }
+ break;
+ case Project::folderOnly:
+ foreach(QMdiSubWindow *window, windows){
+ part_view = qobject_cast<PartMdiView *>(window);
+ Q_ASSERT(part_view);
+ if(part_view->part()->folder() == m_currentFolder)
+ part_view->show();
+ else
+ part_view->hide();
+ }
+ break;
+ case Project::folderAndSubfolders:
+ foreach(QMdiSubWindow *window, windows){
+ part_view = qobject_cast<PartMdiView *>(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() == "toggle_project_explorer_dock"){
- if (m_projectExplorerDock->isVisible())
- m_projectExplorerDock->hide();
- else
- m_projectExplorerDock->show();
- }else if (action->objectName() == "toggle_properties_explorer_dock"){
- if (m_propertiesDock->isVisible())
- m_propertiesDock->hide();
- else
- m_propertiesDock->show();
- }
+ if (action->objectName() == "toggle_project_explorer_dock"){
+ if (m_projectExplorerDock->isVisible())
+ m_projectExplorerDock->hide();
+ else
+ m_projectExplorerDock->show();
+ }else if (action->objectName() == "toggle_properties_explorer_dock"){
+ if (m_propertiesDock->isVisible())
+ m_propertiesDock->hide();
+ else
+ m_propertiesDock->show();
+ }
}
void MainWin::toggleFullScreen() {
- if (this->windowState() == Qt::WindowFullScreen){
- this->setWindowState(m_lastWindowState);
- } else {
- m_lastWindowState = this->windowState();
- qDebug()<<"m_lastWindowState " << m_lastWindowState;
- this->showFullScreen();
- }
+ if (this->windowState() == Qt::WindowFullScreen){
+ this->setWindowState(m_lastWindowState);
+ } else {
+ m_lastWindowState = this->windowState();
+ qDebug()<<"m_lastWindowState " << m_lastWindowState;
+ this->showFullScreen();
+ }
}
void MainWin::closeEvent(QCloseEvent* event) {
- m_closing = true;
- if (!this->closeProject()) {
- m_closing = false;
- event->ignore();
- }
+ m_closing = true;
+ if (!this->closeProject()) {
+ m_closing = false;
+ event->ignore();
+ }
}
void MainWin::handleSettingsChanges() {
- const KConfigGroup group = KGlobal::config()->group( "General" );
-
- QMdiArea::ViewMode viewMode = QMdiArea::ViewMode(group.readEntry("ViewMode", 0));
- if (m_mdiArea->viewMode() != viewMode) {
- m_mdiArea->setViewMode(viewMode);
- if (viewMode == QMdiArea::SubWindowView)
- this->updateMdiWindowVisibility();
- }
-
- if (m_mdiArea->viewMode() == QMdiArea::TabbedView) {
- m_tileWindows->setVisible(false);
- m_cascadeWindows->setVisible(false);
- QTabWidget::TabPosition tabPosition = \
QTabWidget::TabPosition(group.readEntry("TabPosition", 0));
- if (m_mdiArea->tabPosition() != tabPosition)
- m_mdiArea->setTabPosition(tabPosition);
- } else {
- m_tileWindows->setVisible(true);
- m_cascadeWindows->setVisible(true);
- }
-
- //autosave
- bool autoSave = group.readEntry("AutoSave", 0);
- if (m_autoSaveActive != autoSave) {
- m_autoSaveActive = autoSave;
- if (autoSave)
- m_autoSaveTimer.start();
- else
- m_autoSaveTimer.stop();
- }
-
- int interval = group.readEntry("AutoSaveInterval", 1);
- interval = interval*60*1000;
- if (interval!=m_autoSaveTimer.interval())
- m_autoSaveTimer.setInterval(interval);
+ const KConfigGroup group = KSharedConfig::openConfig()->group( "General" );
+
+ QMdiArea::ViewMode viewMode = QMdiArea::ViewMode(group.readEntry("ViewMode", \
0)); + if (m_mdiArea->viewMode() != viewMode) {
+ m_mdiArea->setViewMode(viewMode);
+ if (viewMode == QMdiArea::SubWindowView)
+ this->updateMdiWindowVisibility();
+ }
+
+ if (m_mdiArea->viewMode() == QMdiArea::TabbedView) {
+ m_tileWindows->setVisible(false);
+ m_cascadeWindows->setVisible(false);
+ QTabWidget::TabPosition tabPosition = \
QTabWidget::TabPosition(group.readEntry("TabPosition", 0)); + if \
(m_mdiArea->tabPosition() != tabPosition) + \
m_mdiArea->setTabPosition(tabPosition); + } else {
+ m_tileWindows->setVisible(true);
+ m_cascadeWindows->setVisible(true);
+ }
+
+ //autosave
+ bool autoSave = group.readEntry("AutoSave", 0);
+ if (m_autoSaveActive != autoSave) {
+ m_autoSaveActive = autoSave;
+ if (autoSave)
+ m_autoSaveTimer.start();
+ else
+ m_autoSaveTimer.stop();
+ }
+
+ int interval = group.readEntry("AutoSaveInterval", 1);
+ interval = interval*60*1000;
+ if (interval!=m_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 = new HistoryDialog(this, m_project->undoStack(), \
m_undoViewEmptyLabel);
- int index = m_project->undoStack()->index();
- if (dialog->exec() != QDialog::Accepted) {
- if (m_project->undoStack()->count() != 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() == 0) {
- m_undoAction->setEnabled(false);
- m_redoAction->setEnabled(false);
- }
+ if (!m_project->undoStack())
+ return;
+
+ HistoryDialog* dialog = new HistoryDialog(this, m_project->undoStack(), \
m_undoViewEmptyLabel); + int index = m_project->undoStack()->index();
+ if (dialog->exec() != QDialog::Accepted) {
+ if (m_project->undoStack()->count() != 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() == 0) {
+ m_undoAction->setEnabled(false);
+ m_redoAction->setEnabled(false);
+ }
}
/*!
Opens the dialog to import data to the selected spreadsheet
*/
void MainWin::importFileDialog(){
- m_importFileDialog = new ImportFileDialog(this);
- connect (m_importFileDialog, SIGNAL(newSpreadsheetRequested(QString)),
- this, SLOT(newSpreadsheetForImportFileDialog(QString)));
- std::auto_ptr<QAbstractItemModel> 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->currentIndex());
- } else if ( m_currentAspect->inherits("Column") ) {
- if (m_currentAspect->parentAspect()->inherits("Spreadsheet"))
- m_importFileDialog->setCurrentIndex( \
m_aspectTreeModel->modelIndexOfAspect(m_currentAspect->parentAspect()));
- }
-
- if ( m_importFileDialog->exec() == QDialog::Accepted ) {
- m_importFileDialog->importToSpreadsheet(statusBar());
- m_project->setChanged(true);
- }
-
- delete m_importFileDialog;
- m_importFileDialog = 0;
+ m_importFileDialog = new ImportFileDialog(this);
+ connect (m_importFileDialog, SIGNAL(newSpreadsheetRequested(QString)),
+ this, SLOT(newSpreadsheetForImportFileDialog(QString)));
+ std::auto_ptr<QAbstractItemModel> 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->currentIndex());
+ } else if ( m_currentAspect->inherits("Column") ) {
+ if (m_currentAspect->parentAspect()->inherits("Spreadsheet"))
+ m_importFileDialog->setCurrentIndex( \
m_aspectTreeModel->modelIndexOfAspect(m_currentAspect->parentAspect())); + }
+
+ if ( m_importFileDialog->exec() == QDialog::Accepted ) {
+ m_importFileDialog->importToSpreadsheet(statusBar());
+ m_project->setChanged(true);
+ }
+
+ delete m_importFileDialog;
+ m_importFileDialog = 0;
}
/*!
- opens the dialog for the export of the currently active worksheet/spreadsheet.
+ opens the dialog for the export of the currently active worksheet/spreadsheet.
*/
void MainWin::exportDialog(){
- //determine first, whether we want to export a worksheet or a spreadsheet
- Worksheet* w=this->activeWorksheet();
- if (w!=0){ //worksheet
- ExportWorksheetDialog* dlg = new ExportWorksheetDialog(this);
- dlg->setFileName(w->name());
- if (dlg->exec()==QDialog::Accepted){
- QString path = dlg->path();
- WorksheetView::ExportFormat format = dlg->exportFormat();
- WorksheetView::ExportArea area = dlg->exportArea();
- bool background = dlg->exportBackground();
- int resolution = dlg->exportResolution();
-
- WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
- WAIT_CURSOR;
- view->exportToFile(path, format, area, background, resolution);
- RESET_CURSOR;
- }
- }else{//Spreadsheet
- Spreadsheet* s = this->activeSpreadsheet();
- if (!s)
- return;
-
- ExportSpreadsheetDialog* dlg = new ExportSpreadsheetDialog(this);
- dlg->setFileName(s->name());
- if (dlg->exec()==QDialog::Accepted){
- QString path = dlg->path();
- const bool exportHeader = dlg->exportHeader();
- QString separator = dlg->separator();
-
- SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
- WAIT_CURSOR;
- view->exportToFile(path, exportHeader, separator);
- RESET_CURSOR;
- }
- }
+ //determine first, whether we want to export a worksheet or a spreadsheet
+ Worksheet* w=this->activeWorksheet();
+ if (w!=0){ //worksheet
+ ExportWorksheetDialog* dlg = new ExportWorksheetDialog(this);
+ dlg->setFileName(w->name());
+ if (dlg->exec()==QDialog::Accepted){
+ QString path = dlg->path();
+ WorksheetView::ExportFormat format = dlg->exportFormat();
+ WorksheetView::ExportArea area = dlg->exportArea();
+ bool background = dlg->exportBackground();
+ int resolution = dlg->exportResolution();
+
+ WorksheetView* view = qobject_cast<WorksheetView*>(w->view());
+ WAIT_CURSOR;
+ view->exportToFile(path, format, area, background, resolution);
+ RESET_CURSOR;
+ }
+ }else{//Spreadsheet
+ Spreadsheet* s = this->activeSpreadsheet();
+ if (!s)
+ return;
+
+ ExportSpreadsheetDialog* dlg = new ExportSpreadsheetDialog(this);
+ dlg->setFileName(s->name());
+ if (dlg->exec()==QDialog::Accepted){
+ QString path = dlg->path();
+ const bool exportHeader = dlg->exportHeader();
+ QString separator = dlg->separator();
+
+ SpreadsheetView* view = qobject_cast<SpreadsheetView*>(s->view());
+ 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 = new ImportFileDialog(this);
if ( dlg->exec() == QDialog::Accepted ) {
- FileDataSource* dataSource = new FileDataSource(0, i18n("File data source%1", \
1));
- dlg->importToFileDataSource(dataSource, statusBar());
- this->addAspectToProject(dataSource);
- kDebug()<<"new file data source created"<<endl;
+ FileDataSource* dataSource = new FileDataSource(0, i18n("File data source%1", \
1)); + dlg->importToFileDataSource(dataSource, statusBar());
+ this->addAspectToProject(dataSource);
+ kDebug()<<"new file data source created"<<endl;
}
delete dlg;
}
@@ -1354,20 +1350,20 @@ void MainWin::newSqlDataSourceActionTriggered(){
}
void MainWin::addAspectToProject(AbstractAspect* aspect){
- QModelIndex index = m_projectExplorer->currentIndex();
- if(!index.isValid())
- m_project->addChild(aspect);
- else {
- AbstractAspect * parent_aspect = static_cast<AbstractAspect \
*>(index.internalPointer()); + QModelIndex index = \
m_projectExplorer->currentIndex(); + if(!index.isValid())
+ m_project->addChild(aspect);
+ else {
+ AbstractAspect * parent_aspect = static_cast<AbstractAspect \
*>(index.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 = new SettingsDialog(this);
- connect (dlg, SIGNAL(settingsChanged()), this, SLOT(handleSettingsChanges()));
- dlg->exec();
- delete dlg;
+ SettingsDialog* dlg = new SettingsDialog(this);
+ connect (dlg, SIGNAL(settingsChanged()), this, SLOT(handleSettingsChanges()));
+ 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 switching 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/SettingsDialog.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 <KPushButton>
#include <kmessagebox.h>
#include <KIcon>
+#include <KConfigGroup>
+#include <KWindowConfig>
/**
* \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 = new QDialogButtonBox;
+
+ QPushButton* okbutton = dialogButtonBox->addButton(QDialogButtonBox::Ok);
+ connect( okbutton, &QAbstractButton::clicked, this, &SettingsDialog::onOkButton \
); +
+ applybutton = dialogButtonBox->addButton(QDialogButtonBox::Apply);
+ connect( applybutton, &QAbstractButton::clicked, this, \
&SettingsDialog::onApplyButton ); +
+ dialogButtonBox->addButton(QDialogButtonBox::Cancel);
+
+ QPushButton* defaultbutton = \
dialogButtonBox->addButton(QDialogButtonBox::RestoreDefaults); + connect( \
defaultbutton, &QAbstractButton::clicked, this, \
&SettingsDialog::onRestoreDefaultsButton ); +
+ okbutton->setDefault(true);
+ applybutton->setEnabled(false);
+
+ QVBoxLayout* layout = new QVBoxLayout;
+ layout->addWidget( dialogButtonBox );
+ setLayout( layout );
generalPage = new SettingsGeneralPage(this);
KPageWidgetItem* generalFrame = 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 = new SettingsPrintingPage(mainWindow, this);
// KPageWidgetItem* printingFrame = addPage(printingPage, i18nc("@title:group", \
"Print")); // printingFrame->setIcon(KIcon("document-print"));
- const KConfigGroup dialogConfig = KGlobal::config()->group("SettingsDialog");
- restoreDialogSize(dialogConfig);
+ const KConfigGroup dialogConfig = \
KSharedConfig::openConfig()->group("SettingsDialog"); + \
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig); }
SettingsDialog::~SettingsDialog(){
- KConfigGroup dialogConfig = KGlobal::config()->group("SettingsDialog");
- saveDialogSize(dialogConfig);
+ KConfigGroup dialogConfig = \
KSharedConfig::openConfig()->group("SettingsDialog"); + \
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig); +}
+
+void SettingsDialog::onOkButton(){
+ if (m_changed){
+ applySettings();
+ setWindowTitle(i18n("Preferences"));
+ applybutton->setEnabled(false);
+ }
}
-void SettingsDialog::slotButtonClicked(int button){
- if ((button == Ok) || (button == Apply)) {
- if (m_changed){
- applySettings();
- setCaption(i18n("Preferences"));
- enableButton(Apply, false);
- }
- } else if (button == Default) {
- const QString text(i18n("All settings will be reset to default values. Do \
you want to continue?"));
- if (KMessageBox::questionYesNo(this, text) == KMessageBox::Yes) {
- restoreDefaults();
- setCaption(i18n("Preferences"));
- enableButton(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) == \
KMessageBox::Yes) { + restoreDefaults();
+ setWindowTitle(i18n("Preferences"));
+ applybutton->setEnabled(false);
+ }
}
void SettingsDialog::changed() {
- m_changed = true;
- setCaption(i18n("Preferences [Changed]"));
- enableButton(Apply, true);
+ m_changed = true;
+ setWindowTitle(i18n("Preferences [Changed]"));
+ applybutton->setEnabled(true);
}
void SettingsDialog::applySettings(){
- m_changed = false;
+ m_changed = false;
generalPage->applySettings();
// printingPage->applySettings();
- KGlobal::config()->sync();
- emit settingsChanged();
+ KSharedConfig::openConfig()->sync();
+ emit settingsChanged();
}
void SettingsDialog::restoreDefaults(){
- m_changed = false;
+ m_changed = false;
generalPage->restoreDefaults();
-// printingPage->restoreDefaults();
+// printingPage->restoreDefaults();
}
diff --git a/src/kdefrontend/SettingsDialog.h b/src/kdefrontend/SettingsDialog.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/SettingsGeneralPage.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 = KGlobal::config()->group( "General" );
+ KConfigGroup group = 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 = KGlobal::config()->group( "General" );
+ const KConfigGroup group = KSharedConfig::openConfig()->group( "General" );
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 <QtGui/QWidget>
+#include <QtWidgets/QWidget>
class SettingsPage : public QWidget {
Q_OBJECT
diff --git a/src/kdefrontend/TemplateHandler.cpp \
b/src/kdefrontend/TemplateHandler.cpp index bc4805c..1aae237 100644
--- a/src/kdefrontend/TemplateHandler.cpp
+++ b/src/kdefrontend/TemplateHandler.cpp
@@ -28,9 +28,9 @@
***************************************************************************/
#include "TemplateHandler.h"
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QSpacerItem>
-#include <QtGui/QToolButton>
+#include <QtWidgets/QHBoxLayout>
+#include <QtWidgets/QSpacerItem>
+#include <QtWidgets/QToolButton>
#include <QLabel>
#include <QFileInfo>
#include <QWidgetAction>
@@ -40,7 +40,6 @@
#include <KIcon>
#include <KMenu>
#include <KConfig>
-
/*!
\class TemplateHandler
\brief Provides a widget with buttons for saving and loading of templates.
@@ -78,11 +77,11 @@ TemplateHandler::TemplateHandler(QWidget *parent, ClassName \
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, ClassName name): \
QWidget(paren this->retranslateUi();
//disable the load-button if no templates are available yet
- QStringList list = KGlobal::dirs()->findAllResources("appdata", "templates/" + \
dirNames.at(className) + "/*"); + QStringList list = \
QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, "templates/" + \
dirNames.at(className) + "/*"); tbLoad->setEnabled(list.size());
}
@@ -115,7 +114,7 @@ void TemplateHandler::loadMenu() {
KMenu menu;
menu.addTitle(i18n("Load from"));
- QStringList list = KGlobal::dirs()->findAllResources("appdata", "templates/" + \
dirNames.at(className) + "/*"); + QStringList list = \
QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, "templates/" + \
dirNames.at(className) + "/*"); for (int i = 0; i < list.size(); ++i) {
QFileInfo fileinfo(list.at(i));
QAction* action = menu.addAction(fileinfo.fileName());
@@ -138,7 +137,7 @@ void TemplateHandler::saveMenu() {
KMenu menu;
menu.addTitle(i18n("Save as"));
- QStringList list = KGlobal::dirs()->findAllResources("appdata", "templates/"+ \
dirNames.at(className) + "/*"); + QStringList list = \
QStandardPaths::locateAll(QStandardPaths::ApplicationsLocation, "templates/"+ \
dirNames.at(className) + "/*"); for (int i = 0; i < list.size(); ++i) {
QFileInfo fileinfo(list.at(i));
QAction* action = 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::ApplicationsLocation, "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/TemplateHandler.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 <QtGui/QWidget>
+#include <QtWidgets/QWidget>
class QHBoxLayout;
class QToolButton;
class QSpacerItem;
diff --git a/src/kdefrontend/datasources/FileInfoDialog.cpp \
b/src/kdefrontend/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/kdefrontend/datasources/ImportFileDialog.cpp index 244ac9a..c7cf0e6 100644
--- a/src/kdefrontend/datasources/ImportFileDialog.cpp
+++ b/src/kdefrontend/datasources/ImportFileDialog.cpp
@@ -40,6 +40,8 @@
#include <QStatusBar>
#include <QDir>
#include <QInputDialog>
+ #include <KSharedConfig>
+#include <KLocalizedString>
/*!
\class ImportFileDialog
@@ -73,7 +75,7 @@ ImportFileDialog::ImportFileDialog(QWidget* parent) : \
KDialog(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<QAbstractItemModel> \
model){ cbAddTo->setSelectableClasses(list);
bNewSpreadsheet = 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 = new QInputDialog(this);
// this->setWindowIcon( QIcon(KIcon("insert-table")) );
- dlg->setWindowIcon( QIcon(KIcon("insert-table")) );
+ dlg->setWindowIcon( QIcon(QIcon("insert-table")) );
name = dlg->getText(this, i18n("Add new Spreadsheet"), i18n("Spreadsheet name:"), \
QLineEdit::Normal, name, &ok); // name = KInputDialog::getText( i18n("Add new \
Spreadsheet"), i18n("Spreadsheet name:"), name, &ok); if (ok)
diff --git a/src/kdefrontend/datasources/ImportFileWidget.cpp \
b/src/kdefrontend/datasources/ImportFileWidget.cpp index 8814aec..a03ab01 100644
--- a/src/kdefrontend/datasources/ImportFileWidget.cpp
+++ b/src/kdefrontend/datasources/ImportFileWidget.cpp
@@ -39,6 +39,8 @@
#include <QProcess>
#include <QTextStream>
#include <KUrlCompletion>
+#include <KLocalizedString>
+ #include <KSharedConfig>
/*!
\class ImportFileWidget
@@ -71,11 +73,11 @@ ImportFileWidget::ImportFileWidget(QWidget* parent) : \
QWidget(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(fileNameChanged(QString)) ); connect( ui.bOpen, SIGNAL(clicked()), this, SLOT \
(selectFile()) ); @@ -88,7 +90,7 @@ ImportFileWidget::ImportFileWidget(QWidget* \
parent) : QWidget(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 = conf.readEntry("LastDir", "");
QString path = QFileDialog::getOpenFileName(this, i18n("Select the File Data \
Source"), dir); if (path.isEmpty())
diff --git a/src/kdefrontend/dockwidgets/AxisDock.cpp \
b/src/kdefrontend/dockwidgets/AxisDock.cpp index b2a5f19..0c93d86 100644
--- a/src/kdefrontend/dockwidgets/AxisDock.cpp
+++ b/src/kdefrontend/dockwidgets/AxisDock.cpp
@@ -40,6 +40,7 @@
#include <QDir>
#include <QPainter>
#include <KMessageBox>
+#include <KLocalizedString>
#include <math.h>
diff --git a/src/kdefrontend/dockwidgets/AxisDock.h \
b/src/kdefrontend/dockwidgets/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 <KConfig>
class AbstractAspect;
class LabelWidget;
diff --git a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp \
b/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp index 7f25157..e18abcb 100644
--- a/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
+++ b/src/kdefrontend/dockwidgets/CartesianPlotDock.cpp
@@ -39,6 +39,7 @@
#include <QDir>
#include <QFileDialog>
#include <KUrlCompletion>
+#include <KLocalizedString>
#include <math.h>
@@ -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 = new KUrlCompletion();
- ui.kleBackgroundFileName->setCompletionObject(comp);
-
- //"Title"-tab
- QHBoxLayout* hboxLayout = new QHBoxLayout(ui.tabTitle);
- labelWidget=new LabelWidget(ui.tabTitle);
- hboxLayout->addWidget(labelWidget);
- hboxLayout->setContentsMargins(2,2,2,2);
- hboxLayout->setSpacing(2);
-
- //adjust layouts in the tabs
- for (int i=0; i<ui.tabWidget->count(); ++i){
- QGridLayout* layout = \
dynamic_cast<QGridLayout*>(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(visibilityChanged(int)) );
- connect( ui.sbLeft, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) );
- connect( ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) );
- connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) );
- connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) \
);
-
- connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, \
SLOT(autoScaleXChanged(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(xScaleChanged(int)) );
-
- connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, \
SLOT(autoScaleYChanged(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(yScaleChanged(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(currentXBreakChanged(int)) );
- connect( ui.leXBreakStart, SIGNAL(returnPressed()), this, \
SLOT(xBreakStartChanged()) );
- connect( ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEndChanged()) );
- connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, \
SLOT(xBreakPositionChanged(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(currentYBreakChanged(int)) );
- connect( ui.leYBreakStart, SIGNAL(returnPressed()), this, \
SLOT(yBreakStartChanged()) );
- connect( ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEndChanged()) );
- connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, \
SLOT(yBreakPositionChanged(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, \
SLOT(backgroundFirstColorChanged(QColor)) );
- connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, \
SLOT(backgroundSecondColorChanged(QColor)) );
- connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, \
SLOT(backgroundOpacityChanged(int)) );
-
- //Border
- connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, \
SLOT(borderStyleChanged(int)) );
- connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, \
SLOT(borderColorChanged(QColor)) );
- connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, \
SLOT(borderWidthChanged(double)) );
- connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, \
SLOT(borderCornerRadiusChanged(double)) );
- connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, \
SLOT(borderOpacityChanged(int)) );
-
- //Padding
- connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, \
SLOT(horizontalPaddingChanged(double)) );
- connect( ui.sbPaddingVertical, SIGNAL(valueChanged(double)), this, \
SLOT(verticalPaddingChanged(double)) );
-
- TemplateHandler* templateHandler = new TemplateHandler(this, \
TemplateHandler::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(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 = new KUrlCompletion();
+ ui.kleBackgroundFileName->setCompletionObject(comp);
+
+ //"Title"-tab
+ QHBoxLayout* hboxLayout = new QHBoxLayout(ui.tabTitle);
+ labelWidget=new LabelWidget(ui.tabTitle);
+ hboxLayout->addWidget(labelWidget);
+ hboxLayout->setContentsMargins(2,2,2,2);
+ hboxLayout->setSpacing(2);
+
+ //adjust layouts in the tabs
+ for (int i=0; i<ui.tabWidget->count(); ++i){
+ QGridLayout* layout = \
dynamic_cast<QGridLayout*>(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(visibilityChanged(int)) ); + connect( ui.sbLeft, \
SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + connect( \
ui.sbTop, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + \
connect( ui.sbWidth, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); + \
connect( ui.sbHeight, SIGNAL(valueChanged(double)), this, SLOT(geometryChanged()) ); \
+ + connect( ui.chkAutoScaleX, SIGNAL(stateChanged(int)), this, \
SLOT(autoScaleXChanged(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(xScaleChanged(int)) ); +
+ connect( ui.chkAutoScaleY, SIGNAL(stateChanged(int)), this, \
SLOT(autoScaleYChanged(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(yScaleChanged(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(currentXBreakChanged(int)) ); + connect( ui.leXBreakStart, \
SIGNAL(returnPressed()), this, SLOT(xBreakStartChanged()) ); + connect( \
ui.leXBreakEnd, SIGNAL(returnPressed()), this, SLOT(xBreakEndChanged()) ); + \
connect( ui.sbXBreakPosition, SIGNAL(valueChanged(int)), this, \
SLOT(xBreakPositionChanged(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(currentYBreakChanged(int)) ); + connect( ui.leYBreakStart, \
SIGNAL(returnPressed()), this, SLOT(yBreakStartChanged()) ); + connect( \
ui.leYBreakEnd, SIGNAL(returnPressed()), this, SLOT(yBreakEndChanged()) ); + \
connect( ui.sbYBreakPosition, SIGNAL(valueChanged(int)), this, \
SLOT(yBreakPositionChanged(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, SLOT(backgroundFirstColorChanged(QColor)) ); + \
connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, \
SLOT(backgroundSecondColorChanged(QColor)) ); + connect( ui.sbBackgroundOpacity, \
SIGNAL(valueChanged(int)), this, SLOT(backgroundOpacityChanged(int)) ); +
+ //Border
+ connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, \
SLOT(borderStyleChanged(int)) ); + connect( ui.kcbBorderColor, \
SIGNAL(changed(QColor)), this, SLOT(borderColorChanged(QColor)) ); + connect( \
ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, \
SLOT(borderWidthChanged(double)) ); + connect( ui.sbBorderCornerRadius, \
SIGNAL(valueChanged(double)), this, SLOT(borderCornerRadiusChanged(double)) ); + \
connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, \
SLOT(borderOpacityChanged(int)) ); +
+ //Padding
+ connect( ui.sbPaddingHorizontal, SIGNAL(valueChanged(double)), this, \
SLOT(horizontalPaddingChanged(double)) ); + connect( ui.sbPaddingVertical, \
SIGNAL(valueChanged(double)), this, SLOT(verticalPaddingChanged(double)) ); +
+ TemplateHandler* templateHandler = new TemplateHandler(this, \
TemplateHandler::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(QString))); +
+ 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<CartesianPlot*> list){
- m_initializing = true;
- m_plotList = list;
-
- m_plot=list.first();
-
- QList<TextLabel*> 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()==1){
- 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 (=worksheet).
- //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 = dynamic_cast<Worksheet*>(m_plot->parentAspect());
- if (w){
- bool b = (w->layout()==Worksheet::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(layoutChanged(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(float)) );
- connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChanged(float)) );
- connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChanged(int)) );
- connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChanged(float)) );
- connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChanged(float)) );
- connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChanged(int)) );
- connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), \
this, SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreakings)) \
);
- connect( m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), \
this, SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreakings)) \
);
- connect( m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleChanged(bool)) \
);
-
- // Plot Area
- connect( m_plot->plotArea(), \
SIGNAL(backgroundTypeChanged(PlotArea::BackgroundType)), this, \
SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundType)) );
- connect( m_plot->plotArea(), \
SIGNAL(backgroundColorStyleChanged(PlotArea::BackgroundColorStyle)), this, \
SLOT(plotBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle)) \
);
- connect( m_plot->plotArea(), \
SIGNAL(backgroundImageStyleChanged(PlotArea::BackgroundImageStyle)), this, \
SLOT(plotBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle)) \
);
- connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::BrushStyle)), \
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)), this, \
SLOT(plotBackgroundOpacityChanged(float)) );
- connect( m_plot->plotArea(), SIGNAL(borderPenChanged(QPen&)), this, \
SLOT(plotBorderPenChanged(QPen&)) );
- connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this, \
SLOT(plotBorderOpacityChanged(float)) );
- connect( m_plot, SIGNAL(horizontalPaddingChanged(float)), this, \
SLOT(plotHorizontalPaddingChanged(float)) );
- connect( m_plot, SIGNAL(verticalPaddingChanged(float)), this, \
SLOT(plotVerticalPaddingChanged(float)) );
-
- m_initializing = false;
+ m_initializing = true;
+ m_plotList = list;
+
+ m_plot=list.first();
+
+ QList<TextLabel*> 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()==1){
+ 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 (=worksheet). + //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 = dynamic_cast<Worksheet*>(m_plot->parentAspect()); + if (w){
+ bool b = (w->layout()==Worksheet::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(layoutChanged(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(float)) ); + \
connect( m_plot, SIGNAL(xMaxChanged(float)), this, SLOT(plotXMaxChanged(float)) ); + \
connect( m_plot, SIGNAL(xScaleChanged(int)), this, SLOT(plotXScaleChanged(int)) ); + \
connect( m_plot, SIGNAL(yMinChanged(float)), this, SLOT(plotYMinChanged(float)) ); + \
connect( m_plot, SIGNAL(yMaxChanged(float)), this, SLOT(plotYMaxChanged(float)) ); + \
connect( m_plot, SIGNAL(yScaleChanged(int)), this, SLOT(plotYScaleChanged(int)) ); + \
connect( m_plot, SIGNAL(xScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, \
SLOT(plotXScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); + connect( \
m_plot, SIGNAL(yScaleBreakingsChanged(CartesianPlot::ScaleBreakings)), this, \
SLOT(plotYScaleBreakingChanged(CartesianPlot::ScaleBreakings)) ); + connect( \
m_plot, SIGNAL(visibleChanged(bool)), this, SLOT(plotVisibleChanged(bool)) ); +
+ // Plot Area
+ connect( m_plot->plotArea(), \
SIGNAL(backgroundTypeChanged(PlotArea::BackgroundType)), this, \
SLOT(plotBackgroundTypeChanged(PlotArea::BackgroundType)) ); + connect( \
m_plot->plotArea(), SIGNAL(backgroundColorStyleChanged(PlotArea::BackgroundColorStyle)), \
this, SLOT(plotBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle)) ); + \
connect( m_plot->plotArea(), \
SIGNAL(backgroundImageStyleChanged(PlotArea::BackgroundImageStyle)), this, \
SLOT(plotBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle)) ); + \
connect( m_plot->plotArea(), SIGNAL(backgroundBrushStyleChanged(Qt::BrushStyle)), \
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)), this, \
SLOT(plotBackgroundOpacityChanged(float)) ); + connect( m_plot->plotArea(), \
SIGNAL(borderPenChanged(QPen&)), this, SLOT(plotBorderPenChanged(QPen&)) ); + \
connect( m_plot->plotArea(), SIGNAL(borderOpacityChanged(float)), this, \
SLOT(plotBorderOpacityChanged(float)) ); + connect( m_plot, \
SIGNAL(horizontalPaddingChanged(float)), this, \
SLOT(plotHorizontalPaddingChanged(float)) ); + connect( m_plot, \
SIGNAL(verticalPaddingChanged(float)), this, SLOT(plotVerticalPaddingChanged(float)) \
); +
+ m_initializing = 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 = true;
+ m_initializing = 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 (start from \
top left)")); + ui.cbBackgroundColorStyle->addItem(i18n("diagonal linear gradient \
(start 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::SolidPattern);
- m_initializing = false;
+ m_initializing = 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 = (state==Qt::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 = Worksheet::convertToSceneUnits(ui.sbLeft->value(), \
Worksheet::Centimeter);
- float y = Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::Centimeter);
- float w = Worksheet::convertToSceneUnits(ui.sbWidth->value(), \
Worksheet::Centimeter);
- float h = Worksheet::convertToSceneUnits(ui.sbHeight->value(), \
Worksheet::Centimeter); + float x = \
Worksheet::convertToSceneUnits(ui.sbLeft->value(), Worksheet::Centimeter); + float \
y = Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::Centimeter); + \
float w = Worksheet::convertToSceneUnits(ui.sbWidth->value(), Worksheet::Centimeter); \
+ float h = Worksheet::convertToSceneUnits(ui.sbHeight->value(), \
Worksheet::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/activated.
- Shows the new geometry values of the first plot if the layout was activated.
+ Called when the layout in the worksheet gets changed.
+ Enables/disables the geometry widgets if the layout was deactivated/activated.
+ Shows the new geometry values of the first plot if the layout was activated.
*/
void CartesianPlotDock::layoutChanged(Worksheet::Layout layout){
- bool b = (layout == Worksheet::NoLayout);
- ui.sbTop->setEnabled(b);
- ui.sbLeft->setEnabled(b);
- ui.sbWidth->setEnabled(b);
- ui.sbHeight->setEnabled(b);
- if (!b){
- m_initializing = 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->rect().height(), \
Worksheet::Centimeter));
- m_initializing = false;
- }
+ bool b = (layout == Worksheet::NoLayout);
+ ui.sbTop->setEnabled(b);
+ ui.sbLeft->setEnabled(b);
+ ui.sbWidth->setEnabled(b);
+ ui.sbHeight->setEnabled(b);
+ if (!b){
+ m_initializing = 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->rect().height(), \
Worksheet::Centimeter)); + m_initializing = false;
+ }
}
void CartesianPlotDock::autoScaleXChanged(int state){
- bool checked = (state==Qt::Checked);
- ui.kleXMin->setEnabled(!checked);
- ui.kleXMax->setEnabled(!checked);
+ bool checked = (state==Qt::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 = ui.kleXMin->text().toDouble();
- foreach(CartesianPlot* plot, m_plotList)
- plot->setXMin(value);
+ float value = 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 = ui.kleXMax->text().toDouble();
- foreach(CartesianPlot* plot, m_plotList)
- plot->setXMax(value);
+ float value = 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 = (state==Qt::Checked);
- ui.kleYMin->setEnabled(!checked);
- ui.kleYMax->setEnabled(!checked);
+ bool checked = (state==Qt::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 = ui.kleYMin->text().toDouble();
- foreach(CartesianPlot* plot, m_plotList)
- plot->setYMin(value);
+ float value = 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 = ui.kleYMax->text().toDouble();
- foreach(CartesianPlot* plot, m_plotList)
- plot->setYMax(value);
+ float value = 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 = (CartesianPlot::Scale)index;
foreach(CartesianPlot* plot, m_plotList)
- plot->setYScale(scale);
+ plot->setYScale(scale);
}
// "Scale Breakings"-tab
void CartesianPlotDock::toggleXBreak(int state){
- bool b = (state==Qt::Checked);
- ui.frameXBreakEdit->setVisible(b);
- ui.lXBreakStart->setVisible(b);
- ui.leXBreakStart->setVisible(b);
- ui.lXBreakEnd->setVisible(b);
- ui.leXBreakEnd->setVisible(b);
+ bool b = (state==Qt::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()!=0);
+// ui.bRemoveXBreak->setVisible(m_plot->xScaleBreakings().size()!=0);
}
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 = ui.cbXBreak->currentIndex();
- CartesianPlot::ScaleBreakings breakings = m_plot->xScaleBreakings();
- if (index==0 && breakings.list.size()==0) {
- //no scale breaking avaiable yet, create a new one
- CartesianPlot::ScaleBreaking breaking;
- breaking.start = ui.leXBreakStart->text().toDouble();
- breakings.list<<breaking;
- } else {
- breakings.list[index].start = ui.leXBreakStart->text().toDouble();
- }
+ int index = ui.cbXBreak->currentIndex();
+ CartesianPlot::ScaleBreakings breakings = m_plot->xScaleBreakings();
+ if (index==0 && breakings.list.size()==0) {
+ //no scale breaking avaiable yet, create a new one
+ CartesianPlot::ScaleBreaking breaking;
+ breaking.start = ui.leXBreakStart->text().toDouble();
+ breakings.list<<breaking;
+ } else {
+ breakings.list[index].start = ui.leXBreakStart->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 = ui.cbXBreak->currentIndex();
- CartesianPlot::ScaleBreakings breakings = m_plot->xScaleBreakings();
- if (index==0 && breakings.list.size()==0) {
- //no scale breaking avaiable yet, create a new one
- CartesianPlot::ScaleBreaking breaking;
- breaking.end = ui.leXBreakEnd->text().toDouble();
- breakings.list<<breaking;
- } else {
- breakings.list[index].end = ui.leXBreakEnd->text().toDouble();
- }
+ int index = ui.cbXBreak->currentIndex();
+ CartesianPlot::ScaleBreakings breakings = m_plot->xScaleBreakings();
+ if (index==0 && breakings.list.size()==0) {
+ //no scale breaking avaiable yet, create a new one
+ CartesianPlot::ScaleBreaking breaking;
+ breaking.end = ui.leXBreakEnd->text().toDouble();
+ breakings.list<<breaking;
+ } else {
+ breakings.list[index].end = ui.leXBreakEnd->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 = (state==Qt::Checked);
- ui.frameYBreakEdit->setVisible(b);
- ui.lYBreakStart->setVisible(b);
- ui.leYBreakStart->setVisible(b);
- ui.lYBreakEnd->setVisible(b);
- ui.leYBreakEnd->setVisible(b);
+ bool b = (state==Qt::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 = (PlotArea::BackgroundType)index;
-
- if (type == 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 =
- (PlotArea::BackgroundColorStyle) ui.cbBackgroundColorStyle->currentIndex();
- if (style == 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 == 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 == 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 = (PlotArea::BackgroundType)index;
+
+ if (type == 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 =
+ (PlotArea::BackgroundColorStyle) \
ui.cbBackgroundColorStyle->currentIndex(); + if (style == \
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 == 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 == 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 = (PlotArea::BackgroundColorStyle)index;
-
- if (style == 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 = (PlotArea::BackgroundColorStyle)index;
+
+ if (style == 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 = (PlotArea::BackgroundImageStyle)index;
- foreach(CartesianPlot* plot, m_plotList){
- plot->plotArea()->setBackgroundImageStyle(style);
+ PlotArea::BackgroundImageStyle style = (PlotArea::BackgroundImageStyle)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 = (Qt::BrushStyle)index;
- foreach(CartesianPlot* plot, m_plotList){
- plot->plotArea()->setBackgroundBrushStyle(style);
+ Qt::BrushStyle style = (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 = conf.readEntry("LastImageDir", "");
+ KConfigGroup conf(KSharedConfig::openConfig(), "CartesianPlotDock");
+ QString dir = conf.readEntry("LastImageDir", "");
QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), \
dir); if (path.isEmpty())
return; //cancel was clicked in the file-dialog
- int pos = path.lastIndexOf(QDir::separator());
- if (pos!=-1) {
- QString newDir = path.left(pos);
- if (newDir!=dir)
- conf.writeEntry("LastImageDir", newDir);
- }
+ int pos = path.lastIndexOf(QDir::separator());
+ if (pos!=-1) {
+ QString newDir = path.left(pos);
+ if (newDir!=dir)
+ 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 = ui.kleBackgroundFileName->text();
- foreach(CartesianPlot* plot, m_plotList){
- plot->plotArea()->setBackgroundFileName(fileName);
+ QString fileName = 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 = (float)value/100.;
- foreach(CartesianPlot* plot, m_plotList)
- plot->plotArea()->setBackgroundOpacity(opacity);
+ qreal opacity = (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=Qt::PenStyle(index);
QPen pen;
foreach(CartesianPlot* plot, m_plotList){
- pen=plot->plotArea()->borderPen();
- pen.setStyle(penStyle);
- plot->plotArea()->setBorderPen(pen);
+ pen=plot->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=plot->plotArea()->borderPen();
- pen.setColor(color);
- plot->plotArea()->setBorderPen(pen);
+ pen=plot->plotArea()->borderPen();
+ pen.setColor(color);
+ plot->plotArea()->setBorderPen(pen);
}
m_initializing=true;
@@ -813,47 +814,47 @@ void CartesianPlotDock::borderColorChanged(const QColor& \
color){
void CartesianPlotDock::borderWidthChanged(double value){
if (m_initializing)
- return;
+ return;
QPen pen;
foreach(CartesianPlot* plot, m_plotList){
- pen=plot->plotArea()->borderPen();
- pen.setWidthF( Worksheet::convertToSceneUnits(value, Worksheet::Point) );
- plot->plotArea()->setBorderPen(pen);
+ pen=plot->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(value, \
Worksheet::Centimeter)); + foreach(CartesianPlot* plot, m_plotList)
+ plot->plotArea()->setBorderCornerRadius(Worksheet::convertToSceneUnits(value, \
Worksheet::Centimeter)); }
void CartesianPlotDock::borderOpacityChanged(int value){
- if (m_initializing)
- return;
+ if (m_initializing)
+ return;
- qreal opacity = (float)value/100.;
- foreach(CartesianPlot* plot, m_plotList)
- plot->plotArea()->setBorderOpacity(opacity);
+ qreal opacity = (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, \
Worksheet::Centimeter)); + \
plot->setHorizontalPadding(Worksheet::convertToSceneUnits(value, \
Worksheet::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, \
Worksheet::Centimeter)); }
//*************************************************************
@@ -861,351 +862,351 @@ void CartesianPlotDock::verticalPaddingChanged(double value){
//*************************************************************
//general
void CartesianPlotDock::plotDescriptionChanged(const AbstractAspect* aspect) {
- if (m_plot != aspect)
- return;
+ if (m_plot != aspect)
+ return;
- m_initializing = true;
- if (aspect->name() != ui.leName->text()) {
- ui.leName->setText(aspect->name());
- } else if (aspect->comment() != ui.leComment->text()) {
- ui.leComment->setText(aspect->comment());
- }
- m_initializing = false;
+ m_initializing = true;
+ if (aspect->name() != ui.leName->text()) {
+ ui.leName->setText(aspect->name());
+ } else if (aspect->comment() != ui.leComment->text()) {
+ ui.leComment->setText(aspect->comment());
+ }
+ m_initializing = false;
}
void CartesianPlotDock::plotRectChanged(QRectF& rect){
- m_initializing = 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(), \
Worksheet::Centimeter));
- ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), \
Worksheet::Centimeter));
- m_initializing = false;
+ m_initializing = 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(), \
Worksheet::Centimeter)); + \
ui.sbHeight->setValue(Worksheet::convertFromSceneUnits(rect.height(), \
Worksheet::Centimeter)); + m_initializing = false;
}
void CartesianPlotDock::plotXMinChanged(float value){
- m_initializing = true;
- ui.kleXMin->setText( QString::number(value) );
- m_initializing = false;
+ m_initializing = true;
+ ui.kleXMin->setText( QString::number(value) );
+ m_initializing = false;
}
void CartesianPlotDock::plotXMaxChanged(float value){
- m_initializing = true;
- ui.kleXMax->setText( QString::number(value) );
- m_initializing = false;
+ m_initializing = true;
+ ui.kleXMax->setText( QString::number(value) );
+ m_initializing = false;
}
void CartesianPlotDock::plotXScaleChanged(int scale){
- m_initializing = true;
- ui.cbXScaling->setCurrentIndex( scale );
- m_initializing = false;
+ m_initializing = true;
+ ui.cbXScaling->setCurrentIndex( scale );
+ m_initializing = false;
}
void CartesianPlotDock::plotYMinChanged(float value){
- m_initializing = true;
- ui.kleYMin->setText( QString::number(value) );
- m_initializing = false;
+ m_initializing = true;
+ ui.kleYMin->setText( QString::number(value) );
+ m_initializing = false;
}
void CartesianPlotDock::plotYMaxChanged(float value){
- m_initializing = true;
- ui.kleYMax->setText( QString::number(value) );
- m_initializing = false;
+ m_initializing = true;
+ ui.kleYMax->setText( QString::number(value) );
+ m_initializing = false;
}
void CartesianPlotDock::plotYScaleChanged(int scale){
- m_initializing = true;
- ui.cbYScaling->setCurrentIndex( scale );
- m_initializing = false;
+ m_initializing = true;
+ ui.cbYScaling->setCurrentIndex( scale );
+ m_initializing = false;
}
void CartesianPlotDock::plotVisibleChanged(bool on){
- m_initializing = true;
- ui.chkVisible->setChecked(on);
- m_initializing = false;
+ m_initializing = true;
+ ui.chkVisible->setChecked(on);
+ m_initializing = false;
}
//scale breakings
void CartesianPlotDock::plotXScaleBreakingChanged(const \
CartesianPlot::ScaleBreakings& breakings) {
- Q_UNUSED(breakings);
+ Q_UNUSED(breakings);
}
void CartesianPlotDock::plotYScaleBreakingChanged(const \
CartesianPlot::ScaleBreakings& breakings) {
- Q_UNUSED(breakings);
+ Q_UNUSED(breakings);
}
//background
void CartesianPlotDock::plotBackgroundTypeChanged(PlotArea::BackgroundType type){
- m_initializing = true;
- ui.cbBackgroundType->setCurrentIndex(type);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbBackgroundType->setCurrentIndex(type);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle \
style){
- m_initializing = true;
- ui.cbBackgroundColorStyle->setCurrentIndex(style);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbBackgroundColorStyle->setCurrentIndex(style);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle \
style){
- m_initializing = true;
- ui.cbBackgroundImageStyle->setCurrentIndex(style);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbBackgroundImageStyle->setCurrentIndex(style);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundBrushStyleChanged(Qt::BrushStyle style){
- m_initializing = true;
- ui.cbBackgroundBrushStyle->setCurrentIndex(style);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbBackgroundBrushStyle->setCurrentIndex(style);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundFirstColorChanged(QColor& color){
- m_initializing = true;
- ui.kcbBackgroundFirstColor->setColor(color);
- m_initializing = false;
+ m_initializing = true;
+ ui.kcbBackgroundFirstColor->setColor(color);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundSecondColorChanged(QColor& color){
- m_initializing = true;
- ui.kcbBackgroundSecondColor->setColor(color);
- m_initializing = false;
+ m_initializing = true;
+ ui.kcbBackgroundSecondColor->setColor(color);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundFileNameChanged(QString& filename){
- m_initializing = true;
- ui.kleBackgroundFileName->setText(filename);
- m_initializing = false;
+ m_initializing = true;
+ ui.kleBackgroundFileName->setText(filename);
+ m_initializing = false;
}
void CartesianPlotDock::plotBackgroundOpacityChanged(float opacity){
- m_initializing = true;
- ui.sbBackgroundOpacity->setValue( round(opacity*100.0) );
- m_initializing = false;
+ m_initializing = true;
+ ui.sbBackgroundOpacity->setValue( round(opacity*100.0) );
+ m_initializing = false;
}
void CartesianPlotDock::plotBorderPenChanged(QPen& pen){
- m_initializing = true;
- if(ui.cbBorderStyle->currentIndex() != pen.style())
- ui.cbBorderStyle->setCurrentIndex(pen.style());
- if(ui.kcbBorderColor->color() != pen.color())
- ui.kcbBorderColor->setColor(pen.color());
- if(ui.sbBorderWidth->value() != pen.widthF())
- ui.sbBorderWidth->setValue(Worksheet::convertFromSceneUnits(pen.widthF(),Worksheet::Point));
- m_initializing = false;
+ m_initializing = true;
+ if(ui.cbBorderStyle->currentIndex() != pen.style())
+ ui.cbBorderStyle->setCurrentIndex(pen.style());
+ if(ui.kcbBorderColor->color() != pen.color())
+ ui.kcbBorderColor->setColor(pen.color());
+ if(ui.sbBorderWidth->value() != pen.widthF())
+ ui.sbBorderWidth->setValue(Worksheet::convertFromSceneUnits(pen.widthF(),Worksheet::Point));
+ m_initializing = false;
}
void CartesianPlotDock::plotBorderCornerRadiusChanged(float value){
- m_initializing = true;
- ui.sbBorderCornerRadius->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter));
- m_initializing = false;
+ m_initializing = true;
+ ui.sbBorderCornerRadius->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter)); + m_initializing = false;
}
void CartesianPlotDock::plotBorderOpacityChanged(float value){
- m_initializing = true;
- float v = (float)value*100.;
- ui.sbBorderOpacity->setValue(v);
- m_initializing = false;
+ m_initializing = true;
+ float v = (float)value*100.;
+ ui.sbBorderOpacity->setValue(v);
+ m_initializing = false;
}
void CartesianPlotDock::plotHorizontalPaddingChanged(float value){
- m_initializing = true;
- ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter));
- m_initializing = false;
+ m_initializing = true;
+ ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter)); + m_initializing = false;
}
void CartesianPlotDock::plotVerticalPaddingChanged(float value){
- m_initializing = true;
- ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter));
- m_initializing = false;
+ m_initializing = true;
+ ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(value, \
Worksheet::Centimeter)); + m_initializing = false;
}
//*************************************************************
//******************** SETTINGS *******************************
//*************************************************************
void CartesianPlotDock::loadConfigFromTemplate(KConfig& config) {
- //extract the name of the template from the file name
- QString name;
- int index = config.name().lastIndexOf(QDir::separator());
- if (index!=-1)
- name = config.name().right(config.name().size() - index - 1);
- else
- name = config.name();
+ //extract the name of the template from the file name
+ QString name;
+ int index = config.name().lastIndexOf(QDir::separator());
+ if (index!=-1)
+ name = config.name().right(config.name().size() - index - 1);
+ else
+ name = config.name();
- int size = m_plotList.size();
- if (size>1)
- m_plot->beginMacro(i18n("%1 cartesian plots: template \"%2\" loaded", size, \
name));
- else
- m_plot->beginMacro(i18n("%1: template \"%2\" loaded", m_plot->name(), name));
+ int size = m_plotList.size();
+ if (size>1)
+ m_plot->beginMacro(i18n("%1 cartesian plots: template \"%2\" loaded", 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(), \
Worksheet::Centimeter));
- ui.sbWidth->setValue(Worksheet::convertFromSceneUnits(m_plot->rect().width(), \
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()->backgroundType() );
- 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()->backgroundFileName() );
- ui.kcbBackgroundFirstColor->setColor( m_plot->plotArea()->backgroundFirstColor() );
- ui.kcbBackgroundSecondColor->setColor( m_plot->plotArea()->backgroundSecondColor() \
);
- ui.sbBackgroundOpacity->setValue( \
round(m_plot->plotArea()->backgroundOpacity()*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->plotArea()->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=true;
- GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color());
- m_initializing=false;
+ //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().width(), \
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()->backgroundType() \
); + 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()->backgroundFileName() ); + \
ui.kcbBackgroundFirstColor->setColor( m_plot->plotArea()->backgroundFirstColor() ); + \
ui.kcbBackgroundSecondColor->setColor( m_plot->plotArea()->backgroundSecondColor() ); \
+ ui.sbBackgroundOpacity->setValue( \
round(m_plot->plotArea()->backgroundOpacity()*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->plotArea()->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=true;
+ GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color());
+ m_initializing=false;
}
void CartesianPlotDock::loadConfig(KConfig& config){
-// KConfigGroup group = 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 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->isVisible()) );
-// ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(group.readEntry("Left", \
m_plot->rect().x()), Worksheet::Centimeter));
-// ui.sbTop->setValue(Worksheet::convertFromSceneUnits(group.readEntry("Top", \
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 = \
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 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->isVisible()) ); +// \
ui.sbLeft->setValue(Worksheet::convertFromSceneUnits(group.readEntry("Left", \
m_plot->rect().x()), Worksheet::Centimeter)); +// \
ui.sbTop->setValue(Worksheet::convertFromSceneUnits(group.readEntry("Top", \
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->autoScaleX()));
-// 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->autoScaleX())); +// 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.chkAutoScaleY->setChecked(group.readEntry("AutoScaleY", \
m_plot->autoScaleY()));
-// 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 = config.group("PlotTitle");
- labelWidget->loadConfig(group);
-
- //Scale breakings
- //TODO
-
- //Background-tab
- group = config.group("PlotArea");
- ui.cbBackgroundType->setCurrentIndex( group.readEntry("BackgroundType", (int) \
m_plot->plotArea()->backgroundType()) );
- ui.cbBackgroundColorStyle->setCurrentIndex( group.readEntry("BackgroundColorStyle", \
(int) m_plot->plotArea()->backgroundColorStyle()) );
- ui.cbBackgroundImageStyle->setCurrentIndex( group.readEntry("BackgroundImageStyle", \
(int) m_plot->plotArea()->backgroundImageStyle()) );
- ui.cbBackgroundBrushStyle->setCurrentIndex( group.readEntry("BackgroundBrushStyle", \
(int) m_plot->plotArea()->backgroundBrushStyle()) );
- ui.kleBackgroundFileName->setText( group.readEntry("BackgroundFileName", \
m_plot->plotArea()->backgroundFileName()) );
- ui.kcbBackgroundFirstColor->setColor( group.readEntry("BackgroundFirstColor", \
m_plot->plotArea()->backgroundFirstColor()) );
- ui.kcbBackgroundSecondColor->setColor( group.readEntry("BackgroundSecondColor", \
m_plot->plotArea()->backgroundSecondColor()) );
- ui.sbBackgroundOpacity->setValue( round(group.readEntry("BackgroundOpacity", \
m_plot->plotArea()->backgroundOpacity())*100.0) );
- ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(group.readEntry("HorizontalPadding", \
m_plot->horizontalPadding()), Worksheet::Centimeter));
- ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(group.readEntry("VerticalPadding", \
m_plot->verticalPadding()), Worksheet::Centimeter));
-
- //Border-tab
- ui.kcbBorderColor->setColor( group.readEntry("BorderColor", \
m_plot->plotArea()->borderPen().color()) );
- ui.cbBorderStyle->setCurrentIndex( group.readEntry("BorderStyle", (int) \
m_plot->plotArea()->borderPen().style()) );
- ui.sbBorderWidth->setValue( \
Worksheet::convertFromSceneUnits(group.readEntry("BorderWidth", \
m_plot->plotArea()->borderPen().widthF()), Worksheet::Point) );
- ui.sbBorderCornerRadius->setValue( \
Worksheet::convertFromSceneUnits(group.readEntry("BorderCornerRadius", \
m_plot->plotArea()->borderCornerRadius()), Worksheet::Centimeter) );
- ui.sbBorderOpacity->setValue( group.readEntry("BorderOpacity", \
m_plot->plotArea()->borderOpacity())*100 );
-
- m_initializing=true;
- GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color());
- m_initializing=false;
+// ui.chkAutoScaleY->setChecked(group.readEntry("AutoScaleY", \
m_plot->autoScaleY())); +// 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 = config.group("PlotTitle");
+ labelWidget->loadConfig(group);
+
+ //Scale breakings
+ //TODO
+
+ //Background-tab
+ group = config.group("PlotArea");
+ ui.cbBackgroundType->setCurrentIndex( group.readEntry("BackgroundType", (int) \
m_plot->plotArea()->backgroundType()) ); + \
ui.cbBackgroundColorStyle->setCurrentIndex( group.readEntry("BackgroundColorStyle", \
(int) m_plot->plotArea()->backgroundColorStyle()) ); + \
ui.cbBackgroundImageStyle->setCurrentIndex( group.readEntry("BackgroundImageStyle", \
(int) m_plot->plotArea()->backgroundImageStyle()) ); + \
ui.cbBackgroundBrushStyle->setCurrentIndex( group.readEntry("BackgroundBrushStyle", \
(int) m_plot->plotArea()->backgroundBrushStyle()) ); + \
ui.kleBackgroundFileName->setText( group.readEntry("BackgroundFileName", \
m_plot->plotArea()->backgroundFileName()) ); + \
ui.kcbBackgroundFirstColor->setColor( group.readEntry("BackgroundFirstColor", \
m_plot->plotArea()->backgroundFirstColor()) ); + \
ui.kcbBackgroundSecondColor->setColor( group.readEntry("BackgroundSecondColor", \
m_plot->plotArea()->backgroundSecondColor()) ); + \
ui.sbBackgroundOpacity->setValue( round(group.readEntry("BackgroundOpacity", \
m_plot->plotArea()->backgroundOpacity())*100.0) ); + \
ui.sbPaddingHorizontal->setValue(Worksheet::convertFromSceneUnits(group.readEntry("HorizontalPadding", \
m_plot->horizontalPadding()), Worksheet::Centimeter)); + \
ui.sbPaddingVertical->setValue(Worksheet::convertFromSceneUnits(group.readEntry("VerticalPadding", \
m_plot->verticalPadding()), Worksheet::Centimeter)); +
+ //Border-tab
+ ui.kcbBorderColor->setColor( group.readEntry("BorderColor", \
m_plot->plotArea()->borderPen().color()) ); + ui.cbBorderStyle->setCurrentIndex( \
group.readEntry("BorderStyle", (int) m_plot->plotArea()->borderPen().style()) ); + \
ui.sbBorderWidth->setValue( \
Worksheet::convertFromSceneUnits(group.readEntry("BorderWidth", \
m_plot->plotArea()->borderPen().widthF()), Worksheet::Point) ); + \
ui.sbBorderCornerRadius->setValue( \
Worksheet::convertFromSceneUnits(group.readEntry("BorderCornerRadius", \
m_plot->plotArea()->borderCornerRadius()), Worksheet::Centimeter) ); + \
ui.sbBorderOpacity->setValue( group.readEntry("BorderOpacity", \
m_plot->plotArea()->borderOpacity())*100 ); +
+ m_initializing=true;
+ GuiTools::updatePenStyles(ui.cbBorderStyle, ui.kcbBorderColor->color());
+ m_initializing=false;
}
void CartesianPlotDock::saveConfig(KConfig& config){
-// KConfigGroup group = config.group( "CartesianPlot" );
-
- //General-tab
- //TODO: decide whether to save properties, not related to the appearance/style of \
the plot
-// group.writeEntry("Visible", ui.chkVisible->isChecked());
-// group.writeEntry("Left", Worksheet::convertToSceneUnits(ui.sbLeft->value(), \
Worksheet::Centimeter));
-// group.writeEntry("Top", Worksheet::convertToSceneUnits(ui.sbTop->value(), \
Worksheet::Centimeter));
-// group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->value(), \
Worksheet::Centimeter));
-// group.writeEntry("Height", Worksheet::convertToSceneUnits(ui.sbHeight->value(), \
Worksheet::Centimeter)); +// KConfigGroup group = config.group( "CartesianPlot" );
+
+ //General-tab
+ //TODO: decide whether to save properties, not related to the appearance/style \
of the plot +// group.writeEntry("Visible", ui.chkVisible->isChecked());
+// group.writeEntry("Left", Worksheet::convertToSceneUnits(ui.sbLeft->value(), \
Worksheet::Centimeter)); +// group.writeEntry("Top", \
Worksheet::convertToSceneUnits(ui.sbTop->value(), Worksheet::Centimeter)); +// \
group.writeEntry("Width", Worksheet::convertToSceneUnits(ui.sbWidth->value(), \
Worksheet::Centimeter)); +// group.writeEntry("Height", \
Worksheet::convertToSceneUnits(ui.sbHeight->value(), Worksheet::Centimeter)); //
-// group.writeEntry("AutoScaleX", ui.chkAutoScaleX->isChecked());
-// group.writeEntry("xMin", ui.kleXMin->text());
-// group.writeEntry("xMax", ui.kleXMax->text());
-// group.writeEntry("xScale", ui.cbXScaling->currentIndex());
+// group.writeEntry("AutoScaleX", ui.chkAutoScaleX->isChecked());
+// group.writeEntry("xMin", ui.kleXMin->text());
+// group.writeEntry("xMax", ui.kleXMax->text());
+// group.writeEntry("xScale", ui.cbXScaling->currentIndex());
//
-// group.writeEntry("AutoScaleY", ui.chkAutoScaleY->isChecked());
-// group.writeEntry("yMin", ui.kleYMin->text());
-// group.writeEntry("yMax", ui.kleYMax->text());
-// group.writeEntry("yScale", ui.cbYScaling->currentIndex());
-
- //Title
- KConfigGroup group = config.group("PlotTitle");
- labelWidget->saveConfig(group);
-
- //Scale breakings
- //TODO
-
- //Background
- group = config.group("PlotArea");
- group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex());
- group.writeEntry("BackgroundColorStyle", \
ui.cbBackgroundColorStyle->currentIndex());
- group.writeEntry("BackgroundImageStyle", \
ui.cbBackgroundImageStyle->currentIndex());
- group.writeEntry("BackgroundBrushStyle", \
ui.cbBackgroundBrushStyle->currentIndex());
- group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text());
- group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->color());
- group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor->color());
- group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/100.0);
- group.writeEntry("HorizontalPadding", \
Worksheet::convertToSceneUnits(ui.sbPaddingHorizontal->value(), \
Worksheet::Centimeter));
- group.writeEntry("VerticalPadding", \
Worksheet::convertToSceneUnits(ui.sbPaddingVertical->value(), \
Worksheet::Centimeter));
-
- //Border
- group.writeEntry("BorderStyle", ui.cbBorderStyle->currentIndex());
- group.writeEntry("BorderColor", ui.kcbBorderColor->color());
- group.writeEntry("BorderWidth", \
Worksheet::convertToSceneUnits(ui.sbBorderWidth->value(), \
Worksheet::Point));
- group.writeEntry("BorderCornerRadius", \
Worksheet::convertToSceneUnits(ui.sbBorderCornerRadius->value(), \
Worksheet::Centimeter));
- group.writeEntry("BorderOpacity", ui.sbBorderOpacity->value()/100.0);
-
- config.sync();
+// group.writeEntry("AutoScaleY", ui.chkAutoScaleY->isChecked());
+// group.writeEntry("yMin", ui.kleYMin->text());
+// group.writeEntry("yMax", ui.kleYMax->text());
+// group.writeEntry("yScale", ui.cbYScaling->currentIndex());
+
+ //Title
+ KConfigGroup group = config.group("PlotTitle");
+ labelWidget->saveConfig(group);
+
+ //Scale breakings
+ //TODO
+
+ //Background
+ group = config.group("PlotArea");
+ group.writeEntry("BackgroundType", ui.cbBackgroundType->currentIndex());
+ group.writeEntry("BackgroundColorStyle", \
ui.cbBackgroundColorStyle->currentIndex()); + \
group.writeEntry("BackgroundImageStyle", ui.cbBackgroundImageStyle->currentIndex()); \
+ group.writeEntry("BackgroundBrushStyle", \
ui.cbBackgroundBrushStyle->currentIndex()); + \
group.writeEntry("BackgroundFileName", ui.kleBackgroundFileName->text()); + \
group.writeEntry("BackgroundFirstColor", ui.kcbBackgroundFirstColor->color()); + \
group.writeEntry("BackgroundSecondColor", ui.kcbBackgroundSecondColor->color()); + \
group.writeEntry("BackgroundOpacity", ui.sbBackgroundOpacity->value()/100.0); + \
group.writeEntry("HorizontalPadding", \
Worksheet::convertToSceneUnits(ui.sbPaddingHorizontal->value(), \
Worksheet::Centimeter)); + group.writeEntry("VerticalPadding", \
Worksheet::convertToSceneUnits(ui.sbPaddingVertical->value(), \
Worksheet::Centimeter)); +
+ //Border
+ group.writeEntry("BorderStyle", ui.cbBorderStyle->currentIndex());
+ group.writeEntry("BorderColor", ui.kcbBorderColor->color());
+ group.writeEntry("BorderWidth", \
Worksheet::convertToSceneUnits(ui.sbBorderWidth->value(), Worksheet::Point)); + \
group.writeEntry("BorderCornerRadius", \
Worksheet::convertToSceneUnits(ui.sbBorderCornerRadius->value(), \
Worksheet::Centimeter)); + group.writeEntry("BorderOpacity", \
ui.sbBorderOpacity->value()/100.0); +
+ config.sync();
}
diff --git a/src/kdefrontend/dockwidgets/CartesianPlotDock.h \
b/src/kdefrontend/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 <QList>
+#include <KConfig>
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 <QDir>
#include <QFileDialog>
#include <KUrlCompletion>
+#include <KLocalizedString>
#include <math.h>
@@ -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 = new KUrlCompletion();
ui.kleBackgroundFileName->setCompletionObject(comp);
diff --git a/src/kdefrontend/dockwidgets/CartesianPlotLegendDock.h \
b/src/kdefrontend/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 <QList>
+#include <KConfig>
#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/dockwidgets/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 <KLocalizedString>
+
/*!
\class ColumnDock
\brief Provides a widget for editing the properties of the spreadsheet columns \
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 <KConfigGroup>
/*!
\class ProjectDock
diff --git a/src/kdefrontend/dockwidgets/ProjectDock.h \
b/src/kdefrontend/dockwidgets/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 <KConfig>
class Project;
class AbstractAspect;
diff --git a/src/kdefrontend/dockwidgets/SpreadsheetDock.cpp \
b/src/kdefrontend/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 <QDir>
+#include <KLocalizedString>
+#include <KConfigGroup>
/*!
\class SpreadsheetDock
diff --git a/src/kdefrontend/dockwidgets/SpreadsheetDock.h \
b/src/kdefrontend/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 <QtGui/QWidget>
+#include <QtWidgets/QWidget>
#include <QtCore/QList>
#include <kconfig.h>
#include "ui_spreadsheetdock.h"
diff --git a/src/kdefrontend/dockwidgets/WorksheetDock.cpp \
b/src/kdefrontend/dockwidgets/WorksheetDock.cpp index 761afb7..75c07c5 100644
--- a/src/kdefrontend/dockwidgets/WorksheetDock.cpp
+++ b/src/kdefrontend/dockwidgets/WorksheetDock.cpp
@@ -34,6 +34,8 @@
#include <QPrinter>
#include <QFileDialog>
#include <KUrlCompletion>
+#include <KLocalizedString>
+#include <KConfigGroup>
#include <math.h>
@@ -85,7 +87,7 @@ WorksheetDock::WorksheetDock(QWidget *parent): QWidget(parent){
//Background-tab
ui.cbBackgroundColorStyle->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
ui.kleBackgroundFileName->setClearButtonShown(true);
- ui.bOpen->setIcon( KIcon("document-open") );
+ ui.bOpen->setIcon( QIcon("document-open") );
KUrlCompletion *comp = 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 <KConfig>
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 <QPainter>
#include <QDir>
#include <QDebug>
+#include <KLocalizedString>
+#include <KConfigGroup>
/*!
\class XYCurveDock
diff --git a/src/kdefrontend/dockwidgets/XYCurveDock.h \
b/src/kdefrontend/dockwidgets/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 <KConfig>
class XYCurve;
class TreeViewComboBox;
diff --git a/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp \
b/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp index c9f00d3..55b6793 100644
--- a/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp
+++ b/src/kdefrontend/dockwidgets/XYEquationCurveDock.cpp
@@ -39,6 +39,7 @@
#include <QMenu>
#include <QWidgetAction>
#include <QScrollBar>
+#include <KLocalizedString>
/*!
\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/kdefrontend/dockwidgets/XYFitCurveDock.cpp index 117df23..2b31ece 100644
--- a/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
+++ b/src/kdefrontend/dockwidgets/XYFitCurveDock.cpp
@@ -39,7 +39,7 @@
#include <QMenu>
#include <QWidgetAction>
#include <QDebug>
-
+#include <KLocalizedString>
/*!
\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 = 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 <KLocalizedString>
/*!
\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 <KMessageBox>
#include <KPushButton>
#include <QStringList>
+#include <KLocalizedString>
+#include <KConfigGroup>
+#include <KSharedConfig>
/*!
\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/kdefrontend/spreadsheet/FunctionValuesDialog.cpp index 47f114a..48b2488 100644
--- a/src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp
+++ b/src/kdefrontend/spreadsheet/FunctionValuesDialog.cpp
@@ -38,6 +38,7 @@
#include <QMenu>
#include <QWidgetAction>
+#include <KLocalizedString>
/*!
@@ -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/kdefrontend/spreadsheet/RandomValuesDialog.cpp index 3e436e6..c0f141d 100644
--- a/src/kdefrontend/spreadsheet/RandomValuesDialog.cpp
+++ b/src/kdefrontend/spreadsheet/RandomValuesDialog.cpp
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
+#include <KLocalizedString>
/*!
\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 = 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* fitData): \
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/kdefrontend/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 <QKeyEvent>
+#include <KLocalizedString>
/*!
\class FitParametersWidget
@@ -38,8 +39,8 @@
*/
FitParametersWidget::FitParametersWidget(QWidget* parent, XYFitCurve::FitData* 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 = ExpressionParser::getInstance();
ui.cbGroup->addItems(m_expressionParser->functionsGroups());
diff --git a/src/kdefrontend/widgets/LabelWidget.cpp \
b/src/kdefrontend/widgets/LabelWidget.cpp index cb12e24..328f3bc 100644
--- a/src/kdefrontend/widgets/LabelWidget.cpp
+++ b/src/kdefrontend/widgets/LabelWidget.cpp
@@ -34,134 +34,135 @@
#include <QWidgetAction>
#include <KCharSelect>
+#include <KLocalizedString>
#include <KMenu>
/*!
- \class LabelWidget
- \brief Widget for editing the properties of a TextLabel object, mostly used 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 first \
separator to be removed
-
- QGridLayout* layout =static_cast<QGridLayout*>(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(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(fontColorChanged(QColor)));
- connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(bool)));
- connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, \
SLOT(fontItalicChanged(bool)));
- connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, \
SLOT(fontUnderlineChanged(bool)));
- connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, \
SLOT(fontStrikeOutChanged(bool)));
- connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, \
SLOT(fontSuperScriptChanged(bool)));
- connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, \
SLOT(fontSubScriptChanged(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(insertDateTime(QAction*)) );
- connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, \
SLOT(fontChanged(QFont)));
- connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(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(customPositionXChanged(double)) );
- connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, \
SLOT(customPositionYChanged(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(rotationChanged(int)) \
);
- connect( ui.sbOffset, SIGNAL(valueChanged(double)), this, \
SLOT(offsetChanged(double)) );
-
- connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) \
); + ui.setupUi(this);
+
+ m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the first \
separator to be removed +
+ QGridLayout* layout =static_cast<QGridLayout*>(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(fontColorChanged(QColor))); + connect(ui.tbFontBold, SIGNAL(clicked(bool)), \
this, SLOT(fontBoldChanged(bool))); + connect(ui.tbFontItalic, \
SIGNAL(clicked(bool)), this, SLOT(fontItalicChanged(bool))); + \
connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, \
SLOT(fontUnderlineChanged(bool))); + connect(ui.tbFontStrikeOut, \
SIGNAL(clicked(bool)), this, SLOT(fontStrikeOutChanged(bool))); + \
connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, \
SLOT(fontSuperScriptChanged(bool))); + connect(ui.tbFontSubScript, \
SIGNAL(clicked(bool)), this, SLOT(fontSubScriptChanged(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(insertDateTime(QAction*)) ); + connect(ui.kfontRequester, \
SIGNAL(fontSelected(QFont)), this, SLOT(fontChanged(QFont))); + \
connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(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(customPositionXChanged(double)) ); + connect( ui.sbPositionY, \
SIGNAL(valueChanged(double)), this, SLOT(customPositionYChanged(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(rotationChanged(int)) \
); + connect( ui.sbOffset, SIGNAL(valueChanged(double)), this, \
SLOT(offsetChanged(double)) ); +
+ connect( ui.chbVisible, SIGNAL(clicked(bool)), this, \
SLOT(visibilityChanged(bool)) ); }
void LabelWidget::setLabels(QList<TextLabel*> labels){
- m_labelsList = labels;
- m_label = labels.first();
+ m_labelsList = labels;
+ m_label = labels.first();
- ui.lOffset->hide();
- ui.sbOffset->hide();
+ ui.lOffset->hide();
+ ui.sbOffset->hide();
- this->load();
- initConnections();
+ this->load();
+ initConnections();
}
void LabelWidget::setAxes(QList<Axis*> axes){
- m_labelsList.clear();
- foreach(Axis* axis, axes) {
- m_labelsList.append(axis->title());
- connect(axis, SIGNAL(titleOffsetChanged(float)), this, \
SLOT(labelOffsetChanged(float)) );
- connect(axis->title(), SIGNAL(rotationAngleChanged(float)), this, \
SLOT(labelRotationAngleChanged(float)) );
- }
+ m_labelsList.clear();
+ foreach(Axis* axis, axes) {
+ m_labelsList.append(axis->title());
+ connect(axis, SIGNAL(titleOffsetChanged(float)), this, \
SLOT(labelOffsetChanged(float)) ); + connect(axis->title(), \
SIGNAL(rotationAngleChanged(float)), this, SLOT(labelRotationAngleChanged(float)) ); \
+ }
- m_axesList = axes;
- m_label = m_labelsList.first();
+ m_axesList = axes;
+ m_label = 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::HorizontalAlignment)),
- this, SLOT(labelHorizontalAlignmentChanged(TextLabel::HorizontalAlignment)) );
- connect( m_label, SIGNAL(verticalAlignmentChanged(TextLabel::VerticalAlignment)),
- this, SLOT(labelVerticalAlignmentChanged(TextLabel::VerticalAlignment)) );
- connect( m_label, SIGNAL(rotationAngleChanged(float)), this, \
SLOT(labelRotationAngleChanged(float)) );
- connect( m_label, SIGNAL(visibleChanged(bool)), this, \
SLOT(labelVisibleChanged(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::HorizontalAlignment)), + \
this, SLOT(labelHorizontalAlignmentChanged(TextLabel::HorizontalAlignment)) ); + \
connect( m_label, SIGNAL(verticalAlignmentChanged(TextLabel::VerticalAlignment)), + \
this, SLOT(labelVerticalAlignmentChanged(TextLabel::VerticalAlignment)) ); + \
connect( m_label, SIGNAL(rotationAngleChanged(float)), this, \
SLOT(labelRotationAngleChanged(float)) ); + connect( m_label, \
SIGNAL(visibleChanged(bool)), this, SLOT(labelVisibleChanged(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=ui.teLabel->toPlainText();
- TextLabel::TextWrapper wrapper(text, true);
+ if (ui.tbTexUsed->isChecked()) {
+ QString text=ui.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 text \
available in QTextEdit
- QString text;
- if (ui.teLabel->toPlainText() == "")
- text = "";
- else
- text = ui.teLabel->toHtml();
+ foreach(TextLabel* label, m_labelsList)
+ label->setText(wrapper);
+ }else{
+ //save an empty string instead of a html-string with empty body, if no text \
available in QTextEdit + QString text;
+ if (ui.teLabel->toPlainText() == "")
+ text = "";
+ else
+ text = 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() == QFont::Bold)
- ui.tbFontBold->setChecked(true);
- else
- ui.tbFontBold->setChecked(false);
- ui.tbFontItalic->setChecked(format.fontItalic());
- ui.tbFontUnderline->setChecked(format.fontUnderline());
- if(format.verticalAlignment() == QTextCharFormat::AlignSuperScript)
- ui.tbFontSuperScript->setChecked(true);
- else
- ui.tbFontSuperScript->setChecked(false);
- if(format.verticalAlignment() == 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() == QFont::Bold)
+ ui.tbFontBold->setChecked(true);
+ else
+ ui.tbFontBold->setChecked(false);
+ ui.tbFontItalic->setChecked(format.fontItalic());
+ ui.tbFontUnderline->setChecked(format.fontUnderline());
+ if(format.verticalAlignment() == QTextCharFormat::AlignSuperScript)
+ ui.tbFontSuperScript->setChecked(true);
+ else
+ ui.tbFontSuperScript->setChecked(false);
+ if(format.verticalAlignment() == 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 = checked ? ui.teLabel->toPlainText() : ui.teLabel->toHtml();
- TextLabel::TextWrapper wrapper(text, checked);
- foreach(TextLabel* label, m_labelsList)
- label->setText(wrapper);
+ QString text = checked ? ui.teLabel->toPlainText() : ui.teLabel->toHtml();
+ 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 = ui.teLabel->currentCharFormat();
- format.setFontStrikeOut(checked);
- ui.teLabel->setCurrentCharFormat(format);
+ QTextCharFormat format = 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 = ui.teLabel->currentCharFormat();
- if (checked)
- format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
- else
- format.setVerticalAlignment(QTextCharFormat::AlignNormal);
+ QTextCharFormat format = 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 = ui.teLabel->currentCharFormat();
- if (checked)
- format.setVerticalAlignment(QTextCharFormat::AlignSubScript);
- else
- format.setVerticalAlignment(QTextCharFormat::AlignNormal);
+ QTextCharFormat format = 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::CharacterTable \
| 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()));
+ QMenu menu;
+ KCharSelect selection(this,0,KCharSelect::SearchLine | \
KCharSelect::CharacterTable | 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 = new QWidgetAction(this);
- widgetAction->setDefaultWidget(&selection);
- menu.addAction(widgetAction);
+ QWidgetAction *widgetAction = 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.sizeHint().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 = 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 = 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 = 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 = 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 (left, \
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 position"-item is \
selected/deselected
- if (index == ui.cbPositionX->count()-1 ){
- ui.sbPositionX->setEnabled(true);
- }else{
- ui.sbPositionX->setEnabled(false);
- }
+ //Enable/disable the spinbox for the x- oordinates if the "custom position"-item \
is selected/deselected + if (index == ui.cbPositionX->count()-1 ){
+ ui.sbPositionX->setEnabled(true);
+ }else{
+ ui.sbPositionX->setEnabled(false);
+ }
- if (m_initializing)
- return;
+ if (m_initializing)
+ return;
- TextLabel::PositionWrapper position = m_label->position();
- position.horizontalPosition = TextLabel::HorizontalPosition(index);
- foreach(TextLabel* label, m_labelsList)
- label->setPosition(position);
+ TextLabel::PositionWrapper position = m_label->position();
+ position.horizontalPosition = TextLabel::HorizontalPosition(index);
+ foreach(TextLabel* label, m_labelsList)
+ label->setPosition(position);
}
/*!
- called when label's current horizontal position relative to its parent (top, \
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 position"-item is \
selected/deselected
- if (index == ui.cbPositionY->count()-1 ){
- ui.sbPositionY->setEnabled(true);
- }else{
- ui.sbPositionY->setEnabled(false);
- }
+ //Enable/disable the spinbox for the y- oordinates if the "custom position"-item \
is selected/deselected + if (index == ui.cbPositionY->count()-1 ){
+ ui.sbPositionY->setEnabled(true);
+ }else{
+ ui.sbPositionY->setEnabled(false);
+ }
- if (m_initializing)
- return;
+ if (m_initializing)
+ return;
- TextLabel::PositionWrapper position = m_label->position();
- position.verticalPosition = TextLabel::VerticalPosition(index);
- foreach(TextLabel* label, m_labelsList)
- label->setPosition(position);
+ TextLabel::PositionWrapper position = m_label->position();
+ position.verticalPosition = 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 = m_label->position();
- position.point.setX(Worksheet::convertToSceneUnits(value, Worksheet::Centimeter));
- foreach(TextLabel* label, m_labelsList)
- label->setPosition(position);
+ TextLabel::PositionWrapper position = m_label->position();
+ position.point.setX(Worksheet::convertToSceneUnits(value, \
Worksheet::Centimeter)); + foreach(TextLabel* label, m_labelsList)
+ label->setPosition(position);
}
void LabelWidget::customPositionYChanged(double value){
- if (m_initializing)
- return;
+ if (m_initializing)
+ return;
- TextLabel::PositionWrapper position = m_label->position();
- position.point.setY(Worksheet::convertToSceneUnits(value, Worksheet::Centimeter));
- foreach(TextLabel* label, m_labelsList)
- label->setPosition(position);
+ TextLabel::PositionWrapper position = m_label->position();
+ position.point.setY(Worksheet::convertToSceneUnits(value, \
Worksheet::Centimeter)); + 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::Point) );
+ foreach(Axis* axis, m_axesList)
+ axis->setTitleOffset( Worksheet::convertToSceneUnits(value, \
Worksheet::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& text){
- m_initializing = true;
+ m_initializing = true;
- //save and restore the current cursor position after changing the text
- QTextCursor cursor = ui.teLabel->textCursor();
- int position = 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 = ui.teLabel->textCursor();
+ int position = cursor.position();
+ ui.teLabel->setText(text.text);
+ cursor.movePosition(QTextCursor::Start);
+ cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, position);
+ ui.teLabel->setTextCursor(cursor);
- ui.tbTexUsed->setChecked(text.teXUsed);
- this->teXUsedChanged(text.teXUsed);
- m_initializing = false;
+ ui.tbTexUsed->setChecked(text.teXUsed);
+ this->teXUsedChanged(text.teXUsed);
+ m_initializing = false;
}
void LabelWidget::labelTeXFontSizeChanged(const int size){
- m_initializing = true;
- ui.sbFontSize->setValue(size);
- m_initializing = false;
+ m_initializing = true;
+ ui.sbFontSize->setValue(size);
+ m_initializing = false;
}
void LabelWidget::labelTeXFontColorChanged(const QColor color){
- m_initializing = true;
- ui.kcbFontColor->setColor(color);
- m_initializing = false;
+ m_initializing = true;
+ ui.kcbFontColor->setColor(color);
+ m_initializing = false;
}
void LabelWidget::labelPositionChanged(const TextLabel::PositionWrapper& position){
- m_initializing = 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 = false;
+ m_initializing = 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 = \
false; }
void LabelWidget::labelHorizontalAlignmentChanged(TextLabel::HorizontalAlignment \
index){
- m_initializing = true;
- ui.cbHorizontalAlignment->setCurrentIndex(index);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbHorizontalAlignment->setCurrentIndex(index);
+ m_initializing = false;
}
void LabelWidget::labelVerticalAlignmentChanged(TextLabel::VerticalAlignment index){
- m_initializing = true;
- ui.cbVerticalAlignment->setCurrentIndex(index);
- m_initializing = false;
+ m_initializing = true;
+ ui.cbVerticalAlignment->setCurrentIndex(index);
+ m_initializing = false;
}
void LabelWidget::labelOffsetChanged(float offset){
- m_initializing = true;
- ui.sbOffset->setValue(Worksheet::convertFromSceneUnits(offset, Worksheet::Point));
- m_initializing = false;
+ m_initializing = true;
+ ui.sbOffset->setValue(Worksheet::convertFromSceneUnits(offset, \
Worksheet::Point)); + m_initializing = false;
}
void LabelWidget::labelRotationAngleChanged(float angle){
- m_initializing = true;
- ui.sbRotation->setValue(angle);
- m_initializing = false;
+ m_initializing = true;
+ ui.sbRotation->setValue(angle);
+ m_initializing = false;
}
void LabelWidget::labelVisibleChanged(bool on){
- m_initializing = true;
- ui.chbVisible->setChecked(on);
- m_initializing = false;
+ m_initializing = true;
+ ui.chbVisible->setChecked(on);
+ m_initializing = false;
}
//**********************************************************
//******************** SETTINGS ****************************
//**********************************************************
void LabelWidget::load() {
- if(m_label == NULL)
- return;
+ if(m_label == NULL)
+ return;
- m_initializing = true;
+ m_initializing = 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()==QFont::Bold);
- ui.tbFontItalic->setChecked(ui.teLabel->fontItalic());
- ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline());
- QTextCharFormat format = ui.teLabel->currentCharFormat();
- ui.tbFontStrikeOut->setChecked(format.fontStrikeOut());
- ui.tbFontSuperScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSuperScript);
- ui.tbFontSubScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSubScript);
- ui.kfontRequester->setFont(format.font());
+ //Set text format
+ ui.tbFontBold->setChecked(ui.teLabel->fontWeight()==QFont::Bold);
+ ui.tbFontItalic->setChecked(ui.teLabel->fontItalic());
+ ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline());
+ QTextCharFormat format = ui.teLabel->currentCharFormat();
+ ui.tbFontStrikeOut->setChecked(format.fontStrikeOut());
+ ui.tbFontSuperScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSuperScript); + \
ui.tbFontSubScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSubScript); + ui.kfontRequester->setFont(format.font());
- // Geometry
- ui.cbPositionX->setCurrentIndex( (int) m_label->position().horizontalPosition );
- ui.sbPositionX->setValue( \
Worksheet::convertFromSceneUnits(m_label->position().point.x(),Worksheet::Centimeter) \
);
- ui.cbPositionY->setCurrentIndex( (int) m_label->position().verticalPosition );
- ui.sbPositionY->setValue( \
Worksheet::convertFromSceneUnits(m_label->position().point.y(),Worksheet::Centimeter) \
); + // Geometry
+ ui.cbPositionX->setCurrentIndex( (int) m_label->position().horizontalPosition );
+ ui.sbPositionX->setValue( \
Worksheet::convertFromSceneUnits(m_label->position().point.x(),Worksheet::Centimeter) \
); + ui.cbPositionY->setCurrentIndex( (int) m_label->position().verticalPosition \
); + ui.sbPositionY->setValue( \
Worksheet::convertFromSceneUnits(m_label->position().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->horizontalAlignment() );
- ui.cbVerticalAlignment->setCurrentIndex( (int) m_label->verticalAlignment() );
- ui.sbRotation->setValue( m_label->rotationAngle() );
+ ui.cbHorizontalAlignment->setCurrentIndex( (int) m_label->horizontalAlignment() \
); + ui.cbVerticalAlignment->setCurrentIndex( (int) m_label->verticalAlignment() \
); + ui.sbRotation->setValue( m_label->rotationAngle() );
- m_initializing = false;
+ m_initializing = false;
}
void LabelWidget::loadConfig(KConfigGroup &group) {
- if(m_label == NULL)
- return;
+ if(m_label == NULL)
+ return;
- m_initializing = true;
+ m_initializing = true;
- ui.chbVisible->setChecked( group.readEntry("Visible", m_label->isVisible()) );
+ ui.chbVisible->setChecked( group.readEntry("Visible", m_label->isVisible()) );
- //Text
- ui.tbTexUsed->setChecked(group.readEntry("TeXUsed", (bool) \
m_label->text().teXUsed));
- ui.sbFontSize->setValue( group.readEntry("TeXFontSize", m_label->teXFontSize()) );
- if(m_label->text().teXUsed)
- ui.kcbFontColor->setColor(group.readEntry("TeXFontColor", \
m_label->teXFontColor())); + //Text
+ ui.tbTexUsed->setChecked(group.readEntry("TeXUsed", (bool) \
m_label->text().teXUsed)); + ui.sbFontSize->setValue( \
group.readEntry("TeXFontSize", m_label->teXFontSize()) ); + \
if(m_label->text().teXUsed) + \
ui.kcbFontColor->setColor(group.readEntry("TeXFontColor", m_label->teXFontColor())); \
- //Set text format
- ui.tbFontBold->setChecked(ui.teLabel->fontWeight()==QFont::Bold);
- ui.tbFontItalic->setChecked(ui.teLabel->fontItalic());
- ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline());
- QTextCharFormat format = ui.teLabel->currentCharFormat();
- ui.tbFontStrikeOut->setChecked(format.fontStrikeOut());
- ui.tbFontSuperScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSuperScript);
- ui.tbFontSubScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSubScript);
- ui.kfontRequester->setFont(format.font());
+ //Set text format
+ ui.tbFontBold->setChecked(ui.teLabel->fontWeight()==QFont::Bold);
+ ui.tbFontItalic->setChecked(ui.teLabel->fontItalic());
+ ui.tbFontUnderline->setChecked(ui.teLabel->fontUnderline());
+ QTextCharFormat format = ui.teLabel->currentCharFormat();
+ ui.tbFontStrikeOut->setChecked(format.fontStrikeOut());
+ ui.tbFontSuperScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSuperScript); + \
ui.tbFontSubScript->setChecked(format.verticalAlignment() == \
QTextCharFormat::AlignSubScript); + ui.kfontRequester->setFont(format.font());
- // Geometry
- ui.cbPositionX->setCurrentIndex( group.readEntry("PositionX", (int) \
m_label->position().horizontalPosition ) );
- ui.sbPositionX->setValue( \
Worksheet::convertFromSceneUnits(group.readEntry("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.readEntry("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.readEntry("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.readEntry("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.readEntry("Offset", \
m_axesList.first()->titleOffset()), Worksheet::Point) );
- ui.cbHorizontalAlignment->setCurrentIndex( group.readEntry("HorizontalAlignment", \
(int) m_label->horizontalAlignment()) );
- ui.cbVerticalAlignment->setCurrentIndex( group.readEntry("VerticalAlignment", (int) \
m_label->verticalAlignment()) );
- ui.sbRotation->setValue( group.readEntry("Rotation", m_label->rotationAngle()) );
+ ui.cbHorizontalAlignment->setCurrentIndex( \
group.readEntry("HorizontalAlignment", (int) m_label->horizontalAlignment()) ); + \
ui.cbVerticalAlignment->setCurrentIndex( group.readEntry("VerticalAlignment", (int) \
m_label->verticalAlignment()) ); + ui.sbRotation->setValue( \
group.readEntry("Rotation", m_label->rotationAngle()) );
- m_initializing = false;
+ m_initializing = 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.sbPositionX->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.sbOffset->value(), \
Worksheet::Point) );
-
- group.writeEntry("HorizontalAlignment", ui.cbHorizontalAlignment->currentIndex());
- group.writeEntry("VerticalAlignment", ui.cbVerticalAlignment->currentIndex());
- 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.sbPositionX->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.sbOffset->value(), Worksheet::Point) ); +
+ group.writeEntry("HorizontalAlignment", \
ui.cbHorizontalAlignment->currentIndex()); + group.writeEntry("VerticalAlignment", \
ui.cbVerticalAlignment->currentIndex()); + group.writeEntry("Rotation", \
ui.sbRotation->value()); }
diff --git a/src/kdefrontend/widgets/LabelWidget.h \
b/src/kdefrontend/widgets/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 <KConfigGroup>
class Label;
class Axis;
diff --git a/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp \
b/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp index 0d4d88d..70efa49 100644
--- a/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
+++ b/src/kdefrontend/worksheet/ExportWorksheetDialog.cpp
@@ -34,6 +34,8 @@
#include <KPushButton>
#include <QStringList>
#include <QDesktopWidget>
+#include <KLocalizedString>
+#include <KSharedConfig>
/*!
\class ExportWorksheetDialog
@@ -50,13 +52,13 @@ ExportWorksheetDialog::ExportWorksheetDialog(QWidget* parent) : \
KDialog(parent) KUrlCompletion *comp = 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 (SVG)");
+ ui.cbFormat->addItem(QIcon("application-pdf"), "Portable data format (PDF)");
+ ui.cbFormat->addItem(QIcon("image-x-eps"), "Encapsulated PostScript (EPS)");
+ 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 Graphics \
(PNG)");
ui.cbExportArea->addItem("Object's bounding box");
ui.cbExportArea->addItem("Current selection");
@@ -81,7 +83,7 @@ ExportWorksheetDialog::ExportWorksheetDialog(QWidget* parent) : \
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());
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic