Skip to content

Commit

Permalink
Add help window and version string
Browse files Browse the repository at this point in the history
  • Loading branch information
zwpwjwtz committed Mar 31, 2016
1 parent bb50cc0 commit ee352ea
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 4 deletions.
16 changes: 13 additions & 3 deletions f3-qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,25 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = f3-qt
TEMPLATE = app

VER_MAJ = 1
VER_MIN = 0
VER_PAT = 0
VERSION = 1.0.0
VERSION_PE_HEADER = 1.0.0

DEFINES += APP_VERSION=\\\"$$VERSION\\\"

SOURCES += main.cpp\
mainwindow.cpp \
f3_launcher.cpp
f3_launcher.cpp \
helpwindow.cpp

HEADERS += mainwindow.h \
f3_launcher.h
f3_launcher.h \
helpwindow.h

FORMS += mainwindow.ui
FORMS += mainwindow.ui \
helpwindow.ui

DISTFILES +=

Expand Down
2 changes: 1 addition & 1 deletion f3-qt.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.6.0, 2016-03-30T21:32:54. -->
<!-- Written by QtCreator 3.6.1, 2016-03-31T22:24:39. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
Binary file added help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions helpwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <QPushButton>
#include "helpwindow.h"
#include "ui_helpwindow.h"

HelpWindow::HelpWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::HelpWindow)
{
ui->setupUi(this);
ui->labelVersion->setText(QString("Ver: ").append(APP_VERSION));
ui->textAbout->setText("This program is a free software.\n\n"
"You can redistribute it and/or modify it under the terms of"
"the GNU Library General Public License as published by"
"the Free Software Foundation; either version 3 of the License,"
"or (at your option) any later version.\n\n"
"This package 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 Library General Public License "
"for more details.\n");
ui->labelContact->setText("<p>GUI Author: <a href=\"mailto:[email protected]\">Tianze Wang</a></p>"
"<p>Author of F3: <a href=\"mailto:[email protected]\">Michel Machado</a></p>"
"<p align=\"center\">Feel free to report bugs and give suggestions!</p>");
}

HelpWindow::~HelpWindow()
{
delete ui;
}
23 changes: 23 additions & 0 deletions helpwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef HELPWINDOW_H
#define HELPWINDOW_H

#include <QDialog>
#include <QAbstractButton>

namespace Ui {
class HelpWindow;
}

class HelpWindow : public QDialog
{
Q_OBJECT

public:
explicit HelpWindow(QWidget *parent = 0);
~HelpWindow();

private:
Ui::HelpWindow *ui;
};

#endif // HELPWINDOW_H
173 changes: 173 additions & 0 deletions helpwindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HelpWindow</class>
<widget class="QDialog" name="HelpWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>260</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<widget class="QLabel" name="labelIcon">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icon.qrc">:/icon/f3.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelTitle">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>231</width>
<height>41</height>
</rect>
</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;Fight Flash Fraud&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>371</width>
<height>191</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>About</string>
</attribute>
<widget class="QTextBrowser" name="textAbout">
<property name="geometry">
<rect>
<x>-5</x>
<y>-5</y>
<width>371</width>
<height>171</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Author</string>
</attribute>
<widget class="QLabel" name="labelContact">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>331</width>
<height>121</height>
</rect>
</property>
<property name="text">
<string>Info...</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</widget>
</widget>
<widget class="QLabel" name="labelVersion">
<property name="geometry">
<rect>
<x>300</x>
<y>20</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Ver</string>
</property>
</widget>
</widget>
<resources>
<include location="icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>HelpWindow</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>HelpWindow</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
1 change: 1 addition & 0 deletions icon.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/icon">
<file>f3.png</file>
<file>help.png</file>
</qresource>
</RCC>
12 changes: 12 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "helpwindow.h"
#include <QDesktopWidget>
#include <QMessageBox>
#include <QFileDialog>
Expand Down Expand Up @@ -51,6 +52,8 @@ void MainWindow::showCapacity(int value)
{
timerTarget = value;
ui->progressBar->setValue(0);
if (value <= 0)
return;
timer.setInterval(1000 / value);
timer.start();
}
Expand Down Expand Up @@ -168,10 +171,14 @@ void MainWindow::closeEvent(QCloseEvent* event)
{
if (QMessageBox::question(this,"Quit F3","The program is still running a check.\n"
"Quit anyway?",QMessageBox::Yes,QMessageBox::No) != QMessageBox::Yes)
{
event->ignore();
return;
}
else
cui.stopCheck();
}
help.close();
}

void MainWindow::on_buttonExit_clicked()
Expand Down Expand Up @@ -204,3 +211,8 @@ void MainWindow::on_timer_timeout()
timer.stop();
}
}

void MainWindow::on_buttonHelp_clicked()
{
help.show();
}
3 changes: 3 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QMainWindow>
#include <QTimer>
#include "f3_launcher.h"
#include "helpwindow.h"

namespace Ui {
class MainWindow;
Expand All @@ -24,12 +25,14 @@ private slots:
void on_buttonCheck_clicked();
void on_buttonExit_clicked();
void on_buttonSelectPath_clicked();
void on_buttonHelp_clicked();
void on_timer_timeout();

private:
Ui::MainWindow *ui;
f3_launcher cui;
QTimer timer;
HelpWindow help;
bool checking;
int timerTarget;

Expand Down
27 changes: 27 additions & 0 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,40 @@
</property>
</widget>
</widget>
<widget class="QPushButton" name="buttonHelp">
<property name="geometry">
<rect>
<x>370</x>
<y>0</y>
<width>30</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/help.png</normaloff>:/icon/help.png</iconset>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
<zorder>frameProgress</zorder>
<zorder>buttonCheck</zorder>
<zorder>buttonExit</zorder>
<zorder>textDevPath</zorder>
<zorder>labelPrompt</zorder>
<zorder>buttonSelectPath</zorder>
<zorder>frameResult</zorder>
<zorder>buttonHelp</zorder>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
Expand Down

0 comments on commit ee352ea

Please sign in to comment.