From ff260fcd0604b25aaeb9fba575dcca0df2cbd996 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 28 Jun 2015 11:21:02 +0200 Subject: [PATCH] Closes #10 finalize standalone version --- src/UMWP_Autochanger.pro | 6 ++- src/UMWP_Autochanger.qrc | 2 + src/constants.h | 4 +- src/environment.h | 2 +- src/gui/changelogdialog.h | 68 ++++++++++++++++++++++++++++++++ src/gui/changelogdialog.ui | 74 +++++++++++++++++++++++++++++++++++ src/gui/mainwindow.cpp | 67 +++++++++++++++++++++---------- src/gui/mainwindow.h | 1 + src/lang/en_GB/changelog.htm | 13 ++++++ src/lang/en_GB/main.ts | 51 +++++++++++++++--------- src/lang/fr_FR/changelog.htm | 13 ++++++ src/lang/fr_FR/main.qm | Bin 10760 -> 10929 bytes src/lang/fr_FR/main.ts | 51 +++++++++++++++--------- src/main.cpp | 9 +---- src/settings.cpp | 1 + src/wallpapergenerator.cpp | 40 +++++++++---------- 16 files changed, 313 insertions(+), 89 deletions(-) create mode 100644 src/gui/changelogdialog.h create mode 100644 src/gui/changelogdialog.ui create mode 100644 src/lang/en_GB/changelog.htm create mode 100644 src/lang/fr_FR/changelog.htm diff --git a/src/UMWP_Autochanger.pro b/src/UMWP_Autochanger.pro index ff9a657..c6ea523 100644 --- a/src/UMWP_Autochanger.pro +++ b/src/UMWP_Autochanger.pro @@ -54,14 +54,16 @@ HEADERS += \ gui/trayicon.h \ gui/setcontextmenu.h \ gui/screensdialog.h \ - wallpapergenerator.h + wallpapergenerator.h \ + gui/changelogdialog.h FORMS += \ ext/qhotkeywidget.ui \ gui/seteditdialog.ui \ gui/configdialog.ui \ gui/newversiondialog.ui \ - gui/screensdialog.ui + gui/screensdialog.ui \ + gui/changelogdialog.ui RESOURCES += \ UMWP_Autochanger.qrc diff --git a/src/UMWP_Autochanger.qrc b/src/UMWP_Autochanger.qrc index 5f852a4..94dd69c 100644 --- a/src/UMWP_Autochanger.qrc +++ b/src/UMWP_Autochanger.qrc @@ -45,5 +45,7 @@ lang/fr_FR/flag.png lang/fr_FR/help.htm lang/fr_FR/main.qm + lang/fr_FR/changelog.htm + lang/en_GB/changelog.htm diff --git a/src/constants.h b/src/constants.h index 44d48ac..90033fa 100644 --- a/src/constants.h +++ b/src/constants.h @@ -5,13 +5,13 @@ #define APP_VERSION "2.0.0" #define APP_VERSION_DW 2,0,0 #define APP_COMPANYNAME "StrangePlanet" -#define APP_FILEDESCRIPTION "UltraMon Wallpaper Autochanger" +#define APP_FILEDESCRIPTION "Ultimate Monitor Wallpaper Autochanger" #define APP_LEGALCOPYRIGHT "Copyright (c) 2013-2015 StrangePlanet" #define APP_ORIGINALFILENAME "UMWP_Autochanger.exe" #define APP_CONFIG_FILE "settings.xml" #define APP_CACHE_DIR "cache/" -#define APP_WALLPAPER_FILE "wallpaper.jpg" +#define APP_WALLPAPER_FILE "wallpaper.bmp" #define APP_MAX_TRAVERSAL 3 #define APP_HOMEPAGE "http://www.strangeplanet.fr/work/umwp-autochanger" diff --git a/src/environment.h b/src/environment.h index 5969319..7663d58 100644 --- a/src/environment.h +++ b/src/environment.h @@ -26,7 +26,7 @@ class Environment private: Settings* m_settings; - QString m_shortcutPath; // environnement variables + QString m_shortcutPath; QList m_languages; // languages packaged with UMWPA QHash m_wpSizes; // monitors sizes NewVersion m_newVersion; // struct to hold new version data diff --git a/src/gui/changelogdialog.h b/src/gui/changelogdialog.h new file mode 100644 index 0000000..a304c5d --- /dev/null +++ b/src/gui/changelogdialog.h @@ -0,0 +1,68 @@ +#ifndef CHANGELOGDIALOG_H +#define CHANGELOGDIALOG_H + +#include +#include +#include + +#include "ui_changelogdialog.h" + +namespace Ui { + class ChangelogDialog; +} + + +/** + * @brief Simple dialog with a rich text viewer + */ +class ChangelogDialog : public QDialog +{ + Q_OBJECT + +private: + Ui::ChangelogDialog *ui; + +public: + ChangelogDialog(QWidget* _parent = 0) : + QDialog(_parent), + ui(new Ui::ChangelogDialog) + { + ui->setupUi(this); + + QFile file; + QString lang = QLocale::system().name().section('_', 0, 0); + if (lang.compare("fr")==0) + { + file.setFileName(":/lang/fr_FR/changelog.htm"); + } + else + { + file.setFileName(":/lang/en_GB/changelog.htm"); + } + + QString text; + text.append(""); + + file.open(QIODevice::ReadOnly); + QTextStream content(&file); + content.setCodec("UTF-8"); + text.append(content.readAll()); + file.close(); + + ui->content->setText(text); + + setWindowTitle(tr("Changelog")); + } + + ~ChangelogDialog() + { + delete ui; + } +}; + +#endif // CHANGELOGDIALOG_H diff --git a/src/gui/changelogdialog.ui b/src/gui/changelogdialog.ui new file mode 100644 index 0000000..8dbfc34 --- /dev/null +++ b/src/gui/changelogdialog.ui @@ -0,0 +1,74 @@ + + + ChangelogDialog + + + + 0 + 0 + 450 + 400 + + + + Changelog + + + + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + true + + + + + + + + + buttonBox + accepted() + ChangelogDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ChangelogDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index f6fb307..c429d4f 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -12,6 +12,7 @@ #include "previewdialog.h" #include "newversiondialog.h" #include "setcontextmenu.h" +#include "changelogdialog.h" /** @@ -90,6 +91,11 @@ void MainWindow::init() else { show(); + + if (QString::fromAscii(APP_VERSION).compare(m_settings->get("changelog_shown").toString()) > 0) + { + openChangelogDialog(); + } } defineHotkeys(); @@ -305,34 +311,46 @@ void MainWindow::openImportDialog() */ void MainWindow::openHelpDialog() { - QFile helpFile; + QFile file; QString lang = QLocale::system().name().section('_', 0, 0); if (lang.compare("fr")==0) { - helpFile.setFileName(":/lang/fr_FR/help"); + file.setFileName(":/lang/fr_FR/help.htm"); } else { - helpFile.setFileName(":/lang/en_GB/help"); + file.setFileName(":/lang/en_GB/help.htm"); } - QString mainText; - mainText.append(""); + QString text; + text.append(""); - helpFile.open(QIODevice::ReadOnly); - QTextStream content(&helpFile); + file.open(QIODevice::ReadOnly); + QTextStream content(&file); content.setCodec("UTF-8"); - mainText.append(content.readAll()); - helpFile.close(); + text.append(content.readAll()); + file.close(); QMessageBox dialog(this); dialog.setIcon(QMessageBox::Information); - dialog.setText(mainText); dialog.setWindowTitle(tr("User guide")); + dialog.setText(text); + dialog.setWindowTitle(tr("User guide")); + dialog.exec(); +} + +/** + * @brief Open changelog dialog + */ +void MainWindow::openChangelogDialog() +{ + ChangelogDialog dialog(this); dialog.exec(); + + m_settings->setOpt("changelog_shown", QString::fromAscii(APP_VERSION)); } /** @@ -340,16 +358,25 @@ void MainWindow::openHelpDialog() */ void MainWindow::openAboutDialog() { - QString mainText = "

