Theme Editor: Made the device configuration menu dockable
authorbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Fri, 25 Jun 2010 05:49:16 +0000 (25 05:49 +0000)
committerbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Fri, 25 Jun 2010 05:49:16 +0000 (25 05:49 +0000)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27128 a1c6a512-1295-4272-9138-f99709370657

utils/themeeditor/gui/editorwindow.cpp
utils/themeeditor/gui/editorwindow.h

index 81d05c8..94e744e 100644 (file)
 #include <QGraphicsScene>
 
 EditorWindow::EditorWindow(QWidget *parent) :
-    QMainWindow(parent),
-    ui(new Ui::EditorWindow),
-    parseTreeSelection(0)
+    QMainWindow(parent), ui(new Ui::EditorWindow), parseTreeSelection(0)
 {
     ui->setupUi(this);
     prefs = new PreferencesDialog(this);
     project = 0;
-    loadSettings();
     setupUI();
+    loadSettings();
     setupMenus();
 }
 
+
+EditorWindow::~EditorWindow()
+{
+    delete ui;
+    delete prefs;
+    if(project)
+        delete project;
+    delete deviceConfig;
+    delete deviceDock;
+}
+
 void EditorWindow::loadTabFromSkinFile(QString fileName)
 {
     /* Checking to see if the file is already open */
@@ -146,9 +155,13 @@ void EditorWindow::setupUI()
     ui->skinPreviewLayout->addWidget(viewer);
 
     /* Positioning the device settings dialog */
-    QPoint thisPos = pos();
-    deviceConfig.move(thisPos.x() + width() / 4, thisPos.y() + height() / 4);
+    deviceDock = new QDockWidget(tr("Device Configuration"), this);
+    deviceConfig = new DeviceState(deviceDock);
 
+    deviceDock->setObjectName("deviceDock");
+    deviceDock->setWidget(deviceConfig);
+    deviceDock->setFloating(true);
+    deviceDock->hide();
 }
 
 void EditorWindow::setupMenus()
@@ -161,7 +174,7 @@ void EditorWindow::setupMenus()
     QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()),
                      this, SLOT(showPanel()));
     QObject::connect(ui->actionDevice_Configuration, SIGNAL(triggered()),
-                     &deviceConfig, SLOT(show()));
+                     deviceDock, SLOT(show()));
 
     /* Connecting the document management actions */
     QObject::connect(ui->actionNew_Document, SIGNAL(triggered()),
@@ -483,11 +496,3 @@ void EditorWindow::sizeColumns()
     ui->parseTree->resizeColumnToContents(ParseTreeModel::typeColumn);
     ui->parseTree->resizeColumnToContents(ParseTreeModel::valueColumn);
 }
-
-EditorWindow::~EditorWindow()
-{
-    delete ui;
-    delete prefs;
-    if(project)
-        delete project;
-}
index 0bfaac3..ab75cc5 100644 (file)
@@ -25,6 +25,7 @@
 #include <QMainWindow>
 #include <QLabel>
 #include <QItemSelectionModel>
+#include <QDockWidget>
 
 #include "parsetreemodel.h"
 #include "skinhighlighter.h"
@@ -89,7 +90,8 @@ private:
     ProjectModel* project;
     QItemSelectionModel* parseTreeSelection;
     SkinViewer* viewer;
-    DeviceState deviceConfig;
+    DeviceState* deviceConfig;
+    QDockWidget* deviceDock;
 };
 
 #endif // EDITORWINDOW_H