Skip to content

Commit

Permalink
Closes #10 finalize standalone version
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Jun 28, 2015
1 parent cb8c96e commit ff260fc
Show file tree
Hide file tree
Showing 16 changed files with 313 additions and 89 deletions.
6 changes: 4 additions & 2 deletions src/UMWP_Autochanger.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/UMWP_Autochanger.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@
<file>lang/fr_FR/flag.png</file>
<file>lang/fr_FR/help.htm</file>
<file>lang/fr_FR/main.qm</file>
<file>lang/fr_FR/changelog.htm</file>
<file>lang/en_GB/changelog.htm</file>
</qresource>
</RCC>
4 changes: 2 additions & 2 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Environment
private:
Settings* m_settings;

QString m_shortcutPath; // environnement variables
QString m_shortcutPath;
QList<QString> m_languages; // languages packaged with UMWPA
QHash<int, QRect> m_wpSizes; // monitors sizes
NewVersion m_newVersion; // struct to hold new version data
Expand Down
68 changes: 68 additions & 0 deletions src/gui/changelogdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef CHANGELOGDIALOG_H
#define CHANGELOGDIALOG_H

#include <QDialog>
#include <QFile>
#include <QTextStream>

#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("<style>");
text.append("* { font-family: \"Arial\", sans-serif; font-size: 12px; }");
text.append("p { font-size:14px; }");
text.append("dt { font-weight:bold; color:#4078C0; font-size:16px; }");
text.append("dd { margin:0 0 2em 0; }");
text.append("</style>");

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
74 changes: 74 additions & 0 deletions src/gui/changelogdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChangelogDialog</class>
<widget class="QDialog" name="ChangelogDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Changelog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="content">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ChangelogDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ChangelogDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
67 changes: 47 additions & 20 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "previewdialog.h"
#include "newversiondialog.h"
#include "setcontextmenu.h"
#include "changelogdialog.h"


/**
Expand Down Expand Up @@ -90,6 +91,11 @@ void MainWindow::init()
else
{
show();

if (QString::fromAscii(APP_VERSION).compare(m_settings->get("changelog_shown").toString()) > 0)
{
openChangelogDialog();
}
}

defineHotkeys();
Expand Down Expand Up @@ -305,51 +311,72 @@ 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("<style>");
mainText.append("dt { font-weight:bold; }");
mainText.append("dd { margin-bottom:1em; margin-left:1em; }");
mainText.append("</style>");
QString text;
text.append("<style>");
text.append("dt { font-weight:bold; }");
text.append("dd { margin:0 0 1em 1em; }");
text.append("</style>");

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));
}

/**
* @brief Open about dialog
*/
void MainWindow::openAboutDialog()
{
QString mainText = "<h3>" + QString::fromAscii(APP_NAME) + " " + QString::fromAscii(APP_VERSION) + "</h3>";
mainText+= "Created by Damien \"Mistic\" Sorel.<br>";
mainText+= "&copy; 2013-2015 <a href=\"http://strangeplanet.fr\">StrangePlanet.fr</a><br>";
mainText+= "Licenced under <a href=\"http://www.gnu.org/licenses/gpl-3.0.txt\">GNU General Public License Version 3</a>";
QString text = "<h3>" + QString::fromAscii(APP_NAME) + " " + QString::fromAscii(APP_VERSION) + "</h3>";
text+= "Created by Damien \"Mistic\" Sorel.<br>";
text+= "&copy; 2013-2015 <a href=\"http://strangeplanet.fr\">StrangePlanet.fr</a><br>";
text+= "Licenced under <a href=\"http://www.gnu.org/licenses/gpl-3.0.txt\">GNU General Public License Version 3</a>";

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();
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public slots:
void openScreensDialog();
void openHelpDialog();
void openAboutDialog();
void openChangelogDialog();
void openPreviewDialog();
void openExportDialog();
void openImportDialog();
Expand Down
13 changes: 13 additions & 0 deletions src/lang/en_GB/changelog.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<dl>
<dt>Version 2.0.0 <small>June 28th 2015</small></dt>
<dd>
<p><b>UMWP Autochanger has a new name !</b> Now it is <b style="color:red;">Ultimate Monitor Wallpaper Autochanger</b>. It was renamed because it does not depend on UltraMon anymore and is completely autonomous.</p>

<ul>
<li>Delete all dependencies to UltraMon.</li>
<li>Allows to edit keyboard hotkeys of multiple sets in one time.</li>
<li>Adds a "Open directory" button in the context menu.</li>
<li>Allows to hide the closing warning.</li>
</ul>
</dd>
</dl>
Loading

0 comments on commit ff260fc

Please sign in to comment.