" + QString::fromAscii(APP_NAME) + " " + QString::fromAscii(APP_VERSION) + "

"; - mainText+= "Created by Damien \"Mistic\" Sorel.
"; - mainText+= "© 2013-2015 StrangePlanet.fr
"; - mainText+= "Licenced under GNU General Public License Version 3"; + QString text = "

" + QString::fromAscii(APP_NAME) + " " + QString::fromAscii(APP_VERSION) + "

"; + text+= "Created by Damien \"Mistic\" Sorel.
"; + text+= "© 2013-2015 StrangePlanet.fr
"; + text+= "Licenced under GNU General Public License Version 3"; - QMessageBox dialog(this); + QMessageBox dialog; dialog.setIcon(QMessageBox::Information); - dialog.setText(mainText); dialog.setWindowTitle(tr("About")); - dialog.exec(); + dialog.setText(text); + dialog.setStandardButtons(QMessageBox::Close | QMessageBox::Open); + dialog.setDefaultButton(QMessageBox::Close); + dialog.setButtonText(QMessageBox::Open, tr("Changelog")); + + int ret = dialog.exec(); + + if (ret == QMessageBox::Open) + { + openChangelogDialog(); + } } /** diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 4d303f7..b0ff3ff 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -59,6 +59,7 @@ public slots: void openScreensDialog(); void openHelpDialog(); void openAboutDialog(); + void openChangelogDialog(); void openPreviewDialog(); void openExportDialog(); void openImportDialog(); diff --git a/src/lang/en_GB/changelog.htm b/src/lang/en_GB/changelog.htm new file mode 100644 index 0000000..70cd6b5 --- /dev/null +++ b/src/lang/en_GB/changelog.htm @@ -0,0 +1,13 @@ +
+
Version 2.0.0 June 28th 2015
+
+

