redo about dialog with version info and a qt designer file

This commit is contained in:
Peinthor Rene
2012-12-23 23:29:15 +01:00
parent 0c368ff7ad
commit b81454c461
7 changed files with 209 additions and 173 deletions

View File

@@ -1,124 +0,0 @@
#include "aboutform.h"
#include <QApplication>
#include <QPixmap>
/*
* Constructs a aboutForm as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
AboutDialog::AboutDialog(QWidget* parent, Qt::WindowFlags fl)
: QDialog(parent, fl)
{
setupUi();
init();
}
void AboutDialog::setupUi()
{
if (this->objectName().isEmpty())
this->setObjectName(QString::fromUtf8("aboutForm"));
//this->resize(542, 257);
vboxLayout = new QVBoxLayout(this);
vboxLayout->setSpacing(6);
vboxLayout->setContentsMargins(11, 11, 11, 11);
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
gridLayout = new QGridLayout();
gridLayout->setSpacing(6);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
hboxLayout = new QHBoxLayout();
hboxLayout->setSpacing(6);
hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
spacer5 = new QSpacerItem(424, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addItem(spacer5);
okButton = new QPushButton();
okButton->setObjectName(QString::fromUtf8("okButton"));
okButton->setDefault(true);
hboxLayout->addWidget(okButton);
gridLayout->addLayout(hboxLayout, 1, 0, 1, 3);
spacer13 = new QSpacerItem(16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout->addItem(spacer13, 0, 1, 1, 1);
vboxLayout1 = new QVBoxLayout();
vboxLayout1->setSpacing(6);
vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1"));
pixmapLabel1 = new QLabel();
pixmapLabel1->setObjectName(QString::fromUtf8("pixmapLabel1"));
pixmapLabel1->setPixmap(QPixmap(":/oldimages/128"));
pixmapLabel1->setScaledContents(false);
pixmapLabel1->setWordWrap(false);
vboxLayout1->addWidget(pixmapLabel1);
spacer12 = new QSpacerItem(20, 31, QSizePolicy::Minimum, QSizePolicy::Expanding);
vboxLayout1->addItem(spacer12);
gridLayout->addLayout(vboxLayout1, 0, 0, 1, 1);
textLabel1 = new QLabel();
textLabel1->setObjectName(QString::fromUtf8("textLabel1"));
textLabel1->setWordWrap(false);
gridLayout->addWidget(textLabel1, 0, 2, 1, 1);
vboxLayout->addLayout(gridLayout);
retranslateUi();
QObject::connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
QMetaObject::connectSlotsByName(this);
} // setupUi
void AboutDialog::retranslateUi()
{
this->setWindowTitle(QObject::tr("About"));
textLabel1->setText(QObject::tr("<p>Version 2.0</font></p>\n"
"<p></p>\n"
"<p><font size=\"+1\">SQLite Database Browser is an open source, public domain, freeware visual tool used to\n"
"<p><font size=\"+1\">create, design and edit SQLite database files.</font></p>\n"
"<p></p>\n"
"<p>For more information on this program please visit our site at: http://sqlitebrowser.sf.net</p>\n"
"<p></p>\n"
"<p></p>\n"
"<p><font size=\"-1\">This software uses the LGPL Qt Toolkit from http://www.qtsoftware.com</p>\n"
"<p><font size=\"-1\">See LICENSING.txt and Qt_LICENSE_LGPL.txt for licensing terms and information.</p>"));
okButton->setText(QObject::tr("Close"));
} // retranslateUi
/*
* Destroys the object and frees any allocated resources
*/
AboutDialog::~AboutDialog()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void AboutDialog::languageChange()
{
retranslateUi();
}
void AboutDialog::init()
{
this->setWindowTitle(QApplication::applicationName());
}

View File

@@ -1,41 +0,0 @@
#ifndef ABOUTFORM_H
#define ABOUTFORM_H
#include <QtGui/QDialog>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QVBoxLayout>
class AboutDialog : public QDialog
{
Q_OBJECT
private:
QVBoxLayout *vboxLayout;
QGridLayout *gridLayout;
QHBoxLayout *hboxLayout;
QSpacerItem *spacer5;
QPushButton *okButton;
QSpacerItem *spacer13;
QVBoxLayout *vboxLayout1;
QLabel *pixmapLabel1;
QSpacerItem *spacer12;
QLabel *textLabel1;
public:
AboutDialog(QWidget* parent = 0, Qt::WindowFlags fl = Qt::Window);
~AboutDialog();
protected slots:
virtual void languageChange();
private:
void init();
void setupUi();
void retranslateUi();
};
#endif // ABOUTFORM_H

20
src/dialogabout.cpp Normal file
View File

