diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-14 05:06:42 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-14 05:06:42 +0000 |
commit | b76b6448a2e0e07af4ee61e7d3a4fe11370019f7 (patch) | |
tree | 53f10e227bb404e2f2e2dd719227808c2d4acc67 /utils | |
parent | 78fc9844a9ec83b5e3dbb9289ccf8ff2b64b2d56 (diff) | |
download | rockbox-b76b6448a2e0e07af4ee61e7d3a4fe11370019f7.tar.gz rockbox-b76b6448a2e0e07af4ee61e7d3a4fe11370019f7.zip |
Theme Editor: Added Close Project feature
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27412 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils')
-rw-r--r-- | utils/themeeditor/gui/editorwindow.cpp | 31 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.h | 1 | ||||
-rw-r--r-- | utils/themeeditor/gui/editorwindow.ui | 12 |
3 files changed, 43 insertions, 1 deletions
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp index b81e41a2f5..247109cc19 100644 --- a/utils/themeeditor/gui/editorwindow.cpp +++ b/utils/themeeditor/gui/editorwindow.cpp | |||
@@ -205,6 +205,8 @@ void EditorWindow::setupMenus() | |||
205 | 205 | ||
206 | QObject::connect(ui->actionClose_Document, SIGNAL(triggered()), | 206 | QObject::connect(ui->actionClose_Document, SIGNAL(triggered()), |
207 | this, SLOT(closeCurrent())); | 207 | this, SLOT(closeCurrent())); |
208 | QObject::connect(ui->actionClose_Project, SIGNAL(triggered()), | ||
209 | this, SLOT(closeProject())); | ||
208 | 210 | ||
209 | QObject::connect(ui->actionSave_Document, SIGNAL(triggered()), | 211 | QObject::connect(ui->actionSave_Document, SIGNAL(triggered()), |
210 | this, SLOT(saveCurrent())); | 212 | this, SLOT(saveCurrent())); |
@@ -347,6 +349,31 @@ void EditorWindow::closeCurrent() | |||
347 | closeTab(ui->editorTabs->currentIndex()); | 349 | closeTab(ui->editorTabs->currentIndex()); |
348 | } | 350 | } |
349 | 351 | ||
352 | void EditorWindow::closeProject() | ||
353 | { | ||
354 | if(project) | ||
355 | { | ||
356 | project->deleteLater(); | ||
357 | project = 0; | ||
358 | } | ||
359 | |||
360 | for(int i = 0; i < ui->editorTabs->count(); i++) | ||
361 | { | ||
362 | TabContent* doc = dynamic_cast<TabContent*> | ||
363 | (ui->editorTabs->widget(i)); | ||
364 | if(doc->type() == TabContent::Skin) | ||
365 | { | ||
366 | dynamic_cast<SkinDocument*>(doc)->setProject(project); | ||
367 | if(i == ui->editorTabs->currentIndex()) | ||
368 | { | ||
369 | viewer->setScene(dynamic_cast<SkinDocument*>(doc)->scene()); | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | |||
374 | ui->actionClose_Project->setEnabled(false); | ||
375 | } | ||
376 | |||
350 | void EditorWindow::saveCurrent() | 377 | void EditorWindow::saveCurrent() |
351 | { | 378 | { |
352 | if(ui->editorTabs->currentIndex() >= 0) | 379 | if(ui->editorTabs->currentIndex() >= 0) |
@@ -401,7 +428,9 @@ void EditorWindow::openProject() | |||
401 | { | 428 | { |
402 | 429 | ||
403 | if(project) | 430 | if(project) |
404 | delete project; | 431 | project->deleteLater(); |
432 | |||
433 | ui->actionClose_Project->setEnabled(true); | ||
405 | 434 | ||
406 | project = new ProjectModel(fileName, this); | 435 | project = new ProjectModel(fileName, this); |
407 | ui->projectTree->setModel(project); | 436 | ui->projectTree->setModel(project); |
diff --git a/utils/themeeditor/gui/editorwindow.h b/utils/themeeditor/gui/editorwindow.h index 6b09b79815..0178f602b2 100644 --- a/utils/themeeditor/gui/editorwindow.h +++ b/utils/themeeditor/gui/editorwindow.h | |||
@@ -67,6 +67,7 @@ private slots: | |||
67 | void shiftTab(int index); | 67 | void shiftTab(int index); |
68 | bool closeTab(int index); | 68 | bool closeTab(int index); |
69 | void closeCurrent(); | 69 | void closeCurrent(); |
70 | void closeProject(); | ||
70 | void saveCurrent(); | 71 | void saveCurrent(); |
71 | void saveCurrentAs(); | 72 | void saveCurrentAs(); |
72 | void openFile(); | 73 | void openFile(); |
diff --git a/utils/themeeditor/gui/editorwindow.ui b/utils/themeeditor/gui/editorwindow.ui index 5ef3261acb..ab8dc61896 100644 --- a/utils/themeeditor/gui/editorwindow.ui +++ b/utils/themeeditor/gui/editorwindow.ui | |||
@@ -52,6 +52,7 @@ | |||
52 | <addaction name="actionOpen_Project"/> | 52 | <addaction name="actionOpen_Project"/> |
53 | <addaction name="separator"/> | 53 | <addaction name="separator"/> |
54 | <addaction name="actionClose_Document"/> | 54 | <addaction name="actionClose_Document"/> |
55 | <addaction name="actionClose_Project"/> | ||
55 | <addaction name="separator"/> | 56 | <addaction name="separator"/> |
56 | <addaction name="actionSave_Document"/> | 57 | <addaction name="actionSave_Document"/> |
57 | <addaction name="actionSave_Document_As"/> | 58 | <addaction name="actionSave_Document_As"/> |
@@ -374,6 +375,17 @@ | |||
374 | <string>Ctrl+T</string> | 375 | <string>Ctrl+T</string> |
375 | </property> | 376 | </property> |
376 | </action> | 377 | </action> |
378 | <action name="actionClose_Project"> | ||
379 | <property name="enabled"> | ||
380 | <bool>false</bool> | ||
381 | </property> | ||
382 | <property name="text"> | ||
383 | <string>Close Pro&ject</string> | ||
384 | </property> | ||
385 | <property name="shortcut"> | ||
386 | <string>Ctrl+Shift+W</string> | ||
387 | </property> | ||
388 | </action> | ||
377 | </widget> | 389 | </widget> |
378 | <tabstops> | 390 | <tabstops> |
379 | <tabstop>projectTree</tabstop> | 391 | <tabstop>projectTree</tabstop> |