summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-03 06:08:59 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-03 06:08:59 +0000
commitfb09d6354c0b6badb449f532f40af9a8037377a3 (patch)
treeefe8844d87a8dec2239a7f88ca161583ebd6c869 /utils/themeeditor/gui
parent4b321649a8bf3879a33051e63f250985b97007e3 (diff)
downloadrockbox-fb09d6354c0b6badb449f532f40af9a8037377a3.zip
rockbox-fb09d6354c0b6badb449f532f40af9a8037377a3.tar.gz
rockbox-fb09d6354c0b6badb449f532f40af9a8037377a3.tar.bz2
rockbox-fb09d6354c0b6badb449f532f40af9a8037377a3.tar.xz
Theme Editor: Removed some old debug code in skindocument.cpp, began implementing a new find/replace dialog, due to licensing issues
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27252 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/gui')
-rw-r--r--utils/themeeditor/gui/findreplacedialog.cpp101
-rw-r--r--utils/themeeditor/gui/findreplacedialog.h58
-rw-r--r--utils/themeeditor/gui/findreplacedialog.ui147
-rw-r--r--utils/themeeditor/gui/skindocument.cpp2
4 files changed, 308 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp
new file mode 100644
index 0000000..234c6f6
--- /dev/null
+++ b/utils/themeeditor/gui/findreplacedialog.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2010 Robert Bieber
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "findreplacedialog.h"
+#include "ui_findreplacedialog.h"
+
+#include <QTextBlock>
+
+FindReplaceDialog::FindReplaceDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::FindReplaceDialog), editor(0)
+{
+ ui->setupUi(this);
+ setupUI();
+}
+
+FindReplaceDialog::~FindReplaceDialog()
+{
+ delete ui;
+}
+
+void FindReplaceDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+void FindReplaceDialog::closeEvent(QCloseEvent* event)
+{
+ ui->statusLabel->setText("");
+ event->accept();
+}
+
+void FindReplaceDialog::setupUI()
+{
+ QObject::connect(ui->findButton, SIGNAL(pressed()),
+ this, SLOT(find()));
+ QObject::connect(ui->replaceButton, SIGNAL(pressed()),
+ this, SLOT(replace()));
+ QObject::connect(ui->replaceAllButton, SIGNAL(pressed()),
+ this, SLOT(replaceAll()));
+ QObject::connect(ui->closeButton, SIGNAL(pressed()),
+ this, SLOT(close()));
+ QObject::connect(ui->findBox, SIGNAL(textChanged(QString)),
+ this, SLOT(textChanged()));
+
+ textChanged();
+}
+
+void FindReplaceDialog::find()
+{
+
+ if(!editor)
+ return;
+
+ editor->setTextCursor(editor->document()->find(ui->findBox->text()));
+
+}
+
+void FindReplaceDialog::replace()
+{
+
+}
+
+void FindReplaceDialog::replaceAll()
+{
+
+}
+
+void FindReplaceDialog::textChanged()
+{
+ bool enabled = ui->findBox->text() != "";
+
+ ui->findButton->setEnabled(enabled);
+ ui->replaceButton->setEnabled(enabled);
+ ui->replaceAllButton->setEnabled(enabled);
+}
diff --git a/utils/themeeditor/gui/findreplacedialog.h b/utils/themeeditor/gui/findreplacedialog.h
new file mode 100644
index 0000000..793094a
--- /dev/null
+++ b/utils/themeeditor/gui/findreplacedialog.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2010 Robert Bieber
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef FINDREPLACEDIALOG_H
+#define FINDREPLACEDIALOG_H
+
+#include <QDialog>
+#include <QPlainTextEdit>
+
+namespace Ui {
+ class FindReplaceDialog;
+}
+
+class FindReplaceDialog : public QDialog {
+ Q_OBJECT
+public:
+ FindReplaceDialog(QWidget *parent = 0);
+ virtual ~FindReplaceDialog();
+
+ void setTextEdit(QPlainTextEdit* editor){ this->editor = editor; }
+
+protected:
+ void changeEvent(QEvent *e);
+ void closeEvent(QCloseEvent* event);
+
+private slots:
+ void find();
+ void replace();
+ void replaceAll();
+ void textChanged();
+
+private:
+ void setupUI();
+
+ Ui::FindReplaceDialog *ui;
+
+ QPlainTextEdit* editor;
+};
+
+#endif // FINDREPLACEDIALOG_H
diff --git a/utils/themeeditor/gui/findreplacedialog.ui b/utils/themeeditor/gui/findreplacedialog.ui
new file mode 100644
index 0000000..1c45107
--- /dev/null
+++ b/utils/themeeditor/gui/findreplacedialog.ui
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FindReplaceDialog</class>
+ <widget class="QDialog" name="FindReplaceDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>450</width>
+ <height>200</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Find/Replace</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="../resources.qrc">
+ <normaloff>:/resources/windowicon.png</normaloff>:/resources/windowicon.png</iconset>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Find:</string>
+ </property>
+ <property name="buddy">
+ <cstring>findBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="findBox"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Replace:</string>
+ </property>
+ <property name="buddy">
+ <cstring>replaceBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="replaceBox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="statusLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="caseBox">
+ <property name="text">
+ <string>Match Case</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="backwardsBox">
+ <property name="text">
+ <string>Search Backwards</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="wrapBox">
+ <property name="text">
+ <string>Wrap Around</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="findButton">
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+F</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="replaceButton">
+ <property name="text">
+ <string>Replace</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="replaceAllButton">
+ <property name="text">
+ <string>Replace All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ <property name="shortcut">
+ <string>Esc</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="../resources.qrc"/>
+ </resources>
+ <connections/>
+</ui>
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index 28e5297..9a381a9 100644
--- a/utils/themeeditor/gui/skindocument.cpp
+++ b/utils/themeeditor/gui/skindocument.cpp
@@ -29,6 +29,8 @@
#include <iostream>
+#include <QDebug>
+
SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
DeviceState* device, QWidget *parent)
:TabContent(parent), statusLabel(statusLabel),