Skip to content

Commit

Permalink
mainwindow: add about boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
flopcat committed Apr 30, 2019
1 parent ec2f61b commit abb57a3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
34 changes: 34 additions & 0 deletions desktop/qt/desktopclient/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <QCoreApplication>
#include <QLabel>
#include <QMap>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSessionManager>
Expand Down Expand Up @@ -300,3 +301,36 @@ void MainWindow::on_systemTray_stateChanged(int arg1)
if (trayIcon)
trayIcon->setVisible(ui->systemTray->isChecked());
}

void MainWindow::on_actionHelpAboutThisProgram_triggered()
{
QString title = "About " + QCoreApplication::applicationName();
QString text = R"EOF(<h2>%1</h2>
<p>A desktop client for a StreamLogin server.
<br>Version %2
<br>Built with Qt %3
<h3>LICENSE</h3>
<p>Copyright (C) 2019
<p>This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
<p>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<p>You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA.")EOF";
text = text.arg(QCoreApplication::applicationName(),
VERSION_STRING,
qVersion());
QMessageBox::about(this, title, text);
}

void MainWindow::on_actionHelpAboutQt_triggered()
{
QMessageBox::aboutQt(this);
}
4 changes: 4 additions & 0 deletions desktop/qt/desktopclient/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ private slots:
void on_actionAppExit_triggered();
void on_systemTray_stateChanged(int arg1);

void on_actionHelpAboutThisProgram_triggered();

void on_actionHelpAboutQt_triggered();

private:
ProgramState progState = NoState;
Ui::MainWindow *ui = nullptr;
Expand Down
24 changes: 21 additions & 3 deletions desktop/qt/desktopclient/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,26 @@
</property>
<widget class="QMenu" name="menuApp">
<property name="title">
<string>App</string>
<string>&amp;App</string>
</property>
<addaction name="actionAppExit"/>
</widget>
<widget class="QMenu" name="menuAccounts">
<property name="title">
<string>Accounts</string>
<string>A&amp;ccounts</string>
</property>
<addaction name="actionAccountsEdit"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionHelpAboutThisProgram"/>
<addaction name="actionHelpAboutQt"/>
</widget>
<addaction name="menuApp"/>
<addaction name="menuAccounts"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="sizePolicy">
Expand All @@ -100,14 +108,24 @@
</widget>
<action name="actionAppExit">
<property name="text">
<string>Exit</string>
<string>E&amp;xit</string>
</property>
</action>
<action name="actionAccountsEdit">
<property name="text">
<string>Edit</string>
</property>
</action>
<action name="actionHelpAboutThisProgram">
<property name="text">
<string>&amp;About This Program...</string>
</property>
</action>
<action name="actionHelpAboutQt">
<property name="text">
<string>About &amp;Qt...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
Expand Down

0 comments on commit abb57a3

Please sign in to comment.