mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-11-24 22:39:25 +00:00
Turn Who am I dialog into About application dialog
This commit is contained in:
parent
709ed4b7fc
commit
15b4a7dcc6
@ -14,6 +14,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
aboutdialog.cpp \
|
||||||
accounthelper.cpp \
|
accounthelper.cpp \
|
||||||
apirequest.cpp \
|
apirequest.cpp \
|
||||||
apiresponse.cpp \
|
apiresponse.cpp \
|
||||||
@ -26,10 +27,10 @@ SOURCES += \
|
|||||||
trayicon.cpp \
|
trayicon.cpp \
|
||||||
user.cpp \
|
user.cpp \
|
||||||
userhelper.cpp \
|
userhelper.cpp \
|
||||||
whoamidialog.cpp \
|
|
||||||
wsclient.cpp
|
wsclient.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
aboutdialog.h \
|
||||||
accounthelper.h \
|
accounthelper.h \
|
||||||
apirequest.h \
|
apirequest.h \
|
||||||
apiresponse.h \
|
apiresponse.h \
|
||||||
@ -42,13 +43,12 @@ HEADERS += \
|
|||||||
trayicon.h \
|
trayicon.h \
|
||||||
user.h \
|
user.h \
|
||||||
userhelper.h \
|
userhelper.h \
|
||||||
whoamidialog.h \
|
|
||||||
wsclient.h
|
wsclient.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
aboutdialog.ui \
|
||||||
loginsuccessfuldialog.ui \
|
loginsuccessfuldialog.ui \
|
||||||
loginwindow.ui \
|
loginwindow.ui
|
||||||
whoamidialog.ui
|
|
||||||
|
|
||||||
TRANSLATIONS += \
|
TRANSLATIONS += \
|
||||||
ComunicWatcher_fr_FR.ts
|
ComunicWatcher_fr_FR.ts
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "accounthelper.h"
|
#include "accounthelper.h"
|
||||||
#include "whoamidialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "ui_whoamidialog.h"
|
#include "ui_aboutdialog.h"
|
||||||
|
|
||||||
WhoAmIDialog::WhoAmIDialog(QWidget *parent) :
|
AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::WhoAmIDialog)
|
ui(new Ui::AboutDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -14,15 +14,15 @@ WhoAmIDialog::WhoAmIDialog(QWidget *parent) :
|
|||||||
this->onGotUserId(id);
|
this->onGotUserId(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&mUserHelper, &UserHelper::onGotUserInfo, this, &WhoAmIDialog::getUserCallback);
|
connect(&mUserHelper, &UserHelper::onGotUserInfo, this, &AboutDialog::getUserCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
WhoAmIDialog::~WhoAmIDialog()
|
AboutDialog::~AboutDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WhoAmIDialog::getUserCallback(const User &u)
|
void AboutDialog::getUserCallback(const User &u)
|
||||||
{
|
{
|
||||||
if(!u.isValid()) {
|
if(!u.isValid()) {
|
||||||
QMessageBox::warning(this, tr("Error"), tr("Could not get user information!"));
|
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());
|
this->ui->user_name->setText(u.fullName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WhoAmIDialog::onGotUserId(int userID)
|
void AboutDialog::onGotUserId(int userID)
|
||||||
{
|
{
|
||||||
if(userID < 1) {
|
if(userID < 1) {
|
||||||
QMessageBox::warning(this, tr("Error"), tr("Could not get your id!"));
|
QMessageBox::warning(this, tr("Error"), tr("Could not get your id!"));
|
@ -5,16 +5,16 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class WhoAmIDialog;
|
class AboutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WhoAmIDialog : public QDialog
|
class AboutDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WhoAmIDialog(QWidget *parent = nullptr);
|
explicit AboutDialog(QWidget *parent = nullptr);
|
||||||
~WhoAmIDialog();
|
~AboutDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void getUserCallback(const User &u);
|
void getUserCallback(const User &u);
|
||||||
@ -23,7 +23,7 @@ private:
|
|||||||
void onGotUserId(int userID);
|
void onGotUserId(int userID);
|
||||||
|
|
||||||
// Class members
|
// Class members
|
||||||
Ui::WhoAmIDialog *ui;
|
Ui::AboutDialog *ui;
|
||||||
UserHelper mUserHelper;
|
UserHelper mUserHelper;
|
||||||
};
|
};
|
||||||
|
|
89
aboutdialog.ui
Normal file
89
aboutdialog.ui
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AboutDialog</class>
|
||||||
|
<widget class="QDialog" name="AboutDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>650</width>
|
||||||
|
<height>218</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>About ComunicWatcher</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="ressources.qrc">
|
||||||
|
<normaloff>:/logo_large.png</normaloff>:/logo_large.png</iconset>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string><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></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>User ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="user_id">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>User name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="user_name">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="ressources.qrc">:/logo_large.png</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="ressources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -6,7 +6,7 @@
|
|||||||
#include "loginwindow.h"
|
#include "loginwindow.h"
|
||||||
#include "refreshservice.h"
|
#include "refreshservice.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "whoamidialog.h"
|
#include "aboutdialog.h"
|
||||||
|
|
||||||
RefreshService *RefreshService::svc = nullptr;
|
RefreshService *RefreshService::svc = nullptr;
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ void RefreshService::openComunic()
|
|||||||
QDesktopServices::openUrl(QUrl(COMUNIC_URL));
|
QDesktopServices::openUrl(QUrl(COMUNIC_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshService::openWhoAmIDialog()
|
void RefreshService::openAboutDialog()
|
||||||
{
|
{
|
||||||
WhoAmIDialog().exec();
|
AboutDialog().exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshService::confirmSignOut()
|
void RefreshService::confirmSignOut()
|
||||||
@ -89,7 +89,7 @@ RefreshService::RefreshService()
|
|||||||
connect(&mWsClient, &WsClient::newNumberNotifs, this, &RefreshService::onNewNeumberUnreadNotifs);
|
connect(&mWsClient, &WsClient::newNumberNotifs, this, &RefreshService::onNewNeumberUnreadNotifs);
|
||||||
connect(&mWsClient, &WsClient::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs);
|
connect(&mWsClient, &WsClient::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs);
|
||||||
connect(&mTrayIcon, &TrayIcon::askForSignOut, this, &RefreshService::confirmSignOut);
|
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);
|
connect(&mTrayIcon, &TrayIcon::onOpenComunic, this, &RefreshService::openComunic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ private slots:
|
|||||||
void onNewNeumberUnreadNotifs(int num);
|
void onNewNeumberUnreadNotifs(int num);
|
||||||
void onNewNeumberUnreadConvs(int num);
|
void onNewNeumberUnreadConvs(int num);
|
||||||
void openComunic();
|
void openComunic();
|
||||||
void openWhoAmIDialog();
|
void openAboutDialog();
|
||||||
void confirmSignOut();
|
void confirmSignOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -22,8 +22,8 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
QMenu *subMenu = mMenu->addMenu(tr("Other actions"));
|
QMenu *subMenu = mMenu->addMenu(tr("Other actions"));
|
||||||
|
|
||||||
QAction *whoAmIAction = subMenu->addAction(tr("Who am I"));
|
QAction *aboutAction = subMenu->addAction(tr("About this application"));
|
||||||
connect(whoAmIAction, &QAction::triggered, this, &TrayIcon::whoAmI);
|
connect(aboutAction, &QAction::triggered, this, &TrayIcon::showAboutDialog);
|
||||||
|
|
||||||
QAction *signOutAction = subMenu->addAction(tr("Sign out"));
|
QAction *signOutAction = subMenu->addAction(tr("Sign out"));
|
||||||
connect(signOutAction, &QAction::triggered, this, &TrayIcon::askForSignOut);
|
connect(signOutAction, &QAction::triggered, this, &TrayIcon::askForSignOut);
|
||||||
|
@ -24,7 +24,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onOpenComunic();
|
void onOpenComunic();
|
||||||
void whoAmI();
|
void showAboutDialog();
|
||||||
void askForSignOut();
|
void askForSignOut();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>WhoAmIDialog</class>
|
|
||||||
<widget class="QDialog" name="WhoAmIDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>400</width>
|
|
||||||
<height>300</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Who am I</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="ressources.qrc">
|
|
||||||
<normaloff>:/logo_large.png</normaloff>:/logo_large.png</iconset>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="gridLayoutWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>180</x>
|
|
||||||
<y>80</y>
|
|
||||||
<width>160</width>
|
|
||||||
<height>80</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>User ID</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="user_id">
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>User name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="user_name">
|
|
||||||
<property name="text">
|
|
||||||
<string>Loading</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources>
|
|
||||||
<include location="ressources.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Loading…
Reference in New Issue
Block a user