UMWP Autochanger has a new name ! Now it is Ultimate Monitor Wallpaper Autochanger. It was renamed because it does not depend on UltraMon anymore and is completely autonomous.

+ +
    +
  • Delete all dependencies to UltraMon.
  • +
  • Allows to edit keyboard hotkeys of multiple sets in one time.
  • +
  • Adds a "Open directory" button in the context menu.
  • +
  • Allows to hide the closing warning.
  • +
+
+
\ No newline at end of file diff --git a/src/lang/en_GB/main.ts b/src/lang/en_GB/main.ts index 5cf3c4c..b8f5f93 100644 --- a/src/lang/en_GB/main.ts +++ b/src/lang/en_GB/main.ts @@ -1,6 +1,15 @@ + + ChangelogDialog + + + + Changelog + + + ConfigDialog @@ -195,84 +204,90 @@ MainWindow - + Quit - + Import configuration file - + Export configuration file - + About - - + + XML files (*.xml) - + Add set - + Error - + Invalid settings file - + + User guide - + + Changelog + + + + Paused - + Running - + Current sets : %1 - - + + A new version is available : %1 - + Close and don't show this message again - + %1 is still running - + If you quit the application now,<br>the wallpaper will not change anymore. diff --git a/src/lang/fr_FR/changelog.htm b/src/lang/fr_FR/changelog.htm new file mode 100644 index 0000000..c94a8f4 --- /dev/null +++ b/src/lang/fr_FR/changelog.htm @@ -0,0 +1,13 @@ +
+
Version 2.0.0 28 Juin 2015
+
+

UMWP Autochanger change de nom ! Il s'appelle maintenant Ultimate Monitor Wallpaper Autochanger. Il a été renommé car il ne dépend désormais plus d'UltraMon et est totalement autonome.

+ +
    +
  • Supprime toute dépendance à UltraMon.
  • +
  • Permet de changer le raccourcis clavier de plusieurs sets en une fois.
  • +
  • Ajouter un bouton "Ouvrir le dossier" dans le menu contextuel.
  • +
  • Permet de masquer l'alerte de fermeture.
  • +
+
+
\ No newline at end of file diff --git a/src/lang/fr_FR/main.qm b/src/lang/fr_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{SI4oAss`+mcq(df2G`54=HR`@SvoW3gf=2~dl374wfYz&c5BcV+-# zbxOj;6hPRfqy=coO|V$5eT#(l-7lIg9ngDBWF@2u_=P7)2M2HO;K} zO0%%XbaLTXD#T_EwU^O;ooepro=ij2WFDU8p*P*Y#&5QaDWF8c(%6V>%a;D{l-Msz z!yigi%(uMw^N8%TP7D>&(;c)H#ii5QWi79wg!Fr@zcTA-cB)zD_EkWljvfydq$7Z} S*ob1Xu}G{pH?FW}jra>*R0$CP diff --git a/src/lang/fr_FR/main.ts b/src/lang/fr_FR/main.ts index 01f447a..96d7aae 100644 --- a/src/lang/fr_FR/main.ts +++ b/src/lang/fr_FR/main.ts @@ -1,6 +1,15 @@ + + ChangelogDialog + + + + Changelog + Suivi de versions + + ConfigDialog @@ -195,84 +204,90 @@ MainWindow - + Quit Quitter - + Import configuration file Importer la configuration - + Export configuration file Exporter la configuration - + About À propos - - + + XML files (*.xml) Fichiers XML (*.xml) - + Add set Ajouter - + Error Erreur - + Invalid settings file Fichier de configuration invalide - + + User guide Guide d'utilisation - + + Changelog + Suivi de versions + + + Paused Mis en pause - + Running Démarré - + Current sets : %1 Sets actuels : %1 - - + + A new version is available : %1 Une nouvelle version est disponible : %1 - + Close and don't show this message again Fermer et ne plus afficher ce message - + %1 is still running %1 est toujours en cours d'éxécution - + If you quit the application now,<br>the wallpaper will not change anymore. Si vous quittez l'application maintenant,<br>le fond d'écran ne changera plus. diff --git a/src/main.cpp b/src/main.cpp index 38f64cc..9b730d2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,12 +12,6 @@ #include "environment.h" -/** - * @brief Global holding app state (main errors) - */ -short UMWP_STATE = 0; - - int main(int argc, char *argv[]) { // ensure only one running instance @@ -85,8 +79,9 @@ int main(int argc, char *argv[]) window.init(); ctrl.checkVersion(); - ctrl.update(); + // fire update with delay + QTimer::singleShot(500, &ctrl, SLOT(update())); // end int ret = app.exec(); diff --git a/src/settings.cpp b/src/settings.cpp index 0033a27..cd2e05f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -22,6 +22,7 @@ Settings::Settings() m_options["default_mode"] = UM::RANDOM; m_options["default_type"] = UM::W_MONITOR; m_options["default_style"] = UM::IM_STRETCH_PROP; + m_options["changelog_shown"] = "0.0.0"; m_hotkeys["refresh"] = 0; m_hotkeys["startpause"] = 0; diff --git a/src/wallpapergenerator.cpp b/src/wallpapergenerator.cpp index 19b79fe..f962611 100644 --- a/src/wallpapergenerator.cpp +++ b/src/wallpapergenerator.cpp @@ -183,10 +183,9 @@ QVector WallpaperGenerator::adaptFiles(const Set* _set, const QVectortype() == UM::W_DESKTOP) { - QRect scrRect = m_enviro->wpSize(-1); - QRect wpRect = getDesktopEnabledRect(); + QRect rect = QRect(QPoint(), getDesktopEnabledRect().size()); - newFiles.append(adaptFileToMonitor(_files.at(0), -1, scrRect, wpRect, _set)); + newFiles.append(adaptFileToMonitor(_files.at(0), -1, rect, rect, _set)); } else { @@ -243,12 +242,7 @@ QString WallpaperGenerator::adaptFileToMonitor(const QString &_file, int _idx, c QLOG_DEBUG() << "Resizing image. Screen:" << _scrRect << "WP:" << _wpRect << "Image:" << srcRect; - // if current image is really close to final size, don't compute it - if (_set->type() == UM::W_DESKTOP && _scrRect.size() != _wpRect.size()) // computation is always required if we are in desktop mode with disabled monitors - { - // continue - } - else if (_set->style() == UM::IM_STRETCH) // stretching is done when generating the final wallpaper + if (_set->style() == UM::IM_STRETCH) // stretching is done when generating the final wallpaper { return _file; } @@ -399,30 +393,35 @@ QString WallpaperGenerator::generateFile(const Set *_set, const QVector { QImage source(_files.at(0)); QRect srcRect(QPoint(), source.size()); - QRect targRect = rect.translated(-offset); + QRect wpRect = getDesktopEnabledRect().translated(-offset); - painter.drawImage(targRect, source, srcRect); + painter.drawImage(wpRect, source, srcRect); } else { for (int i=0, l=m_enviro->nbMonitors(); iwpSize(i).translated(-offset); - if (m_settings->monitor(i).enabled) { QImage source(_files.at(i)); QRect srcRect(QPoint(), source.size()); + QRect wpRect = m_enviro->wpSize(i).translated(-offset); painter.drawImage(wpRect, source, srcRect); } - else - { - QColor color((QRgb) m_settings->monitor(i).color); + } + } - painter.setBrush(QBrush(color)); - painter.drawRect(wpRect); - } + // draw background color of disabled monitors + for (int i=0, l=m_enviro->nbMonitors(); imonitor(i).enabled) + { + QColor color((QRgb) m_settings->monitor(i).color); + QRect wpRect = m_enviro->wpSize(i).translated(-offset); + + painter.setBrush(QBrush(color)); + painter.drawRect(wpRect); } } @@ -492,8 +491,7 @@ QRect WallpaperGenerator::getDesktopEnabledRect() maxY = qMax(maxY, rect.top()+rect.height()); } - QPoint offset = m_enviro->wpSize(-1).topLeft(); - return QRect(minX, minY, maxX-minX, maxY-minY).translated(-offset); + return QRect(minX, minY, maxX-minX, maxY-minY); } /**