diff options
| author | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 19:47:49 +0000 |
|---|---|---|
| committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-05 19:47:49 +0000 |
| commit | 47181b8b9b0e3e914243a463ad02a2eceab61c6e (patch) | |
| tree | 11a75ac5d5d1a4e72a60284c7a4a1b74893568db /utils/themeeditor/editorwindow.cpp | |
| parent | 45ab395c2fb42445382a377314bd63ae216f40c4 (diff) | |
| download | rockbox-47181b8b9b0e3e914243a463ad02a2eceab61c6e.zip rockbox-47181b8b9b0e3e914243a463ad02a2eceab61c6e.tar.gz rockbox-47181b8b9b0e3e914243a463ad02a2eceab61c6e.tar.bz2 rockbox-47181b8b9b0e3e914243a463ad02a2eceab61c6e.tar.xz | |
Theme Editor: Got save/save-as functionality working and added Tango icons to the toolbar
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26593 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/editorwindow.cpp')
| -rw-r--r-- | utils/themeeditor/editorwindow.cpp | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp index cadc631..4d2ed87 100644 --- a/utils/themeeditor/editorwindow.cpp +++ b/utils/themeeditor/editorwindow.cpp @@ -96,9 +96,22 @@ void EditorWindow::setupMenus() QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()), this, SLOT(showPanel())); - /* Connecting the document opening/closing actions */ + /* Connecting the document management actions */ QObject::connect(ui->actionNew_Document, SIGNAL(triggered()), this, SLOT(newTab())); + QObject::connect(ui->actionToolbarNew, SIGNAL(triggered()), + this, SLOT(newTab())); + + QObject::connect(ui->actionClose_Document, SIGNAL(triggered()), + this, SLOT(closeCurrent())); + + QObject::connect(ui->actionSave_Document, SIGNAL(triggered()), + this, SLOT(saveCurrent())); + QObject::connect(ui->actionSave_Document_As, SIGNAL(triggered()), + this, SLOT(saveCurrentAs())); + QObject::connect(ui->actionToolbarSave, SIGNAL(triggered()), + this, SLOT(saveCurrent())); + } @@ -115,13 +128,23 @@ void EditorWindow::newTab() void EditorWindow::shiftTab(int index) { if(index < 0) + { ui->parseTree->setModel(0); + ui->actionSave_Document->setEnabled(false); + ui->actionSave_Document_As->setEnabled(false); + ui->actionClose_Document->setEnabled(false); + } else + { ui->parseTree->setModel(dynamic_cast<SkinDocument*> (ui->editorTabs->currentWidget())->getModel()); + ui->actionSave_Document->setEnabled(true); + ui->actionSave_Document_As->setEnabled(true); + ui->actionClose_Document->setEnabled(true); + } } -void EditorWindow::closeTab(int index) +bool EditorWindow::closeTab(int index) { SkinDocument* widget = dynamic_cast<SkinDocument*> (ui->editorTabs->widget(index)); @@ -129,9 +152,30 @@ void EditorWindow::closeTab(int index) { ui->editorTabs->removeTab(index); widget->deleteLater(); + return true; } + + return false; +} + +void EditorWindow::closeCurrent() +{ + closeTab(ui->editorTabs->currentIndex()); } +void EditorWindow::saveCurrent() +{ + if(ui->editorTabs->currentIndex() >= 0) + dynamic_cast<SkinDocument*>(ui->editorTabs->currentWidget())->save(); +} + +void EditorWindow::saveCurrentAs() +{ + if(ui->editorTabs->currentIndex() >= 0) + dynamic_cast<SkinDocument*>(ui->editorTabs->currentWidget())->saveAs(); +} + + void EditorWindow::tabTitleChanged(QString title) { SkinDocument* sender = dynamic_cast<SkinDocument*>(QObject::sender()); @@ -150,7 +194,20 @@ void EditorWindow::showPanel() void EditorWindow::closeEvent(QCloseEvent* event) { + saveSettings(); + + /* Closing all the tabs */ + for(int i = 0; i < ui->editorTabs->count(); i++) + { + if(!dynamic_cast<SkinDocument*> + (ui->editorTabs->widget(i))->requestClose()) + { + event->ignore(); + return; + } + } + event->accept(); } |