@@ -0,0 +1,20 @@
#include "dialogabout.h"
#include "ui_dialogabout.h"
#include "sqlite_source/sqlite3.h"
DialogAbout::DialogAbout(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogAbout)
{
ui->setupUi(this);
this->setFixedSize(669, 306);
ui->label_version->setText(ui->label_version->text() + " " + APP_VERSION);
ui->label_versionqt->setText(ui->label_versionqt->text() + " " + QT_VERSION_STR);
ui->label_versionsqlite->setText(ui->label_versionsqlite->text() + " " + SQLITE_VERSION);
}
DialogAbout::~DialogAbout()
{
delete ui;
}

22
src/dialogabout.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef DIALOGABOUT_H
#define DIALOGABOUT_H
#include <QDialog>
namespace Ui {
class DialogAbout;
}
class DialogAbout : public QDialog
{
Q_OBJECT
public:
explicit DialogAbout(QWidget *parent = 0);
~DialogAbout();
private:
Ui::DialogAbout *ui;
};
#endif // DIALOGABOUT_H

157
src/dialogabout.ui Normal file
View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogAbout</class>
<widget class="QDialog" name="DialogAbout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>669</width>
<height>306</height>
</rect>
</property>
<property name="windowTitle">
<string>About SqliteBrowser</string>
</property>
<property name="windowIcon">
<iconset resource="icons/icons.qrc">
<normaloff>:/oldimages/icon16</normaloff>:/oldimages/icon16</iconset>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>300</x>
<y>260</y>
<width>351</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="label_imagelogo">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>131</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="icons/icons.qrc">:/oldimages/128</pixmap>
</property>
</widget>
<widget class="QLabel" name="label_version">
<property name="geometry">
<rect>
<x>160</x>
<y>30</y>
<width>491</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Version</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>160</x>
<y>120</y>
<width>491</width>
<height>121</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:large;&quot;&gt;SQLite Database Browser is an open source, public domain, freeware visual tool used to create, design and edit SQLite database files.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;For more information on this program please visit our site at: &lt;a href=&quot;https://github.com/rp-/sqlitebrowser&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/rp-/sqlitebrowser&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:small;&quot;&gt;This software uses the LGPL Qt Toolkit from http://www.qtsoftware.com&lt;br/&gt;See LICENSING.txt and Qt_LICENSE_LGPL.txt for licensing terms and information.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_versionqt">
<property name="geometry">
<rect>
<x>160</x>
<y>50</y>
<width>491</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Qt Version</string>
</property>
</widget>
<widget class="QLabel" name="label_versionsqlite">
<property name="geometry">
<rect>
<x>160</x>
<y>70</y>
<width>491</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>SQLite Version</string>
</property>
</widget>
</widget>
<resources>
<include location="icons/icons.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogAbout</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>DialogAbout</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>

View File

@@ -16,7 +16,7 @@
#include "createindexform.h"
#include "deletetableform.h"
#include "deleteindexform.h"
#include "aboutform.h"
#include "dialogabout.h"
#include "choosetableform.h"
#include "edittableform.h"
#include "editfieldform.h"
@@ -1620,7 +1620,7 @@ void MainWindow::helpWhatsThis()
void MainWindow::helpAbout()
{
AboutDialog * aForm = new AboutDialog( this );
DialogAbout * aForm = new DialogAbout( this );
aForm ->exec() ;
}

View File

@@ -12,7 +12,6 @@ HEADERS += \
sqlitedb.h \
sqlbrowser_util.h \
sqlite_source/sqlite3.h \
aboutform.h \
addfieldform.h \
addfieldtypeform.h \
choosetableform.h \
@@ -31,13 +30,14 @@ HEADERS += \
mainwindow.h \
createtabledialog.h \
SQLLogDock.h \
sqlitesyntaxhighlighter.h
sqlitesyntaxhighlighter.h \
dialogabout.h
SOURCES += \
browsermain.cpp \
sqlitedb.cpp \
sqlbrowser_util.c \
sqlite_source/sqlite3.c \
aboutform.cpp \
addfieldform.cpp \
addfieldtypeform.cpp \
choosetableform.cpp \
@@ -56,9 +56,10 @@ SOURCES += \
mainwindow.cpp \
createtabledialog.cpp \
SQLLogDock.cpp \
sqlitesyntaxhighlighter.cpp
sqlitesyntaxhighlighter.cpp \
dialogabout.cpp
QMAKE_CXXFLAGS += -DAPP_VERSION=\\\"`cd $$PWD;git log -n1 --format=%h`\\\"
QMAKE_CXXFLAGS += -DAPP_VERSION=\\\"`cd $$PWD;git log -n1 --format=%h_git`\\\"
unix {
UI_DIR = .ui
@@ -78,4 +79,5 @@ mac {
RESOURCES += icons/icons.qrc
FORMS += \
createtabledialog.ui
createtabledialog.ui \
dialogabout.ui