Skip to content

Commit

Permalink
implemented AboutDialog.(refs #62)
Browse files Browse the repository at this point in the history
  • Loading branch information
haraki committed Jun 28, 2019
1 parent 7dda618 commit 1e18023
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 0 deletions.
45 changes: 45 additions & 0 deletions aboutdialog.cpp
@@ -0,0 +1,45 @@
#include <QMessageBox>
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "licensedialog.h"

#ifdef Q_OS_WIN
# include "win32.h"
#else
# include "xnix.h"
#endif

namespace Farman
{

AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);

ui->appNameLabel->setText(tr("<p><font size = '+4'>%1<font size = '+1'> Version %2</font></font></p>")
.arg(qApp->applicationName())
.arg(qApp->applicationVersion()));

ui->appDescriptionLabel->setText(tr("<p>Based on Qt %1 ").arg(qVersion())
+ tr("(%1)").arg(getCompilerVersion())
+ tr("<p>Copyright 2019 %1 All right reserved.</p>").arg(qApp->organizationName()));
}

AboutDialog::~AboutDialog()
{
delete ui;
}

void AboutDialog::on_aboutQtPushButton_clicked()
{
QMessageBox::aboutQt(this);
}

void AboutDialog::on_licensePushButton_clicked()
{
LicenseDialog(this).exec();
}

} // namespace Farman
31 changes: 31 additions & 0 deletions aboutdialog.h
@@ -0,0 +1,31 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <QDialog>

namespace Ui {
class AboutDialog;
}

namespace Farman
{

class AboutDialog : public QDialog
{
Q_OBJECT

public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog();

private Q_SLOTS:
void on_aboutQtPushButton_clicked();
void on_licensePushButton_clicked();

private:
Ui::AboutDialog *ui;
};

} // namespace Farman

#endif // ABOUTDIALOG_H
131 changes: 131 additions & 0 deletions aboutdialog.ui
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>347</width>
<height>144</height>
</rect>
</property>
<property name="windowTitle">
<string>About farman</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="appNameLabel">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="appDescriptionLabel">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<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>83</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="aboutQtPushButton">
<property name="text">
<string>About Qt</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="licensePushButton">
<property name="text">
<string>License</string>
</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>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutDialog</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>AboutDialog</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>
3 changes: 3 additions & 0 deletions farman.pro
Expand Up @@ -22,6 +22,7 @@ DEFINES += APP_VERSION=\\\"$$VERSION\\\"
INCLUDEPATH += ./QHexView/include INCLUDEPATH += ./QHexView/include


SOURCES += main.cpp\ SOURCES += main.cpp\
aboutdialog.cpp \
bookmarkeditdialog.cpp \ bookmarkeditdialog.cpp \
bookmarkinfomodel.cpp \ bookmarkinfomodel.cpp \
bookmarkmanagerdialog.cpp \ bookmarkmanagerdialog.cpp \
Expand Down Expand Up @@ -58,6 +59,7 @@ SOURCES += main.cpp\
xnix.cpp xnix.cpp


HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
aboutdialog.h \
bookmarkeditdialog.h \ bookmarkeditdialog.h \
bookmarkinfo.h \ bookmarkinfo.h \
bookmarkinfomodel.h \ bookmarkinfomodel.h \
Expand Down Expand Up @@ -98,6 +100,7 @@ HEADERS += mainwindow.h \
xnix.h xnix.h


FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
aboutdialog.ui \
bookmarkeditdialog.ui \ bookmarkeditdialog.ui \
bookmarkmanagerdialog.ui \ bookmarkmanagerdialog.ui \
folderform.ui \ folderform.ui \
Expand Down

0 comments on commit 1e18023

Please sign in to comment.