forked from len0rd/rockbox
Theme Editor: Fixed bugs with menu signals, rearranged UI some more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26540 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d5171cc225
commit
9616389377
3 changed files with 69 additions and 160 deletions
|
|
@ -57,49 +57,47 @@ void EditorWindow::setupUI()
|
|||
model->setRootPath(QDir::currentPath());
|
||||
ui->fileTree->setModel(model);
|
||||
|
||||
/* Establishing the parse tree */
|
||||
tree = new ParseTreeModel(ui->codeEdit->document()->toPlainText().
|
||||
toAscii());
|
||||
ui->parseTree->setModel(tree);
|
||||
|
||||
/* Setting up the syntax highlighter */
|
||||
highlighter = new SkinHighlighter(QColor(0,255,0), QColor(255,0,0),
|
||||
QColor(0,0,255), QColor(150,150,150),
|
||||
ui->codeEdit->document());
|
||||
|
||||
/* Connecting the buttons */
|
||||
QObject::connect(ui->codeEdit, SIGNAL(cursorPositionChanged()),
|
||||
this, SLOT(codeChanged()));
|
||||
QObject::connect(ui->fromTree, SIGNAL(pressed()),
|
||||
this, SLOT(updateCode()));
|
||||
|
||||
}
|
||||
|
||||
void EditorWindow::setupMenus()
|
||||
{
|
||||
/* When there are menus to setup, they'll be set up here */
|
||||
/* Connecting panel show actions */
|
||||
QObject::connect(ui->actionFile_Panel, SIGNAL(triggered()),
|
||||
this, SLOT(showPanel()));
|
||||
QObject::connect(ui->actionDisplay_Panel, SIGNAL(triggered()),
|
||||
this, SLOT(showPanel()));
|
||||
QObject::connect(ui->actionPreview_Panel, SIGNAL(triggered()),
|
||||
this, SLOT(showPanel()));
|
||||
}
|
||||
|
||||
void EditorWindow::codeChanged()
|
||||
{
|
||||
tree->changeTree(ui->codeEdit->document()->toPlainText().toAscii());
|
||||
ui->parseTree->expandAll();
|
||||
}
|
||||
|
||||
void EditorWindow::updateCode()
|
||||
{
|
||||
}
|
||||
|
||||
void EditorWindow::showPanel()
|
||||
{
|
||||
if(sender() == ui->actionFile_Panel)
|
||||
ui->fileDock->setVisible(true);
|
||||
if(sender() == ui->actionPreview_Panel)
|
||||
ui->skinPreviewDock->setVisible(true);
|
||||
if(sender() == ui->actionDisplay_Panel)
|
||||
ui->parseTreeDock->setVisible(true);
|
||||
}
|
||||
|
||||
void EditorWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void EditorWindow::updateCode()
|
||||
{
|
||||
if(tree)
|
||||
ui->codeEdit->document()->setPlainText(tree->genCode());
|
||||
}
|
||||
|
||||
EditorWindow::~EditorWindow()
|
||||
{
|
||||
delete ui;
|
||||
if(tree)
|
||||
delete tree;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ protected:
|
|||
private slots:
|
||||
void updateCode();
|
||||
void codeChanged();
|
||||
void showPanel();
|
||||
|
||||
private:
|
||||
/* Setup functions */
|
||||
|
|
@ -51,7 +52,6 @@ private:
|
|||
void setupMenus();
|
||||
|
||||
Ui::EditorWindow *ui;
|
||||
ParseTreeModel* tree;
|
||||
SkinHighlighter* highlighter;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,9 +20,18 @@
|
|||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="codeEdit">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
<widget class="QTabWidget" name="editorTabs">
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -41,6 +50,9 @@
|
|||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="actionNew_Document"/>
|
||||
<addaction name="actionOpen_Document"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionQuit"/>
|
||||
|
|
@ -58,21 +70,14 @@
|
|||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="skinPreviewDock">
|
||||
<property name="windowTitle">
|
||||
<string>Skin Preview</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Skin Preview</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>skinPreview</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="skinPreview"/>
|
||||
</item>
|
||||
|
|
@ -87,25 +92,18 @@
|
|||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="fileDock">
|
||||
<property name="windowTitle">
|
||||
<string>Files</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Files</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fileTree</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="fileTree"/>
|
||||
</item>
|
||||
|
|
@ -113,21 +111,14 @@
|
|||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="parseTreeDock">
|
||||
<property name="windowTitle">
|
||||
<string>Parse Tree</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Parse Tree</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>parseTree</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="parseTree"/>
|
||||
</item>
|
||||
|
|
@ -151,10 +142,10 @@
|
|||
</action>
|
||||
<action name="actionDisplay_Panel">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Parse &Tree Panel</string>
|
||||
|
|
@ -170,10 +161,10 @@
|
|||
</action>
|
||||
<action name="actionFile_Panel">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&File Panel</string>
|
||||
|
|
@ -181,15 +172,31 @@
|
|||
</action>
|
||||
<action name="actionPreview_Panel">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Preview Panel</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Document">
|
||||
<property name="text">
|
||||
<string>&New Document</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Document">
|
||||
<property name="text">
|
||||
<string>&Open Document</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
|
|
@ -211,101 +218,5 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionDisplay_Panel</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>parseTreeDock</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>680</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>parseTreeDock</sender>
|
||||
<signal>visibilityChanged(bool)</signal>
|
||||
<receiver>actionDisplay_Panel</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>680</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionFile_Panel</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fileDock</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>79</x>
|
||||
<y>206</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fileDock</sender>
|
||||
<signal>visibilityChanged(bool)</signal>
|
||||
<receiver>actionFile_Panel</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>79</x>
|
||||
<y>206</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionPreview_Panel</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>skinPreviewDock</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>680</x>
|
||||
<y>112</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>skinPreviewDock</sender>
|
||||
<signal>visibilityChanged(bool)</signal>
|
||||
<receiver>actionPreview_Panel</receiver>
|
||||
<slot>setChecked(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>680</x>
|
||||
<y>112</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue