Initial version of new about dialog
authorNikolay Tischenko <niktischenko@gmail.com>
Sat, 4 Dec 2010 08:07:37 +0000 (14:07 +0600)
committerNikolay Tischenko <niktischenko@gmail.com>
Sat, 4 Dec 2010 08:07:37 +0000 (14:07 +0600)
someplayer.pro
src/aboutform.cpp [new file with mode: 0644]
src/aboutform.h [new file with mode: 0644]
src/mainwindow.cpp
src/mainwindow.h
src/ui/aboutform.ui [new file with mode: 0644]

index c671223..12e7248 100644 (file)
@@ -127,7 +127,8 @@ SOURCES += src/main.cpp\
     src/coverfinder.cpp \
     src/clickablelabel.cpp \
     src/settingsform.cpp \
-    src/dbusclient.cpp
+    src/dbusclient.cpp \
+    src/aboutform.cpp
 
 HEADERS  += src/mainwindow.h \
                src/player/player.h \
@@ -233,7 +234,8 @@ HEADERS  += src/mainwindow.h \
     src/coverfinder.h \
     src/clickablelabel.h \
     src/settingsform.h \
-    src/dbusclient.h
+    src/dbusclient.h \
+    src/aboutform.h
 
 FORMS    += src/ui/mainwindow.ui \
     src/ui/playerform.ui \
@@ -247,7 +249,8 @@ FORMS    += src/ui/mainwindow.ui \
     src/ui/toolswidget.ui \
     src/ui/managelibraryform.ui \
     src/ui/directoryview.ui \
-    src/ui/settingsform.ui
+    src/ui/settingsform.ui \
+    src/ui/aboutform.ui
 
 CONFIG += mobility
 MOBILITY = 
diff --git a/src/aboutform.cpp b/src/aboutform.cpp
new file mode 100644 (file)
index 0000000..ab1ddf3
--- /dev/null
@@ -0,0 +1,31 @@
+#include "aboutform.h"
+#include "ui_aboutform.h"
+#include "config.h"
+
+using namespace SomePlayer::Storage;
+
+AboutForm::AboutForm(QWidget *parent) :
+               QWidget(parent),
+               ui(new Ui::AboutForm)
+{
+       ui->setupUi(this);
+       updateIcons();
+       updateTranslations();
+       setAttribute(Qt::WA_Maemo5StackedWindow);
+       setWindowFlags(Qt::Window | windowFlags());
+}
+
+AboutForm::~AboutForm()
+{
+       delete ui;
+}
+
+void AboutForm::updateIcons() {
+       Config config;
+       _icons_theme = config.getValue("ui/iconstheme").toString();
+       ui->logoLabel->setPixmap(QPixmap(":/icons/"+_icons_theme+"/player.png"));
+}
+
+void AboutForm::updateTranslations() {
+       ui->retranslateUi(this);
+}
diff --git a/src/aboutform.h b/src/aboutform.h
new file mode 100644 (file)
index 0000000..6fe2dc9
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ABOUTFORM_H
+#define ABOUTFORM_H
+
+#include <QWidget>
+#include "someplayer.h"
+
+namespace Ui {
+       class AboutForm;
+}
+
+class AboutForm : public QWidget
+{
+       Q_OBJECT
+
+public:
+       explicit AboutForm(QWidget *parent = 0);
+       ~AboutForm();
+
+public slots:
+       void updateTranslations();
+       void updateIcons();
+
+private:
+       Ui::AboutForm *ui;
+       QString _icons_theme;
+};
+
+#endif // ABOUTFORM_H
index ddc1a3e..8898579 100644 (file)
 #include "equalizerdialog.h"
 #include "saveplaylistdialog.h"
 #include "settingsform.h"
-#include <QtGui/QX11Info>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
 
 using namespace SomePlayer::DataObjects;
 using namespace SomePlayer::Storage;
@@ -65,6 +61,8 @@ MainWindow::MainWindow(QWidget *parent) :
        _manage_library_form = new ManageLibraryForm(_library, this);
        _settings_form = new SettingsForm(this);
        _settings_form->hide();
+       _about_form = new AboutForm(this);
+       _about_form->hide();
        connect(_player_form, SIGNAL(library()), this, SLOT(library()));
        connect(_library_form, SIGNAL(refreshPlayer()), this, SLOT(player()));
        connect(ui->actionManageLibrary, SIGNAL(triggered()), this, SLOT(_manage_library()));
@@ -89,6 +87,7 @@ MainWindow::MainWindow(QWidget *parent) :
        connect(_settings_form, SIGNAL(iconsChanged()), _library_form, SLOT(updateIcons()));
        connect(_settings_form, SIGNAL(iconsChanged()), _manage_library_form, SLOT(updateIcons()));
        connect(_settings_form, SIGNAL(iconsChanged()), _directory_form, SLOT(updateIcons()));
