WWW, settings and info buttons changed to custom buttons.
authorJukka Kurttila <jktla@suomi24.fi>
Thu, 6 May 2010 14:32:37 +0000 (17:32 +0300)
committerJukka Kurttila <jktla@suomi24.fi>
Thu, 6 May 2010 14:32:37 +0000 (17:32 +0300)
Client/Graphics/applications_internet_selected.png [new file with mode: 0644]
Client/Graphics/info_selected.png [new file with mode: 0644]
Client/Graphics/route_selected.png
Client/Graphics/settings_selected.png [new file with mode: 0644]
Client/custombutton.cpp
Client/graphics.qrc
Client/mainwindow.cpp
Client/mainwindow.h
Client/mainwindow.ui

diff --git a/Client/Graphics/applications_internet_selected.png b/Client/Graphics/applications_internet_selected.png
new file mode 100644 (file)
index 0000000..d8728f8
Binary files /dev/null and b/Client/Graphics/applications_internet_selected.png differ
diff --git a/Client/Graphics/info_selected.png b/Client/Graphics/info_selected.png
new file mode 100644 (file)
index 0000000..1ae9572
Binary files /dev/null and b/Client/Graphics/info_selected.png differ
index 846d193..ddcf836 100644 (file)
Binary files a/Client/Graphics/route_selected.png and b/Client/Graphics/route_selected.png differ
diff --git a/Client/Graphics/settings_selected.png b/Client/Graphics/settings_selected.png
new file mode 100644 (file)
index 0000000..4e6e3e5
Binary files /dev/null and b/Client/Graphics/settings_selected.png differ
index af023ad..3907267 100644 (file)
 CustomButton::CustomButton(QWidget *parent, QIcon *icon) : QWidget(parent)
 {
     bPressed = false;
 CustomButton::CustomButton(QWidget *parent, QIcon *icon) : QWidget(parent)
 {
     bPressed = false;
+    //Get size of the icon
+    QList<QSize> list = icon->availableSizes(QIcon::Normal,QIcon::On);
+
+    //If icon is empty, do not create pixmaps and leave
+    if(list.isEmpty())
+        return;
+    QSize size = list.first();
     if( icon )
     {
     if( icon )
     {
-        pict1 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::On));
-        pict2 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::Off));
+        pict1 = new QPixmap(icon->pixmap(size.width(),size.height(),QIcon::Normal,QIcon::On));
+        pict2 = new QPixmap(icon->pixmap(size.width(),size.height(),QIcon::Normal,QIcon::Off));
     }
 }
 /**
     }
 }
 /**
index f0c4aa2..e25bf47 100644 (file)
         <file>Graphics/sf_2.png</file>
         <file>Graphics/measuringDialog.png</file>
         <file>Graphics/settingsDialog.png</file>
         <file>Graphics/sf_2.png</file>
         <file>Graphics/measuringDialog.png</file>
         <file>Graphics/settingsDialog.png</file>
-        <file>Graphics/route_selected.png</file>
         <file>Graphics/trophy_gold_selected.png</file>
         <file>Graphics/trophy_gold_selected.png</file>
+        <file>Graphics/settings_selected.png</file>
+        <file>Graphics/applications_internet_selected.png</file>
+        <file>Graphics/route_selected.png</file>
+        <file>Graphics/info_selected.png</file>
     </qresource>
 </RCC>
     </qresource>
 </RCC>
index 56c7238..3e8d531 100644 (file)
@@ -49,14 +49,6 @@ MainWindow::MainWindow(QWidget *parent) :
 
     this->setUsernameToMainPanel();
 
 
     this->setUsernameToMainPanel();
 
-    //Button settings
-    ui->pushButtonSettings->setAutoFillBackground(true);
-    ui->pushButtonSettings->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
-    ui->pushButtonWWW->setAutoFillBackground(true);
-    ui->pushButtonWWW->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
-    ui->pushButtonCredits->setAutoFillBackground(true);
-    ui->pushButtonCredits->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
-
     //Create icon for acceleration start button
     QIcon* icon = new QIcon();
     icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
     //Create icon for acceleration start button
     QIcon* icon = new QIcon();
     icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
@@ -101,6 +93,49 @@ MainWindow::MainWindow(QWidget *parent) :
     customButtonResults->setGeometry(buttons_x,buttons_y,130,130);
     connect(customButtonResults, SIGNAL(OpenDialog()), this, SLOT(OpenResultDialog()));
     customButtonResults->show();
     customButtonResults->setGeometry(buttons_x,buttons_y,130,130);
     connect(customButtonResults, SIGNAL(OpenDialog()), this, SLOT(OpenResultDialog()));
     customButtonResults->show();
+    //Create icon for settings dialog button
+    icon = new QIcon();
+    icon->addFile(QString(":/new/prefix1/Graphics/settings.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
+    icon->addFile(QString(":/new/prefix1/Graphics/settings_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);
+
+    //Settings dialog button
+
+    customButtonSettings = new CustomButton(this,icon);
+    delete icon;
+
+    buttons_x += 140;
+    customButtonSettings->setGeometry(buttons_x,buttons_y,130,130);
+    connect(customButtonSettings, SIGNAL(OpenDialog()), this, SLOT(OpenSettingsDialog()));
+    customButtonSettings->show();
+
+    //Create icon for www page button
+    icon = new QIcon();
+    icon->addFile(QString(":/new/prefix1/Graphics/applications_internet.png"), QSize(125,125), QIcon::Normal, QIcon::Off);
+    icon->addFile(QString(":/new/prefix1/Graphics/applications_internet_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On);
+
+    //WWW page button
+
+    customButtonWWW = new CustomButton(this,icon);
+    delete icon;
+
+    buttons_x += 140;
+    customButtonWWW->setGeometry(buttons_x,buttons_y,130,130);
+    connect(customButtonWWW, SIGNAL(OpenDialog()), this, SLOT(OpenWWWPage()));
+    customButtonWWW->show();
+
+    //Create icon for help dialog button
+    icon = new QIcon();
+    icon->addFile(QString(":/new/prefix1/Graphics/info.png"), QSize(105,105), QIcon::Normal, QIcon::Off);
+    icon->addFile(QString(":/new/prefix1/Graphics/info_selected.png"), QSize(105,105), QIcon::Normal, QIcon::On);
+
+    //Help dialog button
+
+    customButtonHelp = new CustomButton(this,icon);
+    delete icon;
+
+    customButtonHelp->setGeometry(670,10,105,105);
+    connect(customButtonHelp, SIGNAL(OpenDialog()), this, SLOT(OpenHelpDialog()));
+    customButtonHelp->show();
 }
 
 /**
 }
 
 /**
@@ -137,9 +172,15 @@ MainWindow::~MainWindow()
         delete customButtonRoute;
     if(customButtonResults)
         delete customButtonResults;
         delete customButtonRoute;
     if(customButtonResults)
         delete customButtonResults;
-
+    if(customButtonSettings)
+        delete customButtonSettings;
+    if(customButtonWWW)
+        delete customButtonWWW;
+    if(customButtonHelp)
+        delete customButtonHelp;
 }
 
 }
 
+
 /**
   *
   */
 /**
   *
   */
