Reset to default colors button
authorunc0rr
Sun, 09 Sep 2012 15:37:10 +0400
changeset 7681 26978d581070
parent 7680 46a91cbed8db
child 7682 f6bfbe829008
Reset to default colors button
QTfrontend/ui/page/pageoptions.cpp
QTfrontend/util/DataManager.cpp
QTfrontend/util/DataManager.h
--- a/QTfrontend/ui/page/pageoptions.cpp	Sun Sep 09 14:45:21 2012 +0400
+++ b/QTfrontend/ui/page/pageoptions.cpp	Sun Sep 09 15:37:10 2012 +0400
@@ -403,6 +403,7 @@
             QPushButton * btn = new QPushButton(this);
             gbCLayout->addWidget(btn, (model->rowCount() - 1) / 3 + 1, 0, 1, 3);
             btn->setText(tr("Reset to default colors"));
+            connect(btn, SIGNAL(clicked()), &DataManager::instance(), SLOT(resetColors()));
         }
 
         {
--- a/QTfrontend/util/DataManager.cpp	Sun Sep 09 14:45:21 2012 +0400
+++ b/QTfrontend/util/DataManager.cpp	Sun Sep 09 15:37:10 2012 +0400
@@ -207,3 +207,11 @@
     m_themeModel->loadThemes();
     emit updated();
 }
+
+void DataManager::resetColors()
+{
+    for(int i = colorsModel()->rowCount() - 1; i >= 0; --i)
+    {
+        m_colorsModel->item(i)->setData(QColor(colors[i]));
+    }
+}
--- a/QTfrontend/util/DataManager.h	Sun Sep 09 14:45:21 2012 +0400
+++ b/QTfrontend/util/DataManager.h	Sun Sep 09 15:37:10 2012 +0400
@@ -133,6 +133,7 @@
     public slots:
         /// Reloads data from storage.
         void reload();
+        void resetColors();
 
 
     signals: