diff --git a/CMakeLists.txt b/CMakeLists.txt index d8509f2ed..c13fe4d7d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -466,15 +466,19 @@ if(WIN32 OR OS2) set(UPDATER_SOURCES # QTSINGLEAPPLICATION sources. src/qtsingleapplication/qtlocalpeer.cpp - src/qtsingleapplication/qtsinglecoreapplication.cpp + src/qtsingleapplication/qtsingleapplication.cpp src/updater/main.cpp + + src/updater/formupdater.cpp ) set(UPDATER_HEADERS # QTSINGLEAPPLICATION headers. src/qtsingleapplication/qtlocalpeer.h - src/qtsingleapplication/qtsinglecoreapplication.h + src/qtsingleapplication/qtsingleapplication.h + + src/updater/formupdater.h ) endif(WIN32 OR OS2) @@ -523,17 +527,22 @@ if(WIN32 OR OS2) message(STATUS "[${APP_LOW_NAME}] RSS Guard updater will be compiled.") if(${USE_QT_5}) - add_executable(${UPDATER_EXE_NAME} + add_executable(${UPDATER_EXE_NAME} WIN32 ${UPDATER_SOURCES} ) + if(WIN32) + target_link_libraries(${UPDATER_EXE_NAME} Qt5::WinMain) + endif(WIN32) + # Use modules from Qt. qt5_use_modules(rssguard_updater Core + Widgets Network ) else(${USE_QT_5}) - add_executable(${UPDATER_EXE_NAME} + add_executable(${UPDATER_EXE_NAME} WIN32 ${UPDATER_SOURCES} ${UPDATER_MOC} ) @@ -541,7 +550,9 @@ if(WIN32 OR OS2) # Link modules from Qt. target_link_libraries(${UPDATER_EXE_NAME} ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} + ${QT_QTMAIN_LIBRARY} ) endif(${USE_QT_5}) endif(WIN32 OR OS2) diff --git a/src/updater/formupdater.cpp b/src/updater/formupdater.cpp new file mode 100644 index 000000000..0a66831f4 --- /dev/null +++ b/src/updater/formupdater.cpp @@ -0,0 +1,23 @@ +#include "updater/formupdater.h" + +#include "definitions/definitions.h" + +#include +#include +#include + + +FormUpdater::FormUpdater(QWidget *parent) : QMainWindow(parent) { + setWindowTitle("RSS Guard updater"); + setWindowIcon(QIcon(APP_ICON_PATH)); + + moveToCenterAndResize(); +} + +FormUpdater::~FormUpdater() { +} + +void FormUpdater::moveToCenterAndResize() { + resize(500, 400); + move(qApp->desktop()->screenGeometry().center() - rect().center()); +} diff --git a/src/updater/formupdater.h b/src/updater/formupdater.h new file mode 100644 index 000000000..0580034cd --- /dev/null +++ b/src/updater/formupdater.h @@ -0,0 +1,20 @@ +#ifndef FORMUPDATER_H +#define FORMUPDATER_H + +#include + + +class FormUpdater : public QMainWindow { + Q_OBJECT + + public: + // Constructors and destructors. + explicit FormUpdater(QWidget *parent = 0); + virtual ~FormUpdater(); + + private: + void moveToCenterAndResize(); + +}; + +#endif // FORMUPDATER_H diff --git a/src/updater/main.cpp b/src/updater/main.cpp index 300054e77..afb00e82f 100644 --- a/src/updater/main.cpp +++ b/src/updater/main.cpp @@ -16,7 +16,8 @@ // along with RSS Guard. If not, see . #include "definitions/definitions.h" -#include "qtsingleapplication/qtsinglecoreapplication.h" +#include "qtsingleapplication/qtsingleapplication.h" +#include "updater/formupdater.h" #include #include @@ -28,7 +29,7 @@ #include #include - +/* bool removeDir(const QString & dirName, const QStringList &exception_file_list = QStringList(), const QStringList &exception_folder_list = QStringList()) { @@ -85,7 +86,7 @@ bool copyPath(QString src, QString dst) { } return true; -} +}*/ // Main entry point to "rssguard_updater.exe". // It expects 4 ARGUMENTS: @@ -96,8 +97,15 @@ bool copyPath(QString src, QString dst) { // 4) - path to update file (stored in TEMP folder). int main(int argc, char *argv[]) { // Instantiate base application object. - QtSingleCoreApplication application(APP_LOW_NAME, argc, argv); + QtSingleApplication application(APP_LOW_NAME, argc, argv); + FormUpdater main_form; + + main_form.show(); + + return application.exec(); + + /* qDebug("\n===== RSS Guard updater ====\n"); if (argc != 5) { @@ -273,6 +281,6 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - return EXIT_SUCCESS; + return EXIT_SUCCESS;*/ }