RazorConfigDialog=>LxQt::ConfigDialog
authorAlexander Sokolov <sokoloff.a@gmail.com>
Sun, 6 Oct 2013 07:49:15 +0000 (11:49 +0400)
committerAlexander Sokolov <sokoloff.a@gmail.com>
Sun, 6 Oct 2013 07:49:15 +0000 (11:49 +0400)
CMakeLists.txt
configdialog/configdialog.cpp [new file with mode: 0644]
configdialog/configdialog.h [new file with mode: 0644]
configdialog/configdialog.ui [new file with mode: 0644]
configdialog/pageselectwidget.cpp [new file with mode: 0644]
configdialog/pageselectwidget.h [new file with mode: 0644]
pageselectwidget.cpp [deleted file]
pageselectwidget.h [deleted file]
razorconfigdialog.cpp [deleted file]
razorconfigdialog.h [deleted file]
razorconfigdialog.ui [deleted file]

index 4d17fb6..b2c6703 100644 (file)
@@ -17,9 +17,11 @@ set(PUB_HDRS
     screensaver.h
     razorapplication.h
     libtranslate.h
-    pageselectwidget.h
     programfinder.h
-    razorconfigdialog.h
+
+    configdialog/configdialog.h
+    configdialog/pageselectwidget.h
+
     lxqtpower/lxqtpower.h
     razornotification.h
     razorautostartentry.h
@@ -48,9 +50,11 @@ set(SRCS
     razorsettings.cpp
     screensaver.cpp
     razorapplication.cpp
-    pageselectwidget.cpp
     programfinder.cpp
-    razorconfigdialog.cpp
+
+    configdialog/configdialog.cpp
+    configdialog/pageselectwidget.cpp
+
     lxqtpower/lxqtpower.cpp
     lxqtpower/lxqtpowerproviders.cpp
     razornotification.cpp
@@ -68,8 +72,10 @@ set(MOCS
     razorsettings.h
     screensaver.h
     razorapplication.h
-    pageselectwidget.h
-    razorconfigdialog.h
+
+    configdialog/configdialog.h
+    configdialog/pageselectwidget.h
+
     razornotification.h
     razornotification_p.h
     lxqtpower/lxqtpower.h
@@ -80,7 +86,9 @@ set(MOCS
 
 set(FORMS
     aboutdialog/lxqtaboutdialog.ui
-    razorconfigdialog.ui
+
+    configdialog/configdialog.ui
+
     addplugindialog/addplugindialog.ui
 )
 
diff --git a/configdialog/configdialog.cpp b/configdialog/configdialog.cpp
new file mode 100644 (file)
index 0000000..85f4797
--- /dev/null
@@ -0,0 +1,104 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright (C) 2012  Alec Moskvin <alecm@gmx.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#include "configdialog.h"
+#include "ui_configdialog.h"
+
+#include <qtxdg/xdgicon.h>
+#include <QtGui/QPushButton>
+
+using namespace LxQt;
+
+ConfigDialog::ConfigDialog(const QString& title, RazorSettings* settings, QWidget* parent) :
+    QDialog(parent),
+    mSettings(settings),
+    mCache(new RazorSettingsCache(settings)),
+    ui(new Ui::ConfigDialog)
+{
+    ui->setupUi(this);
+    setWindowTitle(title);
+    connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), SLOT(dialogButtonsAction(QAbstractButton*)));
+    ui->moduleList->setVisible(false);
+    connect(RazorSettings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(updateIcons()));
+    foreach(QPushButton* button, ui->buttons->findChildren<QPushButton*>())
+        button->setAutoDefault(false);
+}
+
+void ConfigDialog::addPage(QWidget* page, const QString& name, const QString& iconName)
+{
+    addPage(page, name, QStringList() << iconName);
+}
+
+void ConfigDialog::addPage(QWidget* page, const QString& name, const QStringList& iconNames)
+{
+    QStringList icons = QStringList(iconNames) << "application-x-executable";
+    new QListWidgetItem(XdgIcon::fromTheme(icons), name, ui->moduleList);
+    mIcons.append(icons);
+    ui->stackedWidget->addWidget(page);
+    if(ui->stackedWidget->count() > 1)
+    {
+        ui->moduleList->setVisible(true);
+        ui->moduleList->setCurrentRow(0);
+        mMaxSize = QSize(qMax(page->geometry().width() + ui->moduleList->geometry().width(), mMaxSize.width()),
+                         qMax(page->geometry().height() + ui->buttons->geometry().height(), mMaxSize.height()));
+    }
+    else
+    {
+        mMaxSize = page->geometry().size();
+    }
+    resize(mMaxSize);
+}
+
+void ConfigDialog::closeEvent(QCloseEvent* event)
+{
+    emit save();
+    mSettings->sync();
+}
+
+void ConfigDialog::dialogButtonsAction(QAbstractButton* button)
+{
+    QDialogButtonBox::ButtonRole role = ui->buttons->buttonRole(button);
+    if (role == QDialogButtonBox::ResetRole)
+    {
+        mCache->loadToSettings();
+        emit reset();
+    }
+    else
+    {
+        close();
+    }
+}
+
+void ConfigDialog::updateIcons()
+{
+    for (int ix = 0; ix < mIcons.size(); ix++)
+        ui->moduleList->item(ix)->setIcon(XdgIcon::fromTheme(mIcons.at(ix)));
+    update();
+}
+
+ConfigDialog::~ConfigDialog()
+{
+    delete ui;
+    delete mCache;
+}
diff --git a/configdialog/configdialog.h b/configdialog/configdialog.h
new file mode 100644 (file)
index 0000000..6fa3679
--- /dev/null
@@ -0,0 +1,88 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright (C) 2012  Alec Moskvin <alecm@gmx.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#ifndef RAZORCONFIGDIALOG_H
+#define RAZORCONFIGDIALOG_H
+
+#include <razorsettings.h>
+
+#include <QtGui/QDialog>
+#include <QtGui/QAbstractButton>
+
+namespace Ui {
+class ConfigDialog;
+}
+
+namespace LxQt
+{
+
+class ConfigDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ConfigDialog(const QString& title, RazorSettings* settings, QWidget* parent = 0);
+    ~ConfigDialog();
+
+    /*!
+     * Add a page to the configure dialog
+     */
+    void addPage(QWidget* page, const QString& name, const QString& iconName="application-x-executable");
+
+    /*!
+     * Add a page to the configure dialog, attempting several alternative icons to find one in the theme
+     */
+    void addPage(QWidget* page, const QString& name, const QStringList& iconNames);
+
+signals:
+    /*!
+     * This signal is emitted when the user pressed the "Reset" button.
+     * RazorSettings should be re-read and the widgets should be set accordingly.
+     */
+    void reset();
+
+    /*!
+     * This is emitted whenever the window is closed and settings need to be saved.
+     * It is only necessary if additional actions need to be performed - RazorSettings are handled automatically.
+     */
+    void save();
+
+protected:
+    RazorSettings* mSettings;
+    virtual void closeEvent(QCloseEvent* event);
+
+private:
+    RazorSettingsCache* mCache;
+    QList<QStringList> mIcons;
+    QSize mMaxSize;
+    Ui::ConfigDialog* ui;
+
+private slots:
+    void dialogButtonsAction(QAbstractButton* button);
+    void updateIcons();
+
+};
+
+} // namespace LxQt
+#endif // RAZORCONFIGDIALOG_H
diff --git a/configdialog/configdialog.ui b/configdialog/configdialog.ui
new file mode 100644 (file)
index 0000000..c952c2a
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigDialog</class>
+ <widget class="QWidget" name="ConfigDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>272</width>
+    <height>231</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="LxQt::PageSelectWidget" name="moduleList">
+       <property name="horizontalScrollBarPolicy">
+        <enum>Qt::ScrollBarAlwaysOff</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QStackedWidget" name="stackedWidget">
+         <property name="currentIndex">
+          <number>-1</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttons">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>LxQt::PageSelectWidget</class>
+   <extends>QListWidget</extends>
+   <header location="global">configdialog/pageselectwidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>moduleList</tabstop>
+  <tabstop>buttons</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>moduleList</sender>
+   <signal>currentRowChanged(int)</signal>
+   <receiver>stackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>150</x>
+     <y>123</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>344</x>
+     <y>117</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/configdialog/pageselectwidget.cpp b/configdialog/pageselectwidget.cpp
new file mode 100644 (file)
index 0000000..52f0f94
--- /dev/null
@@ -0,0 +1,113 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2010-2011 Razor team
+ * Authors:
+ *   Alexander Sokoloff <sokoloff.a@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+
+#include "pageselectwidget.h"
+#include <QtGui/QStyledItemDelegate>
+#include <QtCore/QDebug>
+#include <QtGui/QScrollBar>
+
+using namespace LxQt;
+
+class PageSelectWidgetItemDelegate: public QStyledItemDelegate
+{
+public:
+    explicit PageSelectWidgetItemDelegate(PageSelectWidget *parent = 0);
+    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+private:
+    PageSelectWidget* mView;
+};
+
+
+/************************************************
+
+ ************************************************/
+PageSelectWidgetItemDelegate::PageSelectWidgetItemDelegate(PageSelectWidget *parent):
+    QStyledItemDelegate(parent),
+    mView(parent)
+{
+}
+
+
+/************************************************
+
+ ************************************************/
+QSize PageSelectWidgetItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    QSize size = QStyledItemDelegate::sizeHint(option, index);
+    size.setWidth(mView->viewport()->width() - 2*mView->spacing());
+    return size;
+}
+
+
+
+/************************************************
+
+ ************************************************/
+PageSelectWidget::PageSelectWidget(QWidget *parent) :
+    QListWidget(parent)
+{
+    setSelectionRectVisible(false);
+    setViewMode(IconMode);
+    setSpacing(2);
+    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
+    setWordWrap(true);
+    setDragEnabled(NoDragDrop);
+    setEditTriggers(NoEditTriggers);
+    setTextElideMode(Qt::ElideNone);
+
+    setItemDelegate(new PageSelectWidgetItemDelegate(this));
+}
+
+
+/************************************************
+
+ ************************************************/
+PageSelectWidget::~PageSelectWidget()
+{
+}
+
+
+/************************************************
+
+ ************************************************/
+QSize PageSelectWidget::sizeHint() const
+{
+    QSize size = QListWidget::sizeHint();
+    int w = 0;
+    for(int i=0; i< count(); ++i)
+    {
+        QRect rect = fontMetrics().boundingRect(QRect(), Qt::AlignLeft | Qt::TextWordWrap, item(i)->text());
+        w = qMax(w, rect.width());
+    }
+
+    if (horizontalScrollBar()->isVisible())
+        w += horizontalScrollBar()->width();
+    size.setWidth(w + frameWidth() + spacing()*2 + 10);
+    return size;
+}
diff --git a/configdialog/pageselectwidget.h b/configdialog/pageselectwidget.h
new file mode 100644 (file)
index 0000000..f5ab6fb
--- /dev/null
@@ -0,0 +1,48 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2010-2011 Razor team
+ * Authors:
+ *   Alexander Sokoloff <sokoloff.a@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+
+#ifndef PAGESELECTWIDGET_H
+#define PAGESELECTWIDGET_H
+
+#include <QtGui/QListWidget>
+namespace LxQt
+{
+
+class PageSelectWidget : public QListWidget
+{
+    Q_OBJECT
+public:
+    explicit PageSelectWidget(QWidget *parent = 0);
+    virtual ~PageSelectWidget();
+
+protected:
+    QSize sizeHint() const;
+};
+
+} // namespace LxQt
+#endif // PAGESELECTWIDGET_H
diff --git a/pageselectwidget.cpp b/pageselectwidget.cpp
deleted file mode 100644 (file)
index 1c8991c..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright: 2010-2011 Razor team
- * Authors:
- *   Alexander Sokoloff <sokoloff.a@gmail.com>
- *
- * This program or library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-
-#include "pageselectwidget.h"
-#include <QtGui/QStyledItemDelegate>
-#include <QtCore/QDebug>
-#include <QtGui/QScrollBar>
-
-class PageSelectWidgetItemDelegate: public QStyledItemDelegate
-{
-public:
-    explicit PageSelectWidgetItemDelegate(PageSelectWidget *parent = 0);
-    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
-private:
-    PageSelectWidget* mView;
-};
-
-
-/************************************************
-
- ************************************************/
-PageSelectWidgetItemDelegate::PageSelectWidgetItemDelegate(PageSelectWidget *parent):
-    QStyledItemDelegate(parent),
-    mView(parent)
-{
-}
-
-
-/************************************************
-
- ************************************************/
-QSize PageSelectWidgetItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
-    QSize size = QStyledItemDelegate::sizeHint(option, index);
-    size.setWidth(mView->viewport()->width() - 2*mView->spacing());
-    return size;
-}
-
-
-
-/************************************************
-
- ************************************************/
-PageSelectWidget::PageSelectWidget(QWidget *parent) :
-    QListWidget(parent)
-{
-    setSelectionRectVisible(false);
-    setViewMode(IconMode);
-    setSpacing(2);
-    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
-    setWordWrap(true);
-    setDragEnabled(NoDragDrop);
-    setEditTriggers(NoEditTriggers);
-    setTextElideMode(Qt::ElideNone);
-
-    setItemDelegate(new PageSelectWidgetItemDelegate(this));
-}
-
-
-/************************************************
-
- ************************************************/
-PageSelectWidget::~PageSelectWidget()
-{
-}
-
-
-/************************************************
-
- ************************************************/
-QSize PageSelectWidget::sizeHint() const
-{
-    QSize size = QListWidget::sizeHint();
-    int w = 0;
-    for(int i=0; i< count(); ++i)
-    {
-        QRect rect = fontMetrics().boundingRect(QRect(), Qt::AlignLeft | Qt::TextWordWrap, item(i)->text());
-        w = qMax(w, rect.width());
-    }
-
-    if (horizontalScrollBar()->isVisible())
-        w += horizontalScrollBar()->width();
-    size.setWidth(w + frameWidth() + spacing()*2 + 10);
-    return size;
-}
diff --git a/pageselectwidget.h b/pageselectwidget.h
deleted file mode 100644 (file)
index 38724fa..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright: 2010-2011 Razor team
- * Authors:
- *   Alexander Sokoloff <sokoloff.a@gmail.com>
- *
- * This program or library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-
-#ifndef PAGESELECTWIDGET_H
-#define PAGESELECTWIDGET_H
-
-#include <QtGui/QListWidget>
-
-class PageSelectWidget : public QListWidget
-{
-    Q_OBJECT
-public:
-    explicit PageSelectWidget(QWidget *parent = 0);
-    virtual ~PageSelectWidget();
-
-protected:
-    QSize sizeHint() const;
-};
-
-#endif // PAGESELECTWIDGET_H
diff --git a/razorconfigdialog.cpp b/razorconfigdialog.cpp
deleted file mode 100644 (file)
index 853efec..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright (C) 2012  Alec Moskvin <alecm@gmx.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-#include "razorconfigdialog.h"
-#include "ui_razorconfigdialog.h"
-
-#include <qtxdg/xdgicon.h>
-#include <QtGui/QPushButton>
-
-RazorConfigDialog::RazorConfigDialog(const QString& title, RazorSettings* settings, QWidget* parent) :
-    QDialog(parent),
-    mSettings(settings),
-    mCache(new RazorSettingsCache(settings)),
-    ui(new Ui::RazorConfigDialog)
-{
-    ui->setupUi(this);
-    setWindowTitle(title);
-    connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), SLOT(dialogButtonsAction(QAbstractButton*)));
-    ui->moduleList->setVisible(false);
-    connect(RazorSettings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(updateIcons()));
-    foreach(QPushButton* button, ui->buttons->findChildren<QPushButton*>())
-        button->setAutoDefault(false);
-}
-
-void RazorConfigDialog::addPage(QWidget* page, const QString& name, const QString& iconName)
-{
-    addPage(page, name, QStringList() << iconName);
-}
-
-void RazorConfigDialog::addPage(QWidget* page, const QString& name, const QStringList& iconNames)
-{
-    QStringList icons = QStringList(iconNames) << "application-x-executable";
-    new QListWidgetItem(XdgIcon::fromTheme(icons), name, ui->moduleList);
-    mIcons.append(icons);
-    ui->stackedWidget->addWidget(page);
-    if(ui->stackedWidget->count() > 1)
-    {
-        ui->moduleList->setVisible(true);
-        ui->moduleList->setCurrentRow(0);
-        mMaxSize = QSize(qMax(page->geometry().width() + ui->moduleList->geometry().width(), mMaxSize.width()),
-                         qMax(page->geometry().height() + ui->buttons->geometry().height(), mMaxSize.height()));
-    }
-    else
-    {
-        mMaxSize = page->geometry().size();
-    }
-    resize(mMaxSize);
-}
-
-void RazorConfigDialog::closeEvent(QCloseEvent* event)
-{
-    emit save();
-    mSettings->sync();
-}
-
-void RazorConfigDialog::dialogButtonsAction(QAbstractButton* button)
-{
-    QDialogButtonBox::ButtonRole role = ui->buttons->buttonRole(button);
-    if (role == QDialogButtonBox::ResetRole)
-    {
-        mCache->loadToSettings();
-        emit reset();
-    }
-    else
-    {
-        close();
-    }
-}
-
-void RazorConfigDialog::updateIcons()
-{
-    for (int ix = 0; ix < mIcons.size(); ix++)
-        ui->moduleList->item(ix)->setIcon(XdgIcon::fromTheme(mIcons.at(ix)));
-    update();
-}
-
-RazorConfigDialog::~RazorConfigDialog()
-{
-    delete ui;
-    delete mCache;
-}
diff --git a/razorconfigdialog.h b/razorconfigdialog.h
deleted file mode 100644 (file)
index d5b0b1c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* BEGIN_COMMON_COPYRIGHT_HEADER
- * (c)LGPL2+
- *
- * Razor - a lightweight, Qt based, desktop toolset
- * http://razor-qt.org
- *
- * Copyright (C) 2012  Alec Moskvin <alecm@gmx.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * END_COMMON_COPYRIGHT_HEADER */
-
-#ifndef RAZORCONFIGDIALOG_H
-#define RAZORCONFIGDIALOG_H
-
-#include <razorsettings.h>
-
-#include <QtGui/QDialog>
-#include <QtGui/QAbstractButton>
-
-namespace Ui {
-class RazorConfigDialog;
-}
-
-class RazorConfigDialog : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit RazorConfigDialog(const QString& title, RazorSettings* settings, QWidget* parent = 0);
-    ~RazorConfigDialog();
-
-    /*!
-     * Add a page to the configure dialog
-     */
-    void addPage(QWidget* page, const QString& name, const QString& iconName="application-x-executable");
-
-    /*!
-     * Add a page to the configure dialog, attempting several alternative icons to find one in the theme
-     */
-    void addPage(QWidget* page, const QString& name, const QStringList& iconNames);
-
-signals:
-    /*!
-     * This signal is emitted when the user pressed the "Reset" button.
-     * RazorSettings should be re-read and the widgets should be set accordingly.
-     */
-    void reset();
-
-    /*!
-     * This is emitted whenever the window is closed and settings need to be saved.
-     * It is only necessary if additional actions need to be performed - RazorSettings are handled automatically.
-     */
-    void save();
-
-protected:
-    RazorSettings* mSettings;
-    virtual void closeEvent(QCloseEvent* event);
-
-private:
-    RazorSettingsCache* mCache;
-    QList<QStringList> mIcons;
-    QSize mMaxSize;
-    Ui::RazorConfigDialog* ui;
-
-private slots:
-    void dialogButtonsAction(QAbstractButton* button);
-    void updateIcons();
-
-};
-
-#endif // RAZORCONFIGDIALOG_H
diff --git a/razorconfigdialog.ui b/razorconfigdialog.ui
deleted file mode 100644 (file)
index 3b3f432..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>RazorConfigDialog</class>
- <widget class="QWidget" name="RazorConfigDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>272</width>
-    <height>231</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="PageSelectWidget" name="moduleList">
-       <property name="horizontalScrollBarPolicy">
-        <enum>Qt::ScrollBarAlwaysOff</enum>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <layout class="QVBoxLayout" name="verticalLayout_3">
-       <item>
-        <widget class="QStackedWidget" name="stackedWidget">
-         <property name="currentIndex">
-          <number>-1</number>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QDialogButtonBox" name="buttons">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>PageSelectWidget</class>
-   <extends>QListWidget</extends>
-   <header location="global">pageselectwidget.h</header>
-  </customwidget>
- </customwidgets>
- <tabstops>
-  <tabstop>moduleList</tabstop>
-  <tabstop>buttons</tabstop>
- </tabstops>
- <resources/>
- <connections>
-  <connection>
-   <sender>moduleList</sender>
-   <signal>currentRowChanged(int)</signal>
-   <receiver>stackedWidget</receiver>
-   <slot>setCurrentIndex(int)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>150</x>
-     <y>123</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>344</x>
-     <y>117</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>