Skip to content

Commit a8e7715

Browse files
authored
Add files via upload
1 parent 793b84b commit a8e7715

File tree

10 files changed

+559
-0
lines changed

10 files changed

+559
-0
lines changed

about.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <QJsonObject>
2+
#include <QJsonDocument>
3+
#include <QFile>
4+
#include <QString>
5+
6+
#include "about.h"
7+
#include "ui_about.h"
8+
9+
10+
QJsonObject config;
11+
12+
void readConfig() {
13+
QString homeDirectory = getenv("HOME");
14+
QFile file;
15+
QString data;
16+
17+
file.setFileName(homeDirectory + "/.config/plainDE/config.json");
18+
file.open(QIODevice::ReadOnly | QIODevice::Text);
19+
data = file.readAll();
20+
file.close();
21+
config = QJsonDocument::fromJson(data.toUtf8()).object();
22+
}
23+
24+
25+
about::about(QWidget *parent)
26+
: QWidget(parent)
27+
, ui(new Ui::about)
28+
{
29+
ui->setupUi(this);
30+
31+
this->setWindowTitle("About plainDE");
32+
33+
readConfig();
34+
35+
QString stylesheetPath;
36+
if (config["theme"].toString() == "light") {
37+
stylesheetPath = ":/assets/light.qss";
38+
}
39+
else {
40+
stylesheetPath = ":/assets/dark.qss";
41+
}
42+
QFile stylesheetReader(stylesheetPath);
43+
stylesheetReader.open(QIODevice::ReadOnly | QIODevice::Text);
44+
QTextStream styleSheet(&stylesheetReader);
45+
this->setStyleSheet(styleSheet.readAll());
46+
47+
48+
}
49+
50+
about::~about()
51+
{
52+
delete ui;
53+
}
54+

about.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef ABOUT_H
2+
#define ABOUT_H
3+
4+
#include <QWidget>
5+
6+
QT_BEGIN_NAMESPACE
7+
namespace Ui { class about; }
8+
QT_END_NAMESPACE
9+
10+
class about : public QWidget
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
about(QWidget *parent = nullptr);
16+
~about();
17+
18+
private:
19+
Ui::about *ui;
20+
};
21+
#endif // ABOUT_H

