Merge branch 'master' of mercury.wipsl.com:/var/git/irwi
authorTorste Aikio <zokier@zokier.laptop>
Wed, 2 Jun 2010 10:20:02 +0000 (13:20 +0300)
committerTorste Aikio <zokier@zokier.laptop>
Wed, 2 Jun 2010 10:20:02 +0000 (13:20 +0300)
src/advsettingsdlg.cpp
src/mainwidget.cpp
src/mainwidget.h

index b750f28..6a81586 100644 (file)
@@ -77,6 +77,8 @@ void AdvSettingsDlg::setDefaults()
     settings->setValue("remoteUrl",
         "http://mercury.wipsl.com/irwi/remotes/");
     settings->setValue("bgAlpha", 192);
+    settings->setValue("height", 147);
+    settings->setValue("width", 250);
 }
 
 void AdvSettingsDlg::showResetQuery()
index 91baec3..48e049f 100644 (file)
@@ -31,6 +31,8 @@ MainWidget::MainWidget (QWidget *parent)
             settings->value(QString("buttonIcon") + QString::number(i),
                 iconNames[i]).toString()))); 
         buttons[i] = button;
+        button->setSizePolicy(QSizePolicy::MinimumExpanding,
+                QSizePolicy::MinimumExpanding);
         layout->addWidget(button, i%2, i/2);
     }
 
@@ -46,6 +48,7 @@ MainWidget::MainWidget (QWidget *parent)
     this->setLayout(layout);
     this->setAttribute(Qt::WA_TranslucentBackground);
     this->setAttribute(Qt::WA_OpaquePaintEvent);
+    resize();
 }
 
 MainWidget::~MainWidget()
@@ -66,7 +69,17 @@ void MainWidget::showSettingsDialog()
     SettingsDlg dlg;
     dlg.exec();
     update(); // Repaint required if bgAlpha value was changed
+    resize();
 }
 
-
+void MainWidget::resize()
+{
+    int w = settings->value("width", "250").toInt();
+    int h = settings->value("height", "148").toInt();
+    if (w < 1)
+        w = 250;
+    if (h < 1)
+        h = 148;
+    QWidget::resize(w, h);
+}
 
index cfc0132..1f74c10 100644 (file)
@@ -21,8 +21,9 @@ public slots:
 
 protected:
     void paintEvent(QPaintEvent *event);
+
 private:
+    void resize();
     static const int BUTTON_COUNT = 6;
     QGridLayout *layout;
     QToolButton *buttons[BUTTON_COUNT];