Debian Codegraph @

src/ports.h

raw symbols SCIP
1 // Copyright (C) 2014 Sacha Refshauge
2
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 3.0.
6
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 3.0 for more details.
11
12 // A copy of the GPL 3.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
14
15 // Official GIT repository and contact information can be found at
16 // http://github.com/xsacha/Sachesi
17
18 #pragma once
19
20 // For portability between platforms and Qt versions.
21 // Clears up the code in the more important files.
22 // Also a make-shift utility file
23
24 #ifndef BLACKBERRY
25 #include <QFileDialog>
26 #include <QListView>
27 #include <QTreeView>
28 #include <QDesktopServices>
29 #endif
30 #include <QSettings>
31 #include <QUrl>
32
33 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
34 #include <QUrl>
35 #else
36 #include <QUrlQuery>
37 #define encodedQuery query(QUrl::FullyEncoded).toUtf8
38 #endif
39
40 // TODO: Maybe name families by radio
41 enum DeviceFamily {
42 UnknownFamily = 0,
43 Z30Family,
44 OMAPFamily,
45 Z10Family,
46 Z3Family,
47 Q30Family,
48 Q10Family,
49 };
50
51 static QStringList dev[] = {
52 // 0 = Z30 (A Series) + Classic + Leap
53 QStringList() << "STA 100-1" << "STA 100-2" << "STA 100-3" << "STA 100-4" << "STA 100-5" << "STA 100-6" << "SQC 100-1" << "SQC 100-2" << "SQC 100-3" << "SQC 100-4" << "SQC 100-5" << "STR 100-1" << "STR 100-2",
54 QStringList() << "8C00240A" << "8D00240A" << "8E00240A" << "8F00240A" << "9500240A" << "B500240A" << "9600270A" << "9400270A" << "9500270A" << "9700270A" << "9C00270A" << "07002E0A" << "06002E0A",
55 // 1 = Z10 (L Series) OMAP
56 QStringList() << "STL 100-1",
57 QStringList() << "4002607",
58 // 2 = Z10 (L Series) Qualcomm + P9982 (TK Series)
59 QStringList() << "STL 100-2" << "STL 100-3" << "STL 100-4" << "STK 100-1" << "STK 100-2",
60 QStringList() << "8700240A" << "8500240A" << "8400240A" << "A500240A" << "A600240A",
61 // 3 = Z3 (J Series) + Cafe
62 QStringList() << "STJ 100-1" << "STJ 100-2" << "Kopi NA" << "Kopi Europe/ME/Asia" << "Cafe ROW" << "Cafe AT/T" << "Cafe LatinAm" << "Cafe Verizon" << "Cafe Sprint",
63 QStringList() << "04002E07" << "05002E07" << "87002A07" << "8C002A07" << "9600240A" << "9700240A" << "9C00240A" << "A700240A" << "AC00240A",
64 // 4 = Passport / Q30 (W Series)
65 QStringList() << "SQW 100-1" << "SQW 100-2" << "SQW 100-3" << "SQW 100-4" << "Passport Wichita",
66 QStringList() << "87002C0A" << "85002C0A" << "84002C0A" << "86002C0A" << "8C002C0A",
67 // 5 = Q5 (R Series) + Q10 (N Series) + P9983 (QK Series)
68 QStringList() << "SQR 100-1" << "SQR 100-2" << "SQR 100-3" << "SQN 100-1" << "SQN 100-2" << "SQN 100-3" << "SQN 100-4" << "SQN 100-5" << "SQK 100-1" << "SQK 100-2",
69 QStringList() << "84002A0A" << "85002A0A" << "86002A0A" << "8400270A" << "8500270A" << "8600270A" << "8C00270A" << "8700270A" << "8F00270A" << "8E00270A",
70 // 6 = Dev Alpha
71 QStringList() << "Alpha A" << "Alpha B" << "Alpha C",
72 QStringList() << "4002307" << "4002607" << "8D00270A",
73 // 7 = Ontario Series
74 QStringList() << "Ontario NA" << "Ontario Verizon" << "Ontario Sprint" << "Ontario ROW" << "China",
75 QStringList() << "AE00240A" << "AF00240A" << "B400240A" << "B600240A" << "BC00240A",
76 };
77
78 QPair<QString,QString> getFamilyFromDevice(int device, bool specialQ30);
79 QString capPath(bool temp = false);
80 #ifndef BLACKBERRY
81 QFileDialog* selectFiles(QString title, QString dir, QString nameString, QString nameExt);
82 #endif
83 QString getSaveDir();
84 bool checkCurPath();
85 void openFile(QString name);
86 void writeDisplayFile(QString type, QString writeText);
87 bool isVersionNewer(QString first, QString second, bool orSame);
88
89 // These may not be entirely necessary but there have been issues in the past
90 #define qSafeFree(x) \
91 if (x != nullptr) { \
92 x->deleteLater(); \
93 x = nullptr; \
94 }
95 #define qIoSafeFree(x) \
96 if (x != nullptr) { \
97 if (x->isOpen()) \
98 x->close(); \
99 x->deleteLater(); \
100 x = nullptr; \
101 }
102 #define ioSafeFree(x) \
103 if (x != nullptr) { \
104 if (x->isOpen()) \
105 x->close(); \
106 delete x; \
107 x = nullptr; \
108 }