about.ui

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>about</class>
4+
<widget class="QWidget" name="about">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>550</width>
10+
<height>350</height>
11+
</rect>
12+
</property>
13+
<property name="minimumSize">
14+
<size>
15+
<width>550</width>
16+
<height>350</height>
17+
</size>
18+
</property>
19+
<property name="maximumSize">
20+
<size>
21+
<width>550</width>
22+
<height>350</height>
23+
</size>
24+
</property>
25+
<property name="windowTitle">
26+
<string>about</string>
27+
</property>
28+
<layout class="QVBoxLayout" name="verticalLayout_2">
29+
<item>
30+
<layout class="QHBoxLayout" name="horizontalLayout">
31+
<item>
32+
<layout class="QVBoxLayout" name="verticalLayout">
33+
<item>
34+
<widget class="QLabel" name="appNameLabel">
35+
<property name="font">
36+
<font>
37+
<family>Open Sans</family>
38+
<pointsize>25</pointsize>
39+
</font>
40+
</property>
41+
<property name="text">
42+
<string>plainDE</string>
43+
</property>
44+
</widget>
45+
</item>
46+
<item>
47+
<widget class="QLabel" name="versionLabel">
48+
<property name="font">
49+
<font>
50+
<family>Open Sans</family>
51+
<pointsize>12</pointsize>
52+
</font>
53+
</property>
54+
<property name="text">
55+
<string>0.0.1</string>
56+
</property>
57+
</widget>
58+
</item>
59+
<item>
60+
<spacer name="verticalSpacer">
61+
<property name="orientation">
62+
<enum>Qt::Vertical</enum>
63+
</property>
64+
<property name="sizeHint" stdset="0">
65+
<size>
66+
<width>20</width>
67+
<height>40</height>
68+
</size>
69+
</property>
70+
</spacer>
71+
</item>
72+
</layout>
73+
</item>
74+
<item>
75+
<widget class="QLabel" name="logoLabel">
76+
<property name="maximumSize">
77+
<size>
78+
<width>120</width>
79+
<height>120</height>
80+
</size>
81+
</property>
82+
<property name="text">
83+
<string/>
84+
</property>
85+
<property name="pixmap">
86+
<pixmap resource="assets.qrc">:/assets/logo.png</pixmap>
87+
</property>
88+
<property name="scaledContents">
89+
<bool>true</bool>
90+
</property>
91+
</widget>
92+
</item>
93+
</layout>
94+
</item>
95+
<item>
96+
<widget class="QTextEdit" name="aboutTextEdit">
97+
<property name="readOnly">
98+
<bool>true</bool>
99+
</property>
100+
<property name="html">
101+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
102+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
103+
p, li { white-space: pre-wrap; }
104+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
105+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;plainDE was brought to you by &lt;span style=&quot; font-weight:700;&quot;&gt;thm&lt;/span&gt; and &lt;span style=&quot; font-weight:700;&quot;&gt;Ivan Bushchik&lt;/span&gt;.&lt;/p&gt;
106+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
107+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Found bug/want to help us/have an idea?&lt;/p&gt;
108+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Contact us at &lt;a href=&quot;mailto:segfault@plainde.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;segfault@plainde.org&lt;/span&gt;&lt;/a&gt; or via GitHub Issues.&lt;/p&gt;
109+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
110+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://plainde.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://plainde.org/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
111+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/plainde/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/plainde/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
112+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
113+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/thm-unix/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/thm-unix/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
114+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/ivabus/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/ivabus/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
115+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
116+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Learn more about GNU General Public License v3...&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
117+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
118+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;2022&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
119+
</property>
120+
<property name="textInteractionFlags">
121+
<set>Qt::TextBrowserInteraction</set>
122+
</property>
123+
</widget>
124+
</item>
125+
<item>
126+
<layout class="QHBoxLayout" name="horizontalLayout_2">
127+
<item>
128+
<spacer name="horizontalSpacer">
129+
<property name="orientation">
130+
<enum>Qt::Horizontal</enum>
131+
</property>
132+
<property name="sizeHint" stdset="0">
133+
<size>
134+
<width>40</width>
135+
<height>20</height>
136+
</size>
137+
</property>
138+
</spacer>
139+
</item>
140+
<item>
141+
<widget class="QPushButton" name="okPushButton">
142+
<property name="text">
143+
<string>OK</string>
144+
</property>
145+
</widget>
146+
</item>
147+
</layout>
148+
</item>
149+
</layout>
150+
</widget>
151+
<resources>
152+
<include location="assets.qrc"/>
153+
</resources>
154+
<connections>
155+
<connection>
156+
<sender>okPushButton</sender>
157+
<signal>clicked()</signal>
158+
<receiver>about</receiver>
159+
<slot>close()</slot>
160+
<hints>
161+
<hint type="sourcelabel">
162+
<x>499</x>
163+
<y>326</y>
164+
</hint>
165+
<hint type="destinationlabel">
166+
<x>274</x>
167+
<y>174</y>
168+
</hint>
169+
</hints>
170+
</connection>
171+
</connections>
172+
</ui>

assets.qrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<RCC>
2+
<qresource prefix="/assets">
3+
<file>logo.png</file>
4+
<file>light.qss</file>
5+
<file>dark.qss</file>
6+
</qresource>
7+
</RCC>

dark.qss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
QWidget#about {
2+
background-color: #373737;
3+
}
4+
5+
QLabel {
6+
color: #F0F0F0;
7+
}
8+
9+
QPushButton {
10+
color: #F0F0F0;
11+
background-color: #373737;
12+
}
13+
14+
QTextEdit {
15+
color: #F0F0F0;
16+
background-color: #545454;
17+
}
18+
19+
QTextEdit:link {
20+
color: #FF0000;
21+
}

light.qss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
QWidget#about {
2+
background-color: #F0F0F0;
3+
}
4+
5+
QLabel {
6+
color: #000000;
7+
}
8+
9+
QPushButton {
10+
color: #000000;
11+
}

logo.png

156 KB
Loading

main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "about.h"
2+
3+
#include <QApplication>
4+
5+
int main(int argc, char *argv[])
6+
{
7+
QApplication a(argc, argv);
8+
about w;
9+
w.show();
10+
11+
return a.exec();
12+
}

plainAbout.pro

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
QT += core gui
2+
3+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
4+
5+
CONFIG += c++17
6+
7+
# You can make your code fail to compile if it uses deprecated APIs.
8+
# In order to do so, uncomment the following line.
9+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10+
11+
SOURCES += \
12+
main.cpp \
13+
about.cpp
14+
15+
HEADERS += \
16+
about.h
17+
18+
FORMS += \
19+
about.ui
20+
21+
# Default rules for deployment.
22+
qnx: target.path = /tmp/$${TARGET}/bin
23+
else: unix:!android: target.path = /opt/$${TARGET}/bin
24+
!isEmpty(target.path): INSTALLS += target
25+
26+
RESOURCES += \
27+
assets.qrc

0 commit comments

Comments
 (0)