-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor refactoring, firebase test integration
- Loading branch information
Showing
78 changed files
with
1,946 additions
and
2,287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "databasehandler.h" | ||
#include <QEventLoop> | ||
#include <QDebug> | ||
#include <QNetworkRequest> | ||
|
||
DatabaseHandler::DatabaseHandler(QObject *parent) | ||
: QObject{parent} | ||
{ | ||
networkManager = new QNetworkAccessManager(this); | ||
} | ||
|
||
DatabaseHandler::~DatabaseHandler() | ||
{ | ||
networkManager->deleteLater(); | ||
} | ||
|
||
void DatabaseHandler::replyNetworkReadyRead() | ||
{ | ||
qDebug() << QString(networkReply->readAll()); | ||
} | ||
|
||
QByteArray DatabaseHandler::getReply(const QString &url) | ||
{ | ||
QNetworkReply *reply = networkManager->get(QNetworkRequest(QUrl(url))); | ||
QEventLoop loop; | ||
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); | ||
loop.exec(); | ||
QByteArray data = reply->readAll(); | ||
reply->deleteLater(); | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef DATABASEHANDLER_H | ||
#define DATABASEHANDLER_H | ||
|
||
#include <QObject> | ||
#include <QNetworkAccessManager> | ||
#include <QNetworkReply> | ||
|
||
class DatabaseHandler : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DatabaseHandler(QObject *parent = nullptr); | ||
~DatabaseHandler(); | ||
|
||
signals: | ||
|
||
private: | ||
QNetworkAccessManager *networkManager; | ||
QNetworkReply *networkReply; | ||
|
||
public slots: | ||
void replyNetworkReadyRead(); | ||
QByteArray getReply(const QString &url); | ||
}; | ||
|
||
#endif // DATABASEHANDLER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "aboutappwindow.h" | ||
#include "ui_aboutappwindow.h" | ||
|
||
#include <QFile> | ||
#include <QPalette> | ||
|
||
AboutAppWindow::AboutAppWindow(QWidget *parent) | ||
: QWidget(parent) | ||
, ui(new Ui::aboutApp) | ||
{ | ||
ui->setupUi(this); | ||
setWindowTitle("Про Gradify"); | ||
setFixedSize(width(), height()); | ||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); | ||
} | ||
|
||
AboutAppWindow::~AboutAppWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void AboutAppWindow::changeEvent(QEvent *event) | ||
{ | ||
QWidget::changeEvent(event); | ||
if (event->type() == QEvent::ActivationChange) { | ||
if (not isActiveWindow()) { | ||
close(); | ||
} | ||
} | ||
} | ||
|
||
void AboutAppWindow::setBlackUI() | ||
{ | ||
QFile file(":/styles/black/aboutApp/aboutApp.qss"); | ||
file.open(QFile::ReadOnly); | ||
setStyleSheet(QLatin1String(file.readAll())); | ||
file.close(); | ||
} | ||
|
||
void AboutAppWindow::setWhiteUI() | ||
{ | ||
QFile file(":/styles/white/aboutApp/aboutApp.qss"); | ||
file.open(QFile::ReadOnly); | ||
setStyleSheet(QLatin1String(file.readAll())); | ||
file.close(); | ||
} | ||
|
||
void AboutAppWindow::setSystemUI() | ||
{ | ||
QPalette basePalette; | ||
QColor baseColor = basePalette.base().color(); | ||
QColor newBase = QColor::fromRgbF(1 - baseColor.redF(), | ||
1 - baseColor.greenF(), | ||
1 - baseColor.blueF()); | ||
|
||
if (newBase.name() == "#000000") { | ||
setWhiteUI(); | ||
} else { | ||
setBlackUI(); | ||
} | ||
} | ||
|
||
void AboutAppWindow::setTheme(const QString &style) | ||
{ | ||
if (style == "black") { | ||
setBlackUI(); | ||
} else if (style == "white") { | ||
setWhiteUI(); | ||
} else { | ||
setSystemUI(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.