From fb09d6354c0b6badb449f532f40af9a8037377a3 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Sat, 3 Jul 2010 06:08:59 +0000 Subject: 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 --- utils/themeeditor/gui/findreplacedialog.cpp | 101 +++++++++++++++++++ utils/themeeditor/gui/findreplacedialog.h | 58 +++++++++++ utils/themeeditor/gui/findreplacedialog.ui | 147 ++++++++++++++++++++++++++++ utils/themeeditor/gui/skindocument.cpp | 2 + 4 files changed, 308 insertions(+) create mode 100644 utils/themeeditor/gui/findreplacedialog.cpp create mode 100644 utils/themeeditor/gui/findreplacedialog.h create mode 100644 utils/themeeditor/gui/findreplacedialog.ui (limited to 'utils/themeeditor/gui') diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp new file mode 100644 index 0000000000..234c6f6886 --- /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 + +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 0000000000..793094a5fe --- /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 +#include + +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 0000000000..1c4510788f --- /dev/null +++ b/utils/themeeditor/gui/findreplacedialog.ui @@ -0,0 +1,147 @@ + + + FindReplaceDialog + + + + 0 + 0 + 450 + 200 + + + + Find/Replace + + + + :/resources/windowicon.png:/resources/windowicon.png + + + + + + + + + + Find: + + + findBox + + + + + + + + + + Replace: + + + replaceBox + + + + + + + + + + + + + + + + + + + + + Match Case + + + + + + + Search Backwards + + + + + + + Wrap Around + + + + + + + + + + + + + Find + + + Ctrl+F + + + true + + + + + + + Replace + + + + + + + Replace All + + + + + + + Close + + + Esc + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index 28e5297b48..9a381a9589 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp @@ -29,6 +29,8 @@ #include +#include + SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, DeviceState* device, QWidget *parent) :TabContent(parent), statusLabel(statusLabel), -- cgit v1.2.3