+       connect(_settings_form, SIGNAL(iconsChanged()), _about_form, SLOT(updateIcons()));
        connect(_settings_form, SIGNAL(gradientChanged()), _player_form, SLOT(checkGradient()));
        connect(_settings_form, SIGNAL(gradientChanged()), _library_form, SLOT(checkGradient()));
        connect(_settings_form, SIGNAL(gradientChanged()), _directory_form, SLOT(checkGradient()));
@@ -141,9 +140,7 @@ MainWindow::~MainWindow()
 }
 
 void MainWindow::about() {
-       QMessageBox::about(this, QString("About SomePlayer v")+_SOMEPLAYER_VERSION_, "Alternate music player for Maemo 5 "
-                                          "written in C++ with Qt4\n\n"
-                                          "Author: Nikolay Tischenko aka \"somebody\" <niktischenko@gmail.com>");
+       _about_form->show();
 }
 
 void MainWindow::player() {
@@ -192,13 +189,13 @@ void MainWindow::_save_playlist() {
                QString name = dialog.selectedName();
                bool append = false;
                if (playlists.contains(name)) {
-                       if (QMessageBox::question(this, "Append to playlist?", "Playlist with name \""+name+"\" already exists.\n"
-                                                 "Dow you want to append current playlist to it?",
-                                                 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
-                               append = true;
-                       } else {
-                               append = false;
+                       if (QMessageBox::question(this, "Overwrite playlist?", "Overwrite playlist \""+name+"\"?", QMessageBox::Ok, QMessageBox::Cancel)
+                               != QMessageBox::Ok) {
+                               return;
                        }
+                       append = (QMessageBox::question(this, "Append to playlist?", "Playlist with name \""+name+"\" already exists.\n"
+                                                 "Dow you want to append current playlist to it?",
+                                                 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok);
                }
                if (append) {
                        Playlist target = _library->getPlaylist(name);
@@ -345,6 +342,7 @@ void MainWindow::updateTranslations() {
        _manage_library_form->updateTranslations();
        _directory_form->updateTranslations();
        _settings_form->updateTranslations();
+       _about_form->updateTranslations();
 }
 
 void MainWindow::_hw_zoom_policy_changed() {
index cc405f1..00ee86c 100644 (file)
@@ -30,6 +30,7 @@
 #include "managelibraryform.h"
 #include "directoryview.h"
 #include "settingsform.h"
+#include "aboutform.h"
 #include "library.h"
 #include "dbusclient.h"
 #include <QTimer>
@@ -83,6 +84,7 @@ private:
        BusyWidget *_busy_widget;
        DirectoryView *_directory_form;
        SettingsForm *_settings_form;
+       AboutForm *_about_form;
        Library *_library;
        QTimer *_timer;
        EqualizerDialog *_equalizer_dialog;
diff --git a/src/ui/aboutform.ui b/src/ui/aboutform.ui
new file mode 100644 (file)
index 0000000..ac21220
--- /dev/null
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutForm</class>
+ <widget class="QWidget" name="AboutForm">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>570</width>
+    <height>343</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>About SomePlayer</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QScrollArea" name="scrollArea">
+     <property name="horizontalScrollBarPolicy">
+      <enum>Qt::ScrollBarAlwaysOff</enum>
+     </property>
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>550</width>
+        <height>466</height>
+       </rect>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <layout class="QGridLayout" name="gridLayout">
+         <item row="0" column="0">
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLabel" name="logoLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>80</width>
+             <height>80</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>80</width>
+             <height>80</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+           <property name="pixmap">
+            <pixmap resource="../../resources/resources.qrc">:/icons/white/player.png</pixmap>
+           </property>
+           <property name="scaledContents">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="2">
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item row="1" column="0" colspan="3">
+          <widget class="QLabel" name="nameLabel">
+           <property name="text">
+            <string>&lt;b&gt;SomePlayer&lt;/b&gt; </string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="aboutTextLabel">
+         <property name="text">
+          <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body&gt;
+&lt;p align=&quot;center&quot;&gt;An alternate music player for Maemo 5 with library, playlists, equalizer and many other things support&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="descriptionTextLabel">
+         <property name="text">
+          <string>&lt;p align=&quot;center&quot;&gt;Licensed under GPLv2&lt;br&gt;
+By Nikolay Tischenko (somebody)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;b&gt;SomePlayer&lt;/b&gt; try to be full replacement of standart music player for Maemo5 with many other features such as equalizer, custom playlists from files, smarter random mode, more flexible library and improved cover search algorithm&lt;/p&gt;</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="thanksToLabel">
+         <property name="text">
+          <string>&lt;p align=&quot;center&quot;&gt;&lt;b&gt;Thanks to:&lt;/b&gt;&lt;/p&gt;
+&lt;p align=&quot;center&quot;&gt;MrClon (maemoworld.ru)&lt;br&gt;hxka (maemoworld.ru)&lt;br&gt;jerich0 (maemoworld.ru)&lt;/p&gt;</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../../resources/resources.qrc"/>
+ </resources>
+ <connections/>
+</ui>