[Kst] branches/work/kst/portto4/kst/src/libkstapp
George Staikos
staikos at kde.org
Mon May 28 19:40:01 CEST 2007
SVN commit 669167 by staikos:
namespace
M +3 -4 kstapplication.cpp
M +2 -2 kstapplication.h
M +23 -21 kstmainwindow.cpp
M +8 -8 kstmainwindow.h
--- branches/work/kst/portto4/kst/src/libkstapp/kstapplication.cpp #669166:669167
@@ -16,7 +16,7 @@
QCoreApplication::setApplicationName("Kst");
- _mainWindow = new KstMainWindow;
+ _mainWindow = new Kst::MainWindow;
connect(this, SIGNAL(aboutToQuit()), _mainWindow, SLOT(aboutToQuit()));
_mainWindow->show();
@@ -24,12 +24,11 @@
KstApplication::~KstApplication() {
- if (_mainWindow)
- delete _mainWindow;
+ delete _mainWindow;
}
-KstMainWindow *KstApplication::mainWindow() const {
+Kst::MainWindow *KstApplication::mainWindow() const {
return _mainWindow;
}
--- branches/work/kst/portto4/kst/src/libkstapp/kstapplication.h #669166:669167
@@ -28,10 +28,10 @@
KstApplication(int &argc, char **argv);
virtual ~KstApplication();
- KstMainWindow *mainWindow() const;
+ Kst::MainWindow *mainWindow() const;
private:
- QPointer<KstMainWindow> _mainWindow;
+ QPointer<Kst::MainWindow> _mainWindow;
};
#endif
--- branches/work/kst/portto4/kst/src/libkstapp/kstmainwindow.cpp #669166:669167
@@ -19,9 +19,9 @@
#include <QtGui>
-using namespace Kst;
+namespace Kst {
-KstMainWindow::KstMainWindow() {
+MainWindow::MainWindow() {
_tabWidget = new QTabWidget(this);
_undoGroup = new QUndoGroup(this);
@@ -42,26 +42,26 @@
}
-KstMainWindow::~KstMainWindow() {
+MainWindow::~MainWindow() {
}
-QUndoGroup *KstMainWindow::undoGroup() const {
+QUndoGroup *MainWindow::undoGroup() const {
return _undoGroup;
}
-QTabWidget *KstMainWindow::tabWidget() const {
+QTabWidget *MainWindow::tabWidget() const {
return _tabWidget;
}
-View *KstMainWindow::currentPlotView() const {
+View *MainWindow::currentPlotView() const {
return qobject_cast<View*>(_tabWidget->currentWidget());
}
-View *KstMainWindow::createPlotView() {
+View *MainWindow::createPlotView() {
View *plotView = new View;
connect(plotView, SIGNAL(destroyed(QObject*)),
this, SLOT(plotViewDestroyed(QObject*)));
@@ -77,54 +77,54 @@
}
-void KstMainWindow::currentPlotChanged() {
+void MainWindow::currentPlotChanged() {
_undoGroup->setActiveStack(currentPlotView()->undoStack());
}
-void KstMainWindow::plotViewDestroyed(QObject *object) {
+void MainWindow::plotViewDestroyed(QObject *object) {
View *plotView = qobject_cast<View*>(object);
_tabWidget->removeTab(_tabWidget->indexOf(plotView));
}
-void KstMainWindow::aboutToQuit() {
+void MainWindow::aboutToQuit() {
writeSettings();
}
-void KstMainWindow::about() {
+void MainWindow::about() {
//FIXME Build a proper about box...
QMessageBox::about(this, tr("About Kst"),
tr("FIXME."));
}
-void KstMainWindow::createBox() {
+void MainWindow::createBox() {
CreateBoxCommand *cmd = new CreateBoxCommand;
cmd->createItem();
}
-void KstMainWindow::createEllipse() {
+void MainWindow::createEllipse() {
CreateEllipseCommand *cmd = new CreateEllipseCommand;
cmd->createItem();
}
-void KstMainWindow::createLabel() {
+void MainWindow::createLabel() {
CreateLabelCommand *cmd = new CreateLabelCommand;
cmd->createItem();
}
-void KstMainWindow::createLine() {
+void MainWindow::createLine() {
CreateLineCommand *cmd = new CreateLineCommand;
cmd->createItem();
}
-void KstMainWindow::createActions() {
+void MainWindow::createActions() {
_undoAct = _undoGroup->createUndoAction(this);
_undoAct->setShortcut(tr("Ctrl+Z"));
_redoAct = _undoGroup->createRedoAction(this);
@@ -160,7 +160,7 @@
connect(_aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
-void KstMainWindow::createMenus() {
+void MainWindow::createMenus() {
_fileMenu = menuBar()->addMenu(tr("&File"));
_fileMenu->addSeparator();
_fileMenu->addAction(_exitAct);
@@ -185,18 +185,18 @@
}
-void KstMainWindow::createToolBars() {
+void MainWindow::createToolBars() {
_fileToolBar = addToolBar(tr("File"));
_editToolBar = addToolBar(tr("Edit"));
}
-void KstMainWindow::createStatusBar() {
+void MainWindow::createStatusBar() {
statusBar()->showMessage(tr("Ready"));
}
-void KstMainWindow::readSettings() {
+void MainWindow::readSettings() {
QSettings settings;
QPoint pos = settings.value("pos", QPoint(20, 20)).toPoint();
QSize size = settings.value("size", QSize(800, 600)).toSize();
@@ -205,12 +205,14 @@
}
-void KstMainWindow::writeSettings() {
+void MainWindow::writeSettings() {
QSettings settings;
settings.setValue("pos", pos());
settings.setValue("size", size());
}
+}
+
#include "kstmainwindow.moc"
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstmainwindow.h #669166:669167
@@ -9,8 +9,8 @@
* *
***************************************************************************/
-#ifndef KSTMAINWINDOW_H
-#define KSTMAINWINDOW_H
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
#include <QMainWindow>
@@ -21,20 +21,19 @@
namespace Kst {
class View;
-}
-class KstMainWindow : public QMainWindow
+class MainWindow : public QMainWindow
{
Q_OBJECT
public:
- KstMainWindow();
- virtual ~KstMainWindow();
+ MainWindow();
+ virtual ~MainWindow();
QUndoGroup *undoGroup() const;
QTabWidget *tabWidget() const;
- Kst::View *currentPlotView() const;
+ View *currentPlotView() const;
- Kst::View *createPlotView();
+ View *createPlotView();
private Q_SLOTS:
void aboutToQuit();
@@ -82,6 +81,7 @@
QAction *_aboutQtAct;
};
+}
#endif
// vim: ts=2 sw=2 et
More information about the Kst
mailing list