Skip to content

Commit f5f2628

Browse files
author
Michal
committed
Added info dialog about the app and its author
1 parent 59b6113 commit f5f2628

File tree

7 files changed

+132
-1
lines changed

7 files changed

+132
-1
lines changed

src/QtSerialMonitor.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CONFIG += c++11
3131

3232
SOURCES += \
3333
filereader.cpp \
34+
infodialog.cpp \
3435
logger.cpp \
3536
main.cpp \
3637
mainwindow.cpp \
@@ -43,6 +44,7 @@ HEADERS += \
4344
../../../../../../Downloads/QCustomPlot.tar/qcustomplot/qcustomplot.h \
4445
config.h \
4546
filereader.h \
47+
infodialog.h \
4648
logger.h \
4749
mainwindow.h \
4850
networkudp.h \
@@ -51,6 +53,7 @@ HEADERS += \
5153
serial.h
5254

5355
FORMS += \
56+
infodialog.ui \
5457
mainwindow.ui
5558

5659
win32:RC_ICONS += QtSM.ico

src/infodialog.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "infodialog.h"
2+
#include "ui_infodialog.h"
3+
4+
InfoDialog::InfoDialog(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::InfoDialog)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
InfoDialog::~InfoDialog()
12+
{
13+
delete ui;
14+
}
15+
16+
void InfoDialog::on_pushButtonClose_clicked()
17+
{
18+
this->close();
19+
}

src/infodialog.h

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

src/infodialog.ui

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>InfoDialog</class>
4+
<widget class="QDialog" name="InfoDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>617</width>
10+
<height>391</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="1" column="1">
18+
<widget class="QPushButton" name="pushButtonClose">
19+
<property name="text">
20+
<string>Close</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="1" column="0">
25+
<spacer name="horizontalSpacer">
26+
<property name="orientation">
27+
<enum>Qt::Horizontal</enum>
28+
</property>
29+
<property name="sizeHint" stdset="0">
30+
<size>
31+
<width>40</width>
32+
<height>20</height>
33+
</size>
34+
</property>
35+
</spacer>
36+
</item>
37+
<item row="0" column="0" colspan="2">
38+
<widget class="QTextBrowser" name="textBrowser">
39+
<property name="html">
40+
<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;
41+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
42+
p, li { white-space: pre-wrap; }
43+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
44+
&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;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt;Universal serial monitor with data plotting capabilities, based on &lt;/span&gt;&lt;a href=&quot;https://www.qt.io/&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;Qt&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt;. Designed with all sorts of &lt;/span&gt;&lt;a href=&quot;https://www.arduino.cc/&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;Arduino&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt; projects in mind, as a handy tool for debugging and experimentation :)&lt;/span&gt;&lt;/p&gt;
45+
&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; font-family:'MS Shell Dlg 2'; font-size:9pt; font-weight:600;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
46+
&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;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt; font-weight:600;&quot;&gt;Author:&lt;/span&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt; mich-w&lt;/span&gt;&lt;/p&gt;
47+
&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; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
48+
&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;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt; font-weight:600;&quot;&gt;Link:&lt;/span&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;a href=&quot;https://github.com/mich-w/QtSerialMonitor&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:9pt; font-style:italic; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/mich-w/QtSerialMonitor&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
49+
</property>
50+
<property name="textInteractionFlags">
51+
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
52+
</property>
53+
<property name="openExternalLinks">
54+
<bool>false</bool>
55+
</property>
56+
<property name="openLinks">
57+
<bool>false</bool>
58+
</property>
59+
</widget>
60+
</item>
61+
</layout>
62+
</widget>
63+
<resources/>
64+
<connections/>
65+
</ui>

src/mainwindow.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,9 @@ void MainWindow::addLog(QString text)
792792
text = currentDateTime + text;
793793

794794
ui->textBrowserLogs->append(text);
795+
796+
// ui->textBrowserLogs->insertPlainText(text);
797+
// ui->textBrowserLogs->moveCursor(QTextCursor::MoveOperation::End, QTextCursor::MoveMode::MoveAnchor);
795798
// ui->textBrowserLogs->verticalScrollBar()->setValue(ui->textBrowserLogs->verticalScrollBar()->maximum());
796799
}
797800
}
@@ -2037,3 +2040,9 @@ void MainWindow::on_actionUser_guide_triggered()
20372040
{
20382041
QWhatsThis::enterWhatsThisMode();
20392042
}
2043+
2044+
void MainWindow::on_actionInfo_triggered()
2045+
{
2046+
// infoDialog.setModal(true);
2047+
infoDialog.show();
2048+
}

src/mainwindow.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "parser.h"
99
#include "qcustomplot.h"
1010
#include "serial.h"
11+
#include "infodialog.h"
1112

1213
#include <QCompleter>
1314
#include <QDateTime>
@@ -133,6 +134,8 @@ private slots:
133134
void updateDeviceList();
134135
void on_actionUser_guide_triggered();
135136

137+
void on_actionInfo_triggered();
138+
136139
private:
137140
// QCompleter *completer;
138141
FileReader fileReader;
@@ -148,6 +151,7 @@ private slots:
148151
QTimer *udpStringProcessingTimer;
149152
Serial serial;
150153
Ui::MainWindow *ui;
154+
InfoDialog infoDialog;
151155
void addLog(QString text);
152156
void chartPrintPreview();
153157
void clearGraphData(bool replot);

src/mainwindow.ui

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@
23092309
<x>0</x>
23102310
<y>0</y>
23112311
<width>1675</width>
2312-
<height>21</height>
2312+
<height>26</height>
23132313
</rect>
23142314
</property>
23152315
<widget class="QMenu" name="menuFile">
@@ -2341,6 +2341,7 @@
23412341
<addaction name="actionUser_guide"/>
23422342
<addaction name="actionWhat_s_new"/>
23432343
<addaction name="actionAbout_Qt"/>
2344+
<addaction name="actionInfo"/>
23442345
</widget>
23452346
<widget class="QMenu" name="menuView">
23462347
<property name="title">
@@ -2471,6 +2472,11 @@
24712472
<string>Enter &quot;What's this ?&quot;</string>
24722473
</property>
24732474
</action>
2475+
<action name="actionInfo">
2476+
<property name="text">
2477+
<string>Info</string>
2478+
</property>
2479+
</action>
24742480
</widget>
24752481
<layoutdefault spacing="6" margin="11"/>
24762482
<customwidgets>

0 commit comments

Comments
 (0)