diff --git a/qt/about.cpp b/qt/about.cpp new file mode 100644 index 0000000000..11857965f0 --- /dev/null +++ b/qt/about.cpp @@ -0,0 +1,49 @@ +#include "about.hpp" + +#include "../version/version.hpp" + +#include "../platform/platform.hpp" + +#include +#include +#include +#include +#include +#include + +AboutDialog::AboutDialog(QWidget * parent) + : QDialog(parent) +{ + QIcon icon(":logo.png"); + setWindowIcon(icon); + setWindowTitle(QMenuBar::tr("About")); + + QLabel * labelIcon = new QLabel(); + labelIcon->setPixmap(icon.pixmap(128)); + + QString const versionString = tr("

%1 %2

" + "
" + "Built on %3" + ).arg(QString("MapsWithMe"), QLatin1String(VERSION_STRING), + QLatin1String(VERSION_DATE_STRING)); + QLabel * labelVersion = new QLabel(versionString); + + QHBoxLayout * hBox = new QHBoxLayout(); + hBox->addWidget(labelIcon); + hBox->addWidget(labelVersion); + + QFile file(GetPlatform().ReadPathForFile("about.txt").c_str()); + if (file.open(QIODevice::ReadOnly)) + { + QByteArray aboutData = file.readAll(); + file.close(); + + QLabel * labelAbout = new QLabel(aboutData); + QVBoxLayout * vBox = new QVBoxLayout(); + vBox->addLayout(hBox); + vBox->addWidget(labelAbout); + setLayout(vBox); + } + else + setLayout(hBox); +} diff --git a/qt/about.hpp b/qt/about.hpp new file mode 100644 index 0000000000..6f2cbe4cf7 --- /dev/null +++ b/qt/about.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include + +class AboutDialog : public QDialog +{ + Q_OBJECT +public: + explicit AboutDialog(QWidget * parent); +}; diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index eff2859f66..a325c87f75 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -6,17 +6,15 @@ #include "searchwindow.hpp" #include "classificator_tree.hpp" #include "slider_ctrl.hpp" +#include "about.hpp" #include "../indexer/classificator.hpp" -#include "../platform/platform.hpp" - #include #include #include #include #include -#include #include #include "../base/start_mem_debug.hpp" @@ -35,6 +33,7 @@ MainWindow::MainWindow() setCentralWidget(m_pDrawWidget); setWindowTitle(tr("MapsWithMe")); + setWindowIcon(QIcon(":logo.png")); QMenu * helpMenu = new QMenu(tr("Help"), this); menuBar()->addMenu(helpMenu); @@ -226,13 +225,8 @@ void MainWindow::ShowClassifPanel() void MainWindow::OnAbout() { - QFile file(GetPlatform().ReadPathForFile("about.txt").c_str()); - if (file.open(QIODevice::ReadOnly)) - { - QByteArray data = file.readAll(); - QMessageBox::about(this, QMenuBar::tr("About"), data); - file.close(); - } + AboutDialog dlg(this); + dlg.exec(); } } diff --git a/qt/qt.pro b/qt/qt.pro index 83b3ea4c44..f250acd105 100644 --- a/qt/qt.pro +++ b/qt/qt.pro @@ -46,6 +46,7 @@ SOURCES += \ classificator_tree.cpp \ proxystyle.cpp \ slider_ctrl.cpp \ + about.cpp HEADERS += \ mainwindow.hpp \ @@ -57,5 +58,6 @@ HEADERS += \ classificator_tree.hpp \ proxystyle.hpp \ slider_ctrl.hpp \ + about.hpp \ RESOURCES += res/resources.qrc \ diff --git a/qt/res/logo.png b/qt/res/logo.png new file mode 100644 index 0000000000..8dab760201 Binary files /dev/null and b/qt/res/logo.png differ diff --git a/qt/res/resources.qrc b/qt/res/resources.qrc index 20d87edc71..a8cd1b0061 100644 --- a/qt/res/resources.qrc +++ b/qt/res/resources.qrc @@ -15,4 +15,7 @@ plus.png minus.png + + logo.png + diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index 1c67ec3527..984c783085 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -2,8 +2,6 @@ #include "../base/assert.hpp" -#include "../version/version.hpp" - #include #include @@ -53,7 +51,7 @@ namespace qt UpdateDialog::UpdateDialog(QWidget * parent, Storage & storage) : QDialog(parent), m_storage(storage) { - m_label = new QLabel(QObject::tr("Version: ") + VERSION_STRING, this); + //m_label = new QLabel(QObject::tr("Version: ") + VERSION_STRING, this); m_button = new QPushButton(QObject::tr(CHECK_FOR_UPDATE), this); connect(m_button, SIGNAL(clicked(bool)), this, SLOT(OnButtonClick(bool))); @@ -66,7 +64,7 @@ namespace qt connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(OnItemClick(QTreeWidgetItem *, int))); QHBoxLayout * horizontalLayout = new QHBoxLayout(); - horizontalLayout->addWidget(m_label); +// horizontalLayout->addWidget(m_label); horizontalLayout->addWidget(m_button); QVBoxLayout * verticalLayout = new QVBoxLayout(); verticalLayout->addLayout(horizontalLayout); @@ -173,7 +171,7 @@ namespace qt void UpdateDialog::OnUpdateCheck(int64_t updateSize, char const * readme) { if (updateSize < 0) - m_label->setText(QObject::tr("No update is available")); + ;//m_label->setText(QObject::tr("No update is available")); else { QString title(QObject::tr("Update is available")); diff --git a/qt/update_dialog.hpp b/qt/update_dialog.hpp index 851a59bfce..03be8a12ce 100644 --- a/qt/update_dialog.hpp +++ b/qt/update_dialog.hpp @@ -39,7 +39,7 @@ namespace qt private: QTreeWidget * m_tree; - QLabel * m_label; + //QLabel * m_label; QPushButton * m_button; storage::Storage & m_storage; };