src/misc.cpp

changeset 39
2c368cf5cc19
parent 37
c82a86ea87be
equal deleted inserted replaced
38:db677d321cf4 39:2c368cf5cc19
14 * 14 *
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>
20 #include <QMessageBox>
19 #include "misc.h" 21 #include "misc.h"
20 #include <QMessageBox> 22
23 //
24 // -----------------------------------------------------------------------------
25 //
21 26
22 uint32 makeByteID (uint8 a, uint8 b, uint8 c, uint8 d) 27 uint32 makeByteID (uint8 a, uint8 b, uint8 c, uint8 d)
23 { 28 {
24 return a | (b << 8) | (c << 16) | (d << 24); 29 return a | (b << 8) | (c << 16) | (d << 24);
25 } 30 }
29 // 34 //
30 35
31 QList<QVariant> getVersions() 36 QList<QVariant> getVersions()
32 { 37 {
33 return Config::get ("versions").toList(); 38 return Config::get ("versions").toList();
34 }
35
36 //
37 // -----------------------------------------------------------------------------
38 //
39
40 void addVersion (const ZandronumVersion& version)
41 {
42 QList<QVariant> versions = getVersions();
43 QVariant var;
44 var.setValue (version);
45 versions.append (var);
46 Config::set ("versions", versions);
47 } 39 }
48 40
49 // 41 //
50 // ----------------------------------------------------------------------------- 42 // -----------------------------------------------------------------------------
51 // 43 //
67 bool confirm (const QString& text) 59 bool confirm (const QString& text)
68 { 60 {
69 return QMessageBox::question (NULL, QObject::tr ("Confirm"), text, 61 return QMessageBox::question (NULL, QObject::tr ("Confirm"), text,
70 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::No; 62 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::No;
71 } 63 }
64
65 //
66 // -------------------------------------------------------------------------------------------------
67 //
68
69 QString getBinaryPath (QWidget* parent)
70 {
71 #ifdef _WIN32
72 # define ZAN_EXE_NAME "zandronum.exe"
73 #else
74 # define ZAN_EXE_NAME "zandronum"
75 #endif
76
77 return QFileDialog::getOpenFileName (parent, "", "",
78 "Zandronum Binaries (" ZAN_EXE_NAME ")(" ZAN_EXE_NAME ");;All files (*)(*)");
79 }

mercurial