@@ -101,84 +101,30 @@ FSManager * fsmanager = 0;
101101
102102// ! \file nifskope.cpp The main file for NifSkope
103103
104- void NifSkope::copySettings (QSettings & cfg, const QSettings & oldcfg, const QString name) const
105- {
106- if ((!cfg.contains (name)) && oldcfg.contains (name)) {
107- // qDebug() << "copying nifskope setting" << name;
108- cfg.setValue (name, oldcfg.value (name));
109- }
110- }
111-
112104void NifSkope::migrateSettings () const
113105{
114106 // load current nifskope settings
115107 NIFSKOPE_QSETTINGS (cfg);
116- // do nothing if already migrated; this prevents re-importing of corrupt / otherwise not-working values
117- if ( cfg.contains ( " migrated" ) ) return ;
118- // check for older nifskope settings
119- for (QStringList::ConstIterator it = NIFSKOPE_OLDERVERSIONS.begin (); it != NIFSKOPE_OLDERVERSIONS.end (); ++it ) {
120- QSettings oldcfg ( " NifTools" , *it );
121- // check for missing keys and copy them from old settings
122- QStringList keys = oldcfg.allKeys ();
108+ // check if we are running a new version of nifskope
109+ if (cfg.value (" version" ).toString () != NIFSKOPE_VERSION) {
110+ // check all keys and delete all binary ones
111+ // to prevent portability problems between Qt versions
112+ QStringList keys = cfg.allKeys ();
123113 for (QStringList::ConstIterator key = keys.begin (); key != keys.end (); ++key) {
124- // qDebug() << "checking" << *key << oldcfg.value(*key).type();
125- switch (oldcfg.value (*key).type ()) {
126- case QVariant::Bool:
127- case QVariant::ByteArray:
128- case QVariant::Color:
129- case QVariant::Double:
130- case QVariant::Int:
131- case QVariant::String:
132- case QVariant::StringList:
133- case QVariant::UInt:
134- // copy settings for these types
135- copySettings (cfg, oldcfg, *key);
136- default :
137- ; // do nothing
114+ if (cfg.value (*key).type () == QVariant::ByteArray) {
115+ qDebug () << " removing config setting" << *key
116+ << " whilst migrating settings from previous nifskope version" ;
117+ cfg.remove (*key);
138118 }
139119 }
120+ // set version key to current version
121+ cfg.setValue (" version" , NIFSKOPE_VERSION);
140122 }
141- cfg.setValue ( " migrated" , 1 );
142123}
143124
144125/*
145126 * main GUI window
146127 */
147-
148- void NifSkope::about ()
149- {
150- QString text = tr (
151- " <p style='white-space:pre'>NifSkope is a tool for analyzing and editing NetImmerse/Gamebryo '.nif' files.</p>"
152- " <p>NifSkope is based on NifTool's XML file format specification. "
153- " For more information visit our site at <a href='http://niftools.sourceforge.net'>http://niftools.sourceforge.net</a></p>"
154- " <p>NifSkope is free software available under a BSD license. "
155- " The source is available via <a href='http://niftools.git.sourceforge.net/git/gitweb.cgi?p=niftools/nifskope'>git</a> "
156- " (<a href='git://niftools.git.sourceforge.net/gitroot/niftools/nifskope'>clone</a>) on <a href='http://sourceforge.net'>SourceForge</a>. "
157- " Instructions on compiling NifSkope are available on the <a href='http://niftools.sourceforge.net/wiki/NifSkope/Compile'>NifTools wiki</a>.</p>"
158- " <p>The most recent version of NifSkope can always be downloaded from the <a href='https://sourceforge.net/projects/niftools/files/nifskope/'>"
159- " NifTools SourceForge Project page</a>.</p>"
160- // only the windows build uses havok
161- // (Q_OS_WIN32 is also defined on win64)
162- #ifdef Q_OS_WIN32
163- " <center><img src=':/img/havok_logo' /></center>"
164- " <p>NifSkope uses Havok(R) for the generation of mopp code. "
165- " (C)Copyright 1999-2008 Havok.com Inc. (and its Licensors). "
166- " All Rights Reserved. "
167- " See <a href='http://www.havok.com'>www.havok.com</a> for details.</p>"
168- #endif
169- " <center><img src=':/img/qhull_logo' /></center>"
170- " <p>NifSkope uses Qhull for the generation of convex hulls. "
171- " Copyright(c) 1993-2010 C.B. Barber and The Geometry Center. "
172- " Qhull is free software and may be obtained from <a href='http://www.qhull.org'>www.qhull.org</a>. "
173- " See Qhull_COPYING.txt for details."
174- );
175-
176- QMessageBox mb ( tr (" About NifSkope %1 (revision %2)" ).arg (NIFSKOPE_VERSION).arg (NIFSKOPE_REVISION), text, QMessageBox::Information,
177- QMessageBox::Ok + QMessageBox::Default, 0 , 0 , this );
178- mb.setIconPixmap ( QPixmap ( " :/res/nifskope.png" ) );
179- mb.exec ();
180- }
181-
182128void NifSkope::sltResetBlockDetails ()
183129{
184130 if (tree)
@@ -188,6 +134,9 @@ void NifSkope::sltResetBlockDetails()
188134NifSkope::NifSkope ()
189135 : QMainWindow(), selecting( false ), initialShowEvent( true )
190136{
137+ // init UI parts
138+ aboutDialog = new AboutDialog (this );
139+
191140 // migrate settings from older versions of NifSkope
192141 migrateSettings ();
193142
@@ -351,7 +300,7 @@ NifSkope::NifSkope()
351300 connect ( aNifToolsDownloads, SIGNAL ( triggered () ), this , SLOT ( openURL () ) );
352301
353302 aNifSkope = new QAction ( tr (" About &NifSkope" ), this );
354- connect ( aNifSkope, SIGNAL ( triggered () ), this , SLOT ( about () ) );
303+ connect ( aNifSkope, SIGNAL ( triggered () ), aboutDialog , SLOT ( open () ) );
355304
356305 aAboutQt = new QAction ( tr (" About &Qt" ), this );
357306 connect ( aAboutQt, SIGNAL ( triggered () ), qApp, SLOT ( aboutQt () ) );
0 commit comments