feat: add styles

This commit is contained in:
semenov
2024-09-30 12:27:28 +03:00
parent 7493f40f98
commit e342b3dff4
11 changed files with 142 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-09-27T11:32:58. --> <!-- Written by QtCreator 4.11.1, 2024-09-30T12:16:10. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@@ -67,7 +67,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
@@ -299,7 +299,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/Projects/QT/GUIProj/RRJClient/Deploy</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/Projects/QT/GUIProj/RRJClient/RRJClient</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>

View File

@@ -2,12 +2,17 @@
#include "updatenotifywidget.h" #include "updatenotifywidget.h"
#include <QApplication> #include <QApplication>
#include <QFontDatabase>
#include <QTranslator> #include <QTranslator>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
a.setWindowIcon(QIcon("./plane.png"));
QFile file(":/style.css");
file.open(QFile::ReadOnly);
a.setStyleSheet(file.readAll());
a.setWindowIcon(QIcon(":/resource/plane.png"));
MainWindow w; MainWindow w;
UpdateNotifyWidget *notifyWidget = new UpdateNotifyWidget; UpdateNotifyWidget *notifyWidget = new UpdateNotifyWidget;
w.bindNotifyWidget(notifyWidget); w.bindNotifyWidget(notifyWidget);

View File

@@ -2,6 +2,9 @@
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "updatenotifywidget.h" #include "updatenotifywidget.h"
#include <QFontDatabase>
#include <QPaintEvent>
#include <QPainter>
#include <QTimer> #include <QTimer>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@@ -9,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
painting();
initialize(); initialize();
} }
@@ -292,6 +296,7 @@ void MainWindow::debugLog(QString message)
ui->debugText->append(message); ui->debugText->append(message);
} }
void MainWindow::callUpdateList() void MainWindow::callUpdateList()
{ {
updateController->calculateStreamingHash(); updateController->calculateStreamingHash();
@@ -389,6 +394,20 @@ void MainWindow::checkUpdate()
ui->inlineTextDebug->setText(tr("Проверка обновлений...")); ui->inlineTextDebug->setText(tr("Проверка обновлений..."));
} }
void MainWindow::painting()
{
// QPixmap background(":/resource/SSJ-100.jpg");
// QColor color(77,77,77,255);
// background.scaled(this->size(),Qt::IgnoreAspectRatio);
// QPalette palette;
// palette.setBrush(QPalette::Window,background);
// palette.dark();
// this->setPalette(palette);
QFontDatabase::addApplicationFont(":/Fonts/Kanit Cyrillic.ttf");
}
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
connectionThread->quit(); connectionThread->quit();

View File

@@ -50,7 +50,6 @@ signals:
void sigSendAutorization(); void sigSendAutorization();
bool sigGetConnected(); bool sigGetConnected();
private slots: private slots:
void on_loginButton_clicked(); void on_loginButton_clicked();
@@ -91,6 +90,7 @@ private:
int filesLoaded; int filesLoaded;
void debugLog(QString message); void debugLog(QString message);
void painting();
void initialize(); void initialize();
void updateProgress(); void updateProgress();
void loadComplete(); void loadComplete();

View File

@@ -171,6 +171,11 @@
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="font">
<font>
<family>Helvetica Cyr Upright</family>
</font>
</property>
<property name="text"> <property name="text">
<string>Обновить</string> <string>Обновить</string>
</property> </property>
@@ -196,57 +201,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>171</width>
<height>30</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="languageTite">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Язык</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>RUS</string>
</property>
</item>
<item>
<property name="text">
<string>ENG</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="mainFrame"> <widget class="QFrame" name="mainFrame">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@@ -367,6 +321,9 @@
<property name="text"> <property name="text">
<string>Войти</string> <string>Войти</string>
</property> </property>
<property name="isGreen" stdset="0">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -438,6 +395,9 @@
<property name="text"> <property name="text">
<string>Сохранить</string> <string>Сохранить</string>
</property> </property>
<property name="blueButton" stdset="0">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -554,10 +514,76 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QWidget" name="LanguageWidget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>201</width>
<height>30</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="languageTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Calibri</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="text">
<string>Язык/Language</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Helvetica Cyr Upright-Bold</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item>
<property name="text">
<string>RUS</string>
</property>
</item>
<item>
<property name="text">
<string>ENG</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<zorder>mainFrame</zorder> <zorder>mainFrame</zorder>
<zorder>layoutWidget</zorder> <zorder>layoutWidget</zorder>
<zorder>widget</zorder>
</widget> </widget>
</widget> </widget>
<resources/> <resources/>

Binary file not shown.

Binary file not shown.

BIN
resource/SSJ-100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,5 +1,10 @@
<RCC> <RCC>
<qresource prefix="/new/resoures"> <qresource prefix="/new/resoures"/>
<file>plane.png</file> <qresource prefix="/">
<file>resource/plane.png</file>
<file>style.css</file>
<file>resource/SSJ-100.png</file>
<file>resource/Fonts/Kanit Cyrillic.ttf</file>
<file>resource/Fonts/LiberationSans-Regular.ttf</file>
</qresource> </qresource>
</RCC> </RCC>

28
style.css Normal file
View File

@@ -0,0 +1,28 @@
QMainWindow
{
background-image: url(:/resource/SSJ-100.png);
background-position: center;
}
QPushButton
{
background-color: rgb(203,228,255);
border-style: outset;
border-radius: 3px;
font-family: "Helvetica Cyr Upright";
color: rgb(45,84,130);
}
QLineEdit
{
border-style: outset;
border-radius: 3px;
}
#languageTitle
{
font-family: "Calibri";
color: white;
}