15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #include <QFileDialog> |
19 #include <QFileDialog> |
|
20 #include <QSettings> |
20 #include "misc.h" |
21 #include "misc.h" |
21 #include "config.h" |
22 #include "config.h" |
22 |
23 |
23 // |
24 // |
24 // ----------------------------------------------------------------------------- |
25 // ----------------------------------------------------------------------------- |
57 #endif |
58 #endif |
58 |
59 |
59 return QFileDialog::getOpenFileName (parent, "", "", |
60 return QFileDialog::getOpenFileName (parent, "", "", |
60 "Zandronum Binaries (" ZAN_EXE_NAME ");;All files (*)"); |
61 "Zandronum Binaries (" ZAN_EXE_NAME ");;All files (*)"); |
61 } |
62 } |
|
63 |
|
64 // |
|
65 // ------------------------------------------------------------------------------------------------- |
|
66 // |
|
67 |
|
68 void assimilateWadPaths (QStringList& wadpaths) |
|
69 { |
|
70 QString iniPath; |
|
71 |
|
72 #ifdef Q_OS_WIN32 |
|
73 { |
|
74 char* appdata = getenv ("APPDATA"); |
|
75 |
|
76 if (appdata == NULL) |
|
77 return; |
|
78 |
|
79 iniPath = QString::fromLocal8Bit (appdata) + "/.doomseeker/doomseeker.ini"; |
|
80 } |
|
81 #else |
|
82 iniPath = QDir::homePath() + "/.doomseeker/doomseeker.ini"; |
|
83 #endif |
|
84 |
|
85 if (not QFile (iniPath).exists()) |
|
86 return; |
|
87 |
|
88 QSettings settings (iniPath, QSettings::IniFormat); |
|
89 QVariant var = settings.value ("Doomseeker/WadPaths"); |
|
90 QStringList doomseekerPaths; |
|
91 |
|
92 if (var.isValid() and var.toList().isEmpty()) |
|
93 { |
|
94 doomseekerPaths = var.toString().split (";"); |
|
95 } |
|
96 else |
|
97 { |
|
98 QVariantList collection = var.toList(); |
|
99 |
|
100 for (int i = 0; i < collection.size(); ++i) |
|
101 { |
|
102 QVariantList element = collection[i].toList(); |
|
103 |
|
104 if (element.size() > 0) |
|
105 doomseekerPaths.append (element[0].toString()); |
|
106 } |
|
107 } |
|
108 |
|
109 for (int i = 0; i < doomseekerPaths.size(); ++i) |
|
110 { |
|
111 doomseekerPaths[i].replace ("\\", "/"); |
|
112 QString& path = doomseekerPaths[i]; |
|
113 |
|
114 if (not wadpaths.contains (path)) |
|
115 wadpaths.append (path); |
|
116 } |
|
117 } |