Add successful login window

This commit is contained in:
Pierre HUBERT 2020-06-13 10:42:14 +02:00
parent 7244068ad5
commit a0ce9f2d7f
6 changed files with 176 additions and 10 deletions

View File

@ -17,6 +17,7 @@ SOURCES += \
accounthelper.cpp \
apirequest.cpp \
apiresponse.cpp \
loginsuccessfuldialog.cpp \
main.cpp \
loginwindow.cpp \
refreshservice.cpp
@ -26,10 +27,12 @@ HEADERS += \
apirequest.h \
apiresponse.h \
config.h \
loginsuccessfuldialog.h \
loginwindow.h \
refreshservice.h
FORMS += \
loginsuccessfuldialog.ui \
loginwindow.ui
TRANSLATIONS += \

15
loginsuccessfuldialog.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "loginsuccessfuldialog.h"
#include "ui_loginsuccessfuldialog.h"
LoginSuccessfulDialog::LoginSuccessfulDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::LoginSuccessfulDialog)
{
ui->setupUi(this);
setWindowFlag(Qt::FramelessWindowHint);
}
LoginSuccessfulDialog::~LoginSuccessfulDialog()
{
delete ui;
}

20
loginsuccessfuldialog.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include <QDialog>
namespace Ui {
class LoginSuccessfulDialog;
}
class LoginSuccessfulDialog : public QDialog
{
Q_OBJECT
public:
explicit LoginSuccessfulDialog(QWidget *parent = nullptr);
~LoginSuccessfulDialog();
private:
Ui::LoginSuccessfulDialog *ui;
};

123
loginsuccessfuldialog.ui Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LoginSuccessfulDialog</class>
<widget class="QDialog" name="LoginSuccessfulDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>134</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Login successful !</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="closeButton">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/ic_close.png</normaloff>:/ic_close.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>This application will now be visible from the system tray and will send you notifications when there is new activity on Comunic....</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<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::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="ressources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LoginSuccessfulDialog</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>LoginSuccessfulDialog</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>

View File

@ -1,5 +1,6 @@
#include "accounthelper.h"
#include "apirequest.h"
#include "loginsuccessfuldialog.h"
#include "loginwindow.h"
#include "refreshservice.h"
#include "ui_loginwindow.h"
@ -68,8 +69,10 @@ void LoginWindow::onResponse(LoginResult res)
switch(res) {
case SUCCESS:
QMessageBox::information(this, "ok", "success");
LoginSuccessfulDialog(this).exec();
RefreshService::startService();
close();
deleteLater();
return;

View File

@ -29,6 +29,16 @@
color: white;
}
QToolButton {
background-color: transparent;
border: 0px;
padding: 2px;
}
QToolButton:hover:!pressed {
background-color: rgba(255, 255, 255, 158)
}
QLineEdit {
margin-bottom: 15px;
border: 1px solid grey;
@ -87,15 +97,7 @@ QPushButton:pressed {
<item>
<widget class="QToolButton" name="closeButton">
<property name="styleSheet">
<string notr="true">QToolButton {
background-color: transparent;
border: 0px;
padding: 2px;
}
QToolButton:hover:!pressed {
background-color: rgba(255, 255, 255, 158)
}</string>
<string notr="true"/>
</property>
<property name="text">
<string>...</string>