mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-12-23 20:18:55 +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
|
||||
|
||||
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
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#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!"));
|
@ -5,16 +5,16 @@
|
||||
#include <QDialog>
|
||||
|
||||
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;
|
||||
};
|
||||
|
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 "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);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ private slots:
|
||||
void onNewNeumberUnreadNotifs(int num);
|
||||
void onNewNeumberUnreadConvs(int num);
|
||||
void openComunic();
|
||||
void openWhoAmIDialog();
|
||||
void openAboutDialog();
|
||||
void confirmSignOut();
|
||||
|
||||
private:
|
||||
|
@ -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);
|
||||
|
@ -24,7 +24,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void onOpenComunic();
|
||||
void whoAmI();
|
||||
void showAboutDialog();
|
||||
void askForSignOut();
|
||||
|
||||
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