diff --git a/ComunicWatcher.pro b/ComunicWatcher.pro index a6139ca..71a005a 100644 --- a/ComunicWatcher.pro +++ b/ComunicWatcher.pro @@ -14,6 +14,7 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ + aboutdialog.cpp \ accounthelper.cpp \ apirequest.cpp \ apiresponse.cpp \ @@ -26,10 +27,10 @@ SOURCES += \ trayicon.cpp \ user.cpp \ userhelper.cpp \ - whoamidialog.cpp \ wsclient.cpp HEADERS += \ + aboutdialog.h \ accounthelper.h \ apirequest.h \ apiresponse.h \ @@ -42,13 +43,12 @@ HEADERS += \ trayicon.h \ user.h \ userhelper.h \ - whoamidialog.h \ wsclient.h FORMS += \ + aboutdialog.ui \ loginsuccessfuldialog.ui \ - loginwindow.ui \ - whoamidialog.ui + loginwindow.ui TRANSLATIONS += \ ComunicWatcher_fr_FR.ts diff --git a/whoamidialog.cpp b/aboutdialog.cpp similarity index 64% rename from whoamidialog.cpp rename to aboutdialog.cpp index 8967c4b..947dba9 100644 --- a/whoamidialog.cpp +++ b/aboutdialog.cpp @@ -1,12 +1,12 @@ #include #include "accounthelper.h" -#include "whoamidialog.h" -#include "ui_whoamidialog.h" +#include "aboutdialog.h" +#include "ui_aboutdialog.h" -WhoAmIDialog::WhoAmIDialog(QWidget *parent) : +AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::WhoAmIDialog) + ui(new Ui::AboutDialog) { ui->setupUi(this); @@ -14,15 +14,15 @@ WhoAmIDialog::WhoAmIDialog(QWidget *parent) : this->onGotUserId(id); }); - connect(&mUserHelper, &UserHelper::onGotUserInfo, this, &WhoAmIDialog::getUserCallback); + connect(&mUserHelper, &UserHelper::onGotUserInfo, this, &AboutDialog::getUserCallback); } -WhoAmIDialog::~WhoAmIDialog() +AboutDialog::~AboutDialog() { delete ui; } -void WhoAmIDialog::getUserCallback(const User &u) +void AboutDialog::getUserCallback(const User &u) { if(!u.isValid()) { QMessageBox::warning(this, tr("Error"), tr("Could not get user information!")); @@ -32,7 +32,7 @@ void WhoAmIDialog::getUserCallback(const User &u) this->ui->user_name->setText(u.fullName()); } -void WhoAmIDialog::onGotUserId(int userID) +void AboutDialog::onGotUserId(int userID) { if(userID < 1) { QMessageBox::warning(this, tr("Error"), tr("Could not get your id!")); diff --git a/whoamidialog.h b/aboutdialog.h similarity index 61% rename from whoamidialog.h rename to aboutdialog.h index 7822d34..46342ea 100644 --- a/whoamidialog.h +++ b/aboutdialog.h @@ -5,16 +5,16 @@ #include namespace Ui { -class WhoAmIDialog; +class AboutDialog; } -class WhoAmIDialog : public QDialog +class AboutDialog : public QDialog { Q_OBJECT public: - explicit WhoAmIDialog(QWidget *parent = nullptr); - ~WhoAmIDialog(); + explicit AboutDialog(QWidget *parent = nullptr); + ~AboutDialog(); private slots: void getUserCallback(const User &u); @@ -23,7 +23,7 @@ private: void onGotUserId(int userID); // Class members - Ui::WhoAmIDialog *ui; + Ui::AboutDialog *ui; UserHelper mUserHelper; }; diff --git a/aboutdialog.ui b/aboutdialog.ui new file mode 100644 index 0000000..311efd3 --- /dev/null +++ b/aboutdialog.ui @@ -0,0 +1,89 @@ + + + AboutDialog + + + + 0 + 0 + 650 + 218 + + + + About ComunicWatcher + + + + :/logo_large.png:/logo_large.png + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">ComunicWatcher</span></p><p>This software is part of Comunic, a free &amp; OpenSource social Network.</p><p>This application was built by Pierre Hubert on 2020.</p><p>It is licensed under the MIT License.</p><p><a href="https://communiquons.org/"><span style=" text-decoration: underline; color:#007af4;">https://communiquons.org/</span></a></p></body></html> + + + + + + + + + User ID + + + + + + + Loading + + + + + + + User name + + + + + + + Loading + + + + + + + + + + 150 + 150 + + + + + + + :/logo_large.png + + + true + + + + + + + + + + + + diff --git a/refreshservice.cpp b/refreshservice.cpp index 9c57bc3..1b86705 100644 --- a/refreshservice.cpp +++ b/refreshservice.cpp @@ -6,7 +6,7 @@ #include "loginwindow.h" #include "refreshservice.h" #include "config.h" -#include "whoamidialog.h" +#include "aboutdialog.h" RefreshService *RefreshService::svc = nullptr; @@ -67,9 +67,9 @@ void RefreshService::openComunic() QDesktopServices::openUrl(QUrl(COMUNIC_URL)); } -void RefreshService::openWhoAmIDialog() +void RefreshService::openAboutDialog() { - WhoAmIDialog().exec(); + AboutDialog().exec(); } void RefreshService::confirmSignOut() @@ -89,7 +89,7 @@ RefreshService::RefreshService() connect(&mWsClient, &WsClient::newNumberNotifs, this, &RefreshService::onNewNeumberUnreadNotifs); connect(&mWsClient, &WsClient::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs); connect(&mTrayIcon, &TrayIcon::askForSignOut, this, &RefreshService::confirmSignOut); - connect(&mTrayIcon, &TrayIcon::whoAmI, this, &RefreshService::openWhoAmIDialog); + connect(&mTrayIcon, &TrayIcon::showAboutDialog, this, &RefreshService::openAboutDialog); connect(&mTrayIcon, &TrayIcon::onOpenComunic, this, &RefreshService::openComunic); } diff --git a/refreshservice.h b/refreshservice.h index c6a8fcb..1bc02ea 100644 --- a/refreshservice.h +++ b/refreshservice.h @@ -28,7 +28,7 @@ private slots: void onNewNeumberUnreadNotifs(int num); void onNewNeumberUnreadConvs(int num); void openComunic(); - void openWhoAmIDialog(); + void openAboutDialog(); void confirmSignOut(); private: diff --git a/trayicon.cpp b/trayicon.cpp index 3d4d3d6..bbe812a 100644 --- a/trayicon.cpp +++ b/trayicon.cpp @@ -22,8 +22,8 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent) QMenu *subMenu = mMenu->addMenu(tr("Other actions")); - QAction *whoAmIAction = subMenu->addAction(tr("Who am I")); - connect(whoAmIAction, &QAction::triggered, this, &TrayIcon::whoAmI); + QAction *aboutAction = subMenu->addAction(tr("About this application")); + connect(aboutAction, &QAction::triggered, this, &TrayIcon::showAboutDialog); QAction *signOutAction = subMenu->addAction(tr("Sign out")); connect(signOutAction, &QAction::triggered, this, &TrayIcon::askForSignOut); diff --git a/trayicon.h b/trayicon.h index 2eace8f..39f00fc 100644 --- a/trayicon.h +++ b/trayicon.h @@ -24,7 +24,7 @@ public slots: signals: void onOpenComunic(); - void whoAmI(); + void showAboutDialog(); void askForSignOut(); private slots: diff --git a/whoamidialog.ui b/whoamidialog.ui deleted file mode 100644 index cdfdf12..0000000 --- a/whoamidialog.ui +++ /dev/null @@ -1,65 +0,0 @@ - - - WhoAmIDialog - - - - 0 - 0 - 400 - 300 - - - - Who am I - - - - :/logo_large.png:/logo_large.png - - - - - 180 - 80 - 160 - 80 - - - - - - - User ID - - - - - - - Loading - - - - - - - User name - - - - - - - Loading - - - - - - - - - - -