[gui] Add font usage

This commit is contained in:
hawkeyexp 2018-06-28 14:58:35 +02:00
parent ff89fe6f11
commit 7875c511b5
4 changed files with 87 additions and 22 deletions

BIN
assets/Roboto-Regular.ttf Normal file

Binary file not shown.

View File

@ -30,5 +30,6 @@
<file>bg_rearcam.png</file> <file>bg_rearcam.png</file>
<file>rearcam-hot.png</file> <file>rearcam-hot.png</file>
<file>recordactive-hot.png</file> <file>recordactive-hot.png</file>
<file>Roboto-Regular.ttf</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -25,6 +25,8 @@
#include <QDateTime> #include <QDateTime>
#include <QMessageBox> #include <QMessageBox>
#include <QTextStream> #include <QTextStream>
#include <QFontDatabase>
#include <QFont>
namespace f1x namespace f1x
{ {
@ -50,6 +52,12 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
QLabel { color: #ffffff; font-weight: bold;} \ QLabel { color: #ffffff; font-weight: bold;} \
"); ");
// Set default font and size
int id = QFontDatabase::addApplicationFont(":/Roboto-Regular.ttf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
QFont _font(family, 11);
qApp->setFont(_font);
// inits by files // inits by files
QFileInfo wallpaperDayFile("wallpaper.png"); QFileInfo wallpaperDayFile("wallpaper.png");
this->wallpaperDayFileExists = wallpaperDayFile.exists(); this->wallpaperDayFileExists = wallpaperDayFile.exists();
@ -179,7 +187,6 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->pushButtonSave->hide(); ui_->pushButtonSave->hide();
ui_->pushButtonRearcam->hide(); ui_->pushButtonRearcam->hide();
ui_->pushButtonRearcamBack->hide(); ui_->pushButtonRearcamBack->hide();
ui_->rearcamBG->hide();
if (!this->cameraButtonForce) { if (!this->cameraButtonForce) {
ui_->pushButtonCameraShow->hide(); ui_->pushButtonCameraShow->hide();

View File

@ -30,9 +30,23 @@
<x>668</x> <x>668</x>
<y>12</y> <y>12</y>
<width>120</width> <width>120</width>
<height>20</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>120</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
@ -41,39 +55,84 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>578</x> <x>578</x>
<y>408</y> <y>368</y>
<width>210</width> <width>210</width>
<height>20</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>210</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="versionString"> <widget class="QLabel" name="versionString">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>578</x> <x>578</x>
<y>428</y> <y>412</y>
<width>210</width> <width>210</width>
<height>20</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>210</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>8</pointsize>
<weight>75</weight>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="dateString"> <widget class="QLabel" name="dateString">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>578</x> <x>578</x>
<y>448</y> <y>446</y>
<width>210</width> <width>210</width>
<height>20</height> <height>24</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>210</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>8</pointsize>
<weight>75</weight>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButtonSettings"> <widget class="QPushButton" name="pushButtonSettings">
@ -475,6 +534,9 @@
</property> </property>
</widget> </widget>
<widget class="QLabel" name="exitBG"> <widget class="QLabel" name="exitBG">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>284</x> <x>284</x>
@ -553,17 +615,10 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="rearcamBG">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButtonRearcamBack"> <widget class="QPushButton" name="pushButtonRearcamBack">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -595,6 +650,8 @@
<tabstop>pushButtonBrightness</tabstop> <tabstop>pushButtonBrightness</tabstop>
<tabstop>pushButtonExit</tabstop> <tabstop>pushButtonExit</tabstop>
</tabstops> </tabstops>
<resources/> <resources>
<include location="../../../assets/resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>