From 750483cb85933981eb787080c3d4facf107c1e03 Mon Sep 17 00:00:00 2001 From: Marko Harjula Date: Sat, 27 Oct 2012 16:52:28 +0300 Subject: [PATCH] ui testing --- .gitignore | 4 ++ NifSkope.pro | 9 +++- nifskope.cpp | 39 ++------------ nifskope.h | 4 ++ ui/about_dialog.cpp | 34 ++++++++++++ ui/about_dialog.h | 17 ++++++ ui/about_dialog.ui | 129 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 199 insertions(+), 37 deletions(-) create mode 100644 ui/about_dialog.cpp create mode 100644 ui/about_dialog.h create mode 100644 ui/about_dialog.ui diff --git a/.gitignore b/.gitignore index 490dccf14..77ba94d1b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ Makefile.Debug Makefile.Release moc_*.cpp qrc_*.cpp +ui_*.h # compiled *.o @@ -13,6 +14,9 @@ qrc_*.cpp .cproject .settings +# qtcreator +NifSkope.pro.user + # binary NifSkope diff --git a/NifSkope.pro b/NifSkope.pro index 3bb7879ca..6f746aaf2 100644 --- a/NifSkope.pro +++ b/NifSkope.pro @@ -128,7 +128,8 @@ HEADERS += \ widgets/refrbrowser.h \ widgets/uvedit.h \ widgets/valueedit.h \ - widgets/xmlcheck.h + widgets/xmlcheck.h \ + ui/about_dialog.h SOURCES += \ basemodel.cpp \ @@ -209,7 +210,8 @@ SOURCES += \ widgets/refrbrowser.cpp \ widgets/uvedit.cpp \ widgets/valueedit.cpp \ - widgets/xmlcheck.cpp + widgets/xmlcheck.cpp \ + ui/about_dialog.cpp RESOURCES += \ nifskope.qrc @@ -254,3 +256,6 @@ console { TRANSLATIONS += lang/NifSkope_de.ts lang/NifSkope_fr.ts # vim: set filetype=config : + +FORMS += \ + ui/about_dialog.ui diff --git a/nifskope.cpp b/nifskope.cpp index 4790b484d..13ad49f4a 100644 --- a/nifskope.cpp +++ b/nifskope.cpp @@ -147,41 +147,7 @@ void NifSkope::migrateSettings() const void NifSkope::about() { - QString text = tr( - "

NifSkope is a tool for analyzing and editing NetImmerse/Gamebryo '.nif' files.

" - "

NifSkope is based on NifTool's XML file format specification. " - "For more information visit our site at http://niftools.sourceforge.net

" - "

NifSkope is free software available under a BSD license. " - "The source is available via git " - "(clone) on SourceForge. " - "Instructions on compiling NifSkope are available on the NifTools wiki.

" - "

The most recent version of NifSkope can always be downloaded from the " - "NifTools SourceForge Project page.

" -// only the windows build uses havok -// (Q_OS_WIN32 is also defined on win64) -#ifdef Q_OS_WIN32 - "
" - "

NifSkope uses Havok(R) for the generation of mopp code. " - "(C)Copyright 1999-2008 Havok.com Inc. (and its Licensors). " - "All Rights Reserved. " - "See www.havok.com for details.

" -#endif - "
" - "