@@ -156,34 +197,6 @@ void MainWindow::changeEvent(QEvent *e)
 }
 
 /**
 }
 
 /**
-  * This slot function opens browser to project www page.
-  */
-void MainWindow::on_pushButtonWWW_clicked()
-{
-    QDesktopServices::openUrl(QUrl("http://garage.maemo.org/projects/speedfreak/"));
-}
-
-/**
-  * This slot function opens the credits dialog
-  */
-void MainWindow::on_pushButtonCredits_clicked()
-{
-    if(!helpDialog)
-        helpDialog = new HelpDialog;
-
-    connect(helpDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
-    helpDialog->show();
-}
-
-/**
-  * This slot function opens the settings dialog
-  */
-void MainWindow::on_pushButtonSettings_clicked()
-{
-    settingsDialog->show();
-}
-
-/**
   *This slot function is called when ever mytTopResultDialog emits signal refreshCategoryList button clicked.
   */
 void MainWindow::clientRequestCategoryList()
   *This slot function is called when ever mytTopResultDialog emits signal refreshCategoryList button clicked.
   */
 void MainWindow::clientRequestCategoryList()
@@ -380,6 +393,31 @@ void MainWindow::OpenResultDialog()
     connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
     topResultDialog->show();
 }
     connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
     topResultDialog->show();
 }
+/**
+  * This slot function opens the settings dialog
+  */
+void MainWindow::OpenSettingsDialog()
+{
+    settingsDialog->show();
+}
+/**
+  * This slot function opens browser to project www page.
+  */
+void MainWindow::OpenWWWPage()
+{
+    QDesktopServices::openUrl(QUrl("http://garage.maemo.org/projects/speedfreak/"));
+}
+/**
+  * This slot function opens the main help dialog
+  */
+void MainWindow::OpenHelpDialog()
+{
+    if(!helpDialog)
+        helpDialog = new HelpDialog;
+
+    connect(helpDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
+    helpDialog->show();
+}
 
 /**
   * This slot function save user profile data to server
 
 /**
   * This slot function save user profile data to server
index 548c339..fb115ae 100644 (file)
@@ -59,11 +59,11 @@ private:
     CustomButton* customButtonAccelerate;
     CustomButton* customButtonRoute;
     CustomButton* customButtonResults;
     CustomButton* customButtonAccelerate;
     CustomButton* customButtonRoute;
     CustomButton* customButtonResults;
+    CustomButton* customButtonSettings;
+    CustomButton* customButtonWWW;
+    CustomButton* customButtonHelp;
 
 private slots:
 
 private slots:
-    void on_pushButtonSettings_clicked();
-    void on_pushButtonCredits_clicked();
-    void on_pushButtonWWW_clicked();
     void clientRequestCategoryList();
     void clientRequestTopList(int index);
     void clientSendRoute();
     void clientRequestCategoryList();
     void clientRequestTopList(int index);
     void clientSendRoute();
@@ -78,7 +78,9 @@ private slots:
     void OpenRouteDialog();
     void OpenResultDialog();
     void saveProfile();
     void OpenRouteDialog();
     void OpenResultDialog();
     void saveProfile();
-
+    void OpenWWWPage();
+    void OpenHelpDialog();
+    void OpenSettingsDialog();
 };
 
 #endif // MAINWINDOW_H
 };
 
 #endif // MAINWINDOW_H
index 562ec58..4ad8998 100644 (file)
    <string>SpeedFreak</string>
   </property>
   <widget class="QWidget" name="centralWidget">
    <string>SpeedFreak</string>
   </property>
   <widget class="QWidget" name="centralWidget">
-   <widget class="QPushButton" name="pushButtonSettings">
-    <property name="geometry">
-     <rect>
-      <x>470</x>
-      <y>150</y>
-      <width>130</width>
-      <height>130</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string/>
-    </property>
-    <property name="icon">
-     <iconset resource="graphics.qrc">
-      <normaloff>:/new/prefix1/Graphics/settings.png</normaloff>:/new/prefix1/Graphics/settings.png</iconset>
-    </property>
-    <property name="iconSize">
-     <size>
-      <width>125</width>
-      <height>125</height>
-     </size>
-    </property>
-   </widget>
-   <widget class="QPushButton" name="pushButtonWWW">
-    <property name="geometry">
-     <rect>
-      <x>610</x>
-      <y>150</y>
-      <width>130</width>
-      <height>130</height>
-     </rect>
-    </property>
-    <property name="autoFillBackground">
-     <bool>true</bool>
-    </property>
-    <property name="text">
-     <string/>
-    </property>
-    <property name="icon">
-     <iconset resource="graphics.qrc">
-      <normaloff>:/new/prefix1/Graphics/applications_internet.png</normaloff>:/new/prefix1/Graphics/applications_internet.png</iconset>
-    </property>
-    <property name="iconSize">
-     <size>
-      <width>125</width>
-      <height>125</height>
-     </size>
-    </property>
-   </widget>
-   <widget class="QPushButton" name="pushButtonCredits">
-    <property name="geometry">
-     <rect>
-      <x>670</x>
-      <y>10</y>
-      <width>105</width>
-      <height>105</height>
-     </rect>
-    </property>
-    <property name="text">
-     <string/>
-    </property>
-    <property name="icon">
-     <iconset resource="graphics.qrc">
-      <normaloff>:/new/prefix1/Graphics/info.png</normaloff>:/new/prefix1/Graphics/info.png</iconset>
-    </property>
-    <property name="iconSize">
-     <size>
-      <width>100</width>
-      <height>100</height>
-     </size>
-    </property>
-   </widget>
    <widget class="QLabel" name="label">
     <property name="geometry">
      <rect>
    <widget class="QLabel" name="label">
     <property name="geometry">
      <rect>