[Kst] branches/work/kst/portto4/kst/src/libkstapp
George Staikos
staikos at kde.org
Tue May 29 18:25:46 CEST 2007
SVN commit 669542 by staikos:
stub out Document, SessionModel, DataManager, though DataManager is actually so
trivial with this object structure that it's almost done.
M +7 -0 CMakeLists.txt
A datamanager.cpp [License: GPL (v2+)]
A datamanager.h [License: GPL (v2+)]
A datamanager.ui
A document.cpp [License: GPL (v2+)]
A document.h [License: GPL (v2+)]
M +29 -2 mainwindow.cpp
M +62 -48 mainwindow.h
A sessionmodel.cpp [License: GPL (v2+)]
A sessionmodel.h [License: GPL (v2+)]
--- branches/work/kst/portto4/kst/src/libkstapp/CMakeLists.txt #669541:669542
@@ -3,11 +3,14 @@
set(kstapp_LIB_SRCS
applicationsettings.cpp
boxitem.cpp
+ datamanager.cpp
+ document.cpp
ellipseitem.cpp
kstapplication.cpp
labelitem.cpp
lineitem.cpp
mainwindow.cpp
+ sessionmodel.cpp
tabwidget.cpp
vectormodel.cpp
vectortablemodel.cpp
@@ -16,6 +19,10 @@
viewitem.cpp
)
+kde4_add_ui_files(kstapp_LIB_SRCS
+ datamanager.ui
+ )
+
kde4_automoc(${kstapp_LIB_SRCS})
kde4_add_library(kstapp SHARED ${kstapp_LIB_SRCS})
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #669541:669542
@@ -10,9 +10,11 @@
***************************************************************************/
#include "mainwindow.h"
-#include "kstapplication.h"
#include "boxitem.h"
+#include "datamanager.h"
+#include "document.h"
#include "ellipseitem.h"
+#include "kstapplication.h"
#include "labelitem.h"
#include "lineitem.h"
#include "tabwidget.h"
@@ -27,6 +29,8 @@
namespace Kst {
MainWindow::MainWindow() {
+ _dataManager = 0;
+ _doc = new Document;
_tabWidget = new TabWidget(this);
_undoGroup = new QUndoGroup(this);
@@ -46,9 +50,18 @@
MainWindow::~MainWindow() {
+ delete _dataManager;
+ _dataManager = 0;
+ delete _doc;
+ _doc = 0;
}
+Document *MainWindow::document() const {
+ return _doc;
+}
+
+
QUndoGroup *MainWindow::undoGroup() const {
return _undoGroup;
}
@@ -59,7 +72,6 @@
}
-
void MainWindow::currentViewChanged() {
_undoGroup->setActiveStack(_tabWidget->currentView()->undoStack());
}
@@ -180,6 +192,10 @@
_exitAct->setStatusTip(tr("Exit the application"));
connect(_exitAct, SIGNAL(triggered()), this, SLOT(close()));
+ _dataManagerAct = new QAction(tr("Data &Manager"), this);
+ _dataManagerAct->setStatusTip(tr("Show Kst's data manager window"));
+ connect(_dataManagerAct, SIGNAL(triggered()), this, SLOT(showDataManager()));
+
_aboutAct = new QAction(tr("&About"), this);
_aboutAct->setStatusTip(tr("Show Kst's About box"));
connect(_aboutAct, SIGNAL(triggered()), this, SLOT(about()));
@@ -205,6 +221,9 @@
_editMenu->addAction(_undoAct);
_editMenu->addAction(_redoAct);
+ _dataMenu = menuBar()->addMenu(tr("&Data"));
+ _dataMenu->addAction(_dataManagerAct);
+
_plotMenu = menuBar()->addMenu(tr("&Plot"));
_plotMenu->addAction(_createLabelAct);
_plotMenu->addAction(_createBoxAct);
@@ -238,6 +257,14 @@
}
+void MainWindow::showDataManager() {
+ if (!_dataManager) {
+ _dataManager = new DataManager(this, _doc);
+ }
+ _dataManager->show();
+}
+
+
void MainWindow::readSettings() {
QSettings settings;
QPoint pos = settings.value("pos", QPoint(20, 20)).toPoint();
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #669541:669542
@@ -19,70 +19,84 @@
class QUndoGroup;
namespace Kst {
+
+class DataManager;
+class Document;
+class TabWidget;
class View;
-class TabWidget;
class MainWindow : public QMainWindow
{
Q_OBJECT
-public:
- MainWindow();
- virtual ~MainWindow();
+ public:
+ MainWindow();
+ ~MainWindow();
- QUndoGroup *undoGroup() const;
- TabWidget *tabWidget() const;
+ QUndoGroup *undoGroup() const;
+ TabWidget *tabWidget() const;
+ Document *document() const;
-private Q_SLOTS:
- void aboutToQuit();
- void about();
- void currentViewChanged();
+ public Q_SLOTS:
+ void showDataManager();
- void createLabel();
- void createBox();
- void createEllipse();
- void createLine();
+ private Q_SLOTS:
+ void aboutToQuit();
+ void about();
+ void currentViewChanged();
- void demoModel();
+ void createLabel();
+ void createBox();
+ void createEllipse();
+ void createLine();
-private:
- void createActions();
- void createMenus();
- void createToolBars();
- void createStatusBar();
+ void demoModel();
- void readSettings();
- void writeSettings();
+ private:
+ void createActions();
+ void createMenus();
+ void createToolBars();
+ void createStatusBar();
-private:
- TabWidget *_tabWidget;
- QUndoGroup *_undoGroup;
+ void readSettings();
+ void writeSettings();
- QMenu *_fileMenu;
- QMenu *_editMenu;
- QMenu *_plotMenu;
- QMenu *_settingsMenu;
- QMenu *_helpMenu;
+ private:
+ Document *_doc;
+ TabWidget *_tabWidget;
+ QUndoGroup *_undoGroup;
- QToolBar *_fileToolBar;
- QToolBar *_editToolBar;
+ DataManager *_dataManager;
- QAction *_undoAct;
- QAction *_redoAct;
- // FIXME: move these into each object, along with the creation slot?
- QAction *_createLabelAct;
- QAction *_createBoxAct;
- QAction *_createEllipseAct;
- QAction *_createLineAct;
+ // Do we need these? I don't think so...
+ QMenu *_fileMenu;
+ QMenu *_dataMenu;
+ QMenu *_editMenu;
+ QMenu *_plotMenu;
+ QMenu *_settingsMenu;
+ QMenu *_helpMenu;
- QAction *_newTabAct;
- QAction *_saveAct;
- QAction *_saveAsAct;
- QAction *_openAct;
- QAction *_printAct;
- QAction *_closeTabAct;
- QAction *_exitAct;
- QAction *_aboutAct;
- QAction *_aboutQtAct;
+ // Do we need these? I don't think so...
+ QToolBar *_fileToolBar;
+ QToolBar *_editToolBar;
+
+ QAction *_undoAct;
+ QAction *_redoAct;
+ // FIXME: move these into each object, along with the creation slot?
+ QAction *_createLabelAct;
+ QAction *_createBoxAct;
+ QAction *_createEllipseAct;
+ QAction *_createLineAct;
+
+ QAction *_newTabAct;
+ QAction *_saveAct;
+ QAction *_saveAsAct;
+ QAction *_openAct;
+ QAction *_printAct;
+ QAction *_closeTabAct;
+ QAction *_exitAct;
+ QAction *_dataManagerAct;
+ QAction *_aboutAct;
+ QAction *_aboutQtAct;
};
}
More information about the Kst
mailing list