💄 Added some icons, added some initialisation functions

main
Isabell Pflug 1 year ago
parent 3fada1ccd8
commit 8d184379d7

@ -22,3 +22,6 @@ FORMS += \
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \
thinkpink.qrc

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -3,11 +3,39 @@
extern std::unique_ptr<QSettings> settings; extern std::unique_ptr<QSettings> settings;
void MainWindow::initialiseAbout() {
QCoreApplication::setOrganizationName("Isabell Elise");
QCoreApplication::setOrganizationDomain("https://liberapay.com/isabell-elise/");
QCoreApplication::setApplicationName("ThinkPink");
}
void MainWindow::initialiseGameGrid() {
int n_rows = settings->value("size/rows", 9).toInt();
int n_columns = settings->value("size/columns", 9).toInt();
std::cout << "Number of rows: " << n_rows << std::endl;
std::cout << "Number of columns: " << n_columns << std::endl;
}
void MainWindow::initialiseWindow() {
MainWindow::setWindowTitle("ThinkPink | SameGame in PINK by Isifluff");
MainWindow::setWindowIcon(QIcon(":/icons/ThinkPink.png"));
}
void MainWindow::initialiseMenuBar() {
ui->menuPlay->addAction(QIcon(":/icons/game.png"), "New Game");
ui->menuPlay->addSeparator();
//ui->menuPlay->addAction("Brag");
}
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
initialiseAbout();
initialiseGameGrid();
initialiseWindow();
initialiseMenuBar();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()

@ -1,6 +1,7 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <iostream>
#include <QMainWindow> #include <QMainWindow>
#include <QSettings> #include <QSettings>
@ -15,6 +16,10 @@ class MainWindow : public QMainWindow
public: public:
MainWindow(QWidget *parent = nullptr); MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
void initialiseAbout();
void initialiseGameGrid();
void initialiseWindow();
void initialiseMenuBar();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

@ -13,8 +13,109 @@
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"/> <widget class="QWidget" name="centralwidget">
<widget class="QMenuBar" name="menubar"> <widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>801</width>
<height>441</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<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="QLabel" name="labelScore">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Score&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="lcdScore">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
<property name="digitCount">
<number>5</number>
</property>
<property name="mode">
<enum>QLCDNumber::Dec</enum>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gameGridLayout"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -23,14 +124,13 @@
<height>26</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuThinkPink"> <widget class="QMenu" name="menuPlay">
<property name="title"> <property name="title">
<string>ThinkPink</string> <string>Play</string>
</property> </property>
</widget> </widget>
<addaction name="menuThinkPink"/> <addaction name="menuPlay"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/game.png</file>
<file>icons/ThinkPink.png</file>
</qresource>
</RCC>
Loading…
Cancel
Save