NifSkope uses Qhull for the generation of convex hulls. " - "Copyright(c) 1993-2010 C.B. Barber and The Geometry Center. " - "Qhull is free software and may be obtained from www.qhull.org. " - "See Qhull_COPYING.txt for details." - ); - -#ifdef NIFSKOPE_REVISION - QMessageBox mb( tr("About NifSkope %1 (revision %2)").arg(NIFSKOPE_VERSION).arg(NIFSKOPE_REVISION), text, QMessageBox::Information, - QMessageBox::Ok + QMessageBox::Default, 0, 0, this); -#else - QMessageBox mb( tr("About NifSkope %1").arg(NIFSKOPE_VERSION), text, QMessageBox::Information, - QMessageBox::Ok + QMessageBox::Default, 0, 0, this); -#endif - mb.setIconPixmap( QPixmap( ":/res/nifskope.png" ) ); - mb.exec(); + aboutDialog->show(); } void NifSkope::sltResetBlockDetails() @@ -193,6 +159,9 @@ void NifSkope::sltResetBlockDetails() NifSkope::NifSkope() : QMainWindow(), selecting( false ), initialShowEvent( true ) { + // init UI parts + aboutDialog = new AboutDialog(this); + // migrate settings from older versions of NifSkope migrateSettings(); diff --git a/nifskope.h b/nifskope.h index 3ab382f92..bf82aeec2 100644 --- a/nifskope.h +++ b/nifskope.h @@ -63,6 +63,8 @@ class QUdpSocket; #include "message.h" +#include "ui/about_dialog.h" + //! \file nifskope.h The main header for NifSkope //! The main application class for NifSkope. @@ -183,6 +185,8 @@ protected slots: void initDockWidgets(); void initToolBars(); void initMenu(); + + QWidget *aboutDialog; void setViewFont( const QFont & ); diff --git a/ui/about_dialog.cpp b/ui/about_dialog.cpp new file mode 100644 index 000000000..11d8ee8ab --- /dev/null +++ b/ui/about_dialog.cpp @@ -0,0 +1,34 @@ +#include "about_dialog.h" + +AboutDialog::AboutDialog(QWidget *parent) + : QDialog(parent) { + ui.setupUi(this); + this->setFixedSize(600,400); + this->setWindowTitle( tr("About NifSkope %1 (revision %2)").arg(NIFSKOPE_VERSION).arg(NIFSKOPE_REVISION) ); + QString text = tr( + "

NifSkope is a tool for analyzing and editing NetImmerse/Gamebryo '.nif' files.

" + "

NifSkope is based on NifTool's XML file format specification. " + "For more information visit our site at http://niftools.sourceforge.net

" + "

NifSkope is free software available under a BSD license. " + "The source is available via git " + "(clone) on SourceForge. " + "Instructions on compiling NifSkope are available on the NifTools wiki.

" + "

The most recent version of NifSkope can always be downloaded from the " + "NifTools SourceForge Project page.

" +// only the windows build uses havok +// (Q_OS_WIN32 is also defined on win64) +#ifdef Q_OS_WIN32 + "
" + "

NifSkope uses Havok(R) for the generation of mopp code. " + "(C)Copyright 1999-2008 Havok.com Inc. (and its Licensors). " + "All Rights Reserved. " + "See www.havok.com for details.

" +#endif + "
" + "

NifSkope uses Qhull for the generation of convex hulls. " + "Copyright(c) 1993-2010 C.B. Barber and The Geometry Center. " + "Qhull is free software and may be obtained from www.qhull.org. " + "See Qhull_COPYING.txt for details." + ); + ui.text->setText(text); +} diff --git a/ui/about_dialog.h b/ui/about_dialog.h new file mode 100644 index 000000000..a9c39b8d3 --- /dev/null +++ b/ui/about_dialog.h @@ -0,0 +1,17 @@ +#ifndef ABOUT_H +#define ABOUT_H + +#include "ui_about_dialog.h" + +class AboutDialog : public QDialog { + Q_OBJECT + +public: + AboutDialog(QWidget *parent = 0); + +private: + Ui::AboutDialog ui; +}; + + +#endif // ABOUT_H diff --git a/ui/about_dialog.ui b/ui/about_dialog.ui new file mode 100644 index 000000000..6db495bae --- /dev/null +++ b/ui/about_dialog.ui @@ -0,0 +1,129 @@ + + + AboutDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 600 + 400 + + + + + 0 + 0 + + + + Dialog + + + true + + + + + 10 + 360 + 581 + 31 + + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + 140 + 10 + 451 + 351 + + + + + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + + + + 10 + 10 + 121 + 121 + + + + + + + :/res/nifskope.png + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +