Add about dialog.

This commit is contained in:
Felix Geyer 2012-05-02 15:37:21 +02:00
parent eb430d78a0
commit d60e27b4cf
6 changed files with 147 additions and 0 deletions

View File

@ -49,6 +49,7 @@ set(keepassx_SOURCES
format/KeePass2Writer.cpp
format/KeePass2XmlReader.cpp
format/KeePass2XmlWriter.cpp
gui/AboutDialog.cpp
gui/ChangeMasterKeyWidget.cpp
gui/DatabaseOpenDialog.cpp
gui/DatabaseSettingsWidget.cpp
@ -82,6 +83,7 @@ set(keepassx_MOC
core/EntryAttributes.h
core/Group.h
core/Metadata.h
gui/AboutDialog.h
gui/ChangeMasterKeyWidget.h
gui/DatabaseOpenDialog.h
gui/DatabaseSettingsWidget.h
@ -104,6 +106,7 @@ set(keepassx_MOC
)
set(keepassx_FORMS
gui/AboutDialog.ui
gui/ChangeMasterKeyWidget.ui
gui/DatabaseOpenDialog.ui
gui/DatabaseSettingsWidget.ui

40
src/gui/AboutDialog.cpp Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* 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 or (at your option)
* version 3 of the License.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AboutDialog.h"
#include "ui_AboutDialog.h"
#include "config-keepassx.h"
AboutDialog::AboutDialog(QWidget* parent)
: QDialog(parent)
, m_ui(new Ui::AboutDialog())
{
m_ui->setupUi(this);
m_ui->nameLabel->setText(m_ui->nameLabel->text() + " " + KEEPASSX_VERSION);
QFont nameLabelFont = m_ui->nameLabel->font();
nameLabelFont.setBold(true);
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
m_ui->nameLabel->setFont(nameLabelFont);
setAttribute(Qt::WA_DeleteOnClose);
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
}
AboutDialog::~AboutDialog()
{
}

40
src/gui/AboutDialog.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* 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 or (at your option)
* version 3 of the License.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSX_ABOUTDIALOG_H
#define KEEPASSX_ABOUTDIALOG_H
#include <QtCore/QScopedPointer>
#include <QtGui/QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget* parent = 0);
~AboutDialog();
private:
QScopedPointer<Ui::AboutDialog> m_ui;
};
#endif // KEEPASSX_ABOUTDIALOG_H

55
src/gui/AboutDialog.ui Normal file
View File

@ -0,0 +1,55 @@
<?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>392</width>
<height>208</height>
</rect>
</property>
<property name="windowTitle">
<string>About KeePassX</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>KeePassX</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;a href=&quot;http://www.keepassx.org/&quot;&gt;http://www.keepassx.org/&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>KeePassX is distributed under the term of the GNU General Public License (GPL) version 3 or (at your option) version 3.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -23,6 +23,7 @@
#include "core/Database.h"
#include "core/DataPath.h"
#include "core/Metadata.h"
#include "gui/AboutDialog.h"
#include "gui/DatabaseWidget.h"
#include "gui/EntryView.h"
@ -69,6 +70,7 @@ MainWindow::MainWindow()
connect(m_ui->actionGroupDelete, SIGNAL(triggered()), m_ui->tabWidget,
SLOT(deleteGroup()));
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
}
MainWindow::~MainWindow()
@ -162,6 +164,12 @@ void MainWindow::updateWindowTitle()
}
}
void MainWindow::showAboutDialog()
{
AboutDialog* aboutDialog = new AboutDialog(this);
aboutDialog->show();
}
void MainWindow::closeEvent(QCloseEvent *event) {
if (!m_ui->tabWidget->closeAllDatabases()) {
event->ignore();

View File

@ -41,6 +41,7 @@ protected:
private Q_SLOTS:
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
void updateWindowTitle();
void showAboutDialog();
private:
const QScopedPointer<Ui::MainWindow> m_ui;