2
0
Эх сурвалжийг харах

CleanUp

Tweaks to CMakeLists.txt and removed some Debug output / old code
Felix 4 жил өмнө
parent
commit
0859ec64bd

+ 3 - 1
CMakeLists.txt

@@ -8,7 +8,7 @@ set(CMAKE_AUTOUIC ON)
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTORCC ON)
 
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
@@ -127,3 +127,5 @@ else()
 endif()
 
 target_link_libraries(openPilotLog PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network)
+
+install(TARGETS openPilotLog DESTINATION bin)

+ 0 - 70
src/classes/asettings.h

@@ -123,76 +123,6 @@ private:
     static QMap<Setup, QString> setupMap;
     static QMap<NewFlight, QString> newFlightMap;
 
-#define FOR_CURRENT_VERSION 0
-#if (FOR_CURRENT_VERSION)
-    /* By default unless specified each enum is + 1.
-       If we are interested in doing multiple returns at once then
-       we should make them so that the can be OR-ed.
-
-        That means that in binary this means that
-        every new enum has only 1 bit on
-        that bit is always moving to the left
-    */
-    enum Setup2 {
-        SetupComplete       = 0x00'00'00'01,  // If this makes no sense look up hexadecimals
-    };                                        // the ' is legal in numbers it is ignored
-                                              // used only for reader convinience
-    enum Main2 {
-        Theme               = 0x00'00'00'02,
-        ThemeID             = 0x00'00'00'04,
-    };
-
-    enum LogBook2 {
-        View                = 0x00'00'00'08,
-    };
-
-    enum UserData2 {
-        LastName            = 0x00'00'00'10,
-        FirstName           = 0x00'00'00'20,
-        Company             = 0x00'00'00'40,
-        EmployeeID          = 0x00'00'00'80,
-        Phone               = 0x00'00'01'00,
-        Email               = 0x00'00'02'00,
-        DisplaySelfAs       = 0x00'00'04'00,
-        Alias               = 0x00'00'08'00,
-        AcSortColumn        = 0x00'00'10'00,
-        PilSortColumn       = 0x00'00'20'00,
-        AcAllowIncomplete   = 0x00'00'40'00,
-    };
-
-    enum FlightLogging2 {
-        Function            = 0x00'00'80'00,
-        Approach            = 0x00'01'00'00,
-        NightLogging        = 0x00'02'00'00,
-        LogIFR              = 0x00'04'00'00,
-        FlightNumberPrefix  = 0x00'08'00'00,
-        NumberTakeoffs      = 0x00'10'00'00,
-        NumberLandings      = 0x00'20'00'00,
-        PopupCalendar       = 0x00'40'00'00,
-        PilotFlying         = 0x00'80'00'00,
-        NightAngle          = 0x01'00'00'00,
-        Rules               = 0x02'00'00'00,
-    };
-
-    enum NewFlight2 {
-        FunctionComboBox    = 0x04'00'00'00,
-        CalendarCheckBox    = 0x08'00'00'00,
-    };
-
-    using Key = int;
-    using Keys = int;
-    /*
-     * Used like QMessageBox buttons;
-     *
-     * auto str = stringOfKey2(ASettings::Setup);
-     * auto strlist = stringOfKeys2(ASettings::Setup | ASettings::Function)
-     */
-    QString stringOfKey2(Key k);
-    QStringList stringOfKeys2(Keys ks);
-
-#endif
-#undef FOR_CURRENT_VERSION
-
 };
 
 #endif // ASETTINGS_H

+ 1 - 7
src/classes/astandardpaths.cpp

@@ -1,19 +1,15 @@
 #include "src/classes/astandardpaths.h"
 
-//QMap<QStandardPaths::StandardLocation, QString> AStandardPaths::paths;
 QMap<AStandardPaths::Dirs, QString> AStandardPaths::dirs;
 
 void AStandardPaths::setup()
 {
-    auto settings_location = QStandardPaths::AppConfigLocation;
     auto data_location = QStandardPaths::AppDataLocation;
     dirs = {  // [G]: potential rename to `dirs`
         {Database, QStandardPaths::writableLocation(data_location)},
         {Templates, QDir(QStandardPaths::writableLocation(data_location)).filePath("templates")},
-        {Settings, QStandardPaths::writableLocation(settings_location)},
         {DatabaseBackup, QDir(QStandardPaths::writableLocation(data_location)).filePath("backup")}
     };
-    DEB << "Paths created: " << dirs;
 }
 
 const QString& AStandardPaths::absPathOf(Dirs loc)
@@ -30,9 +26,7 @@ void AStandardPaths::scan_dirs()
 {
     for(auto& dir : dirs){
         auto d = QDir(dir);
-        DEB << "Scanning " << d.path();
         if(!d.exists()) {
-            DEB <<"Creating " << d.path();
             d.mkpath(dir);
         }
     }
@@ -41,7 +35,7 @@ void AStandardPaths::scan_dirs()
 bool AStandardPaths::validate_dirs()
 {
     for(auto& dir : dirs){
-        DEB << "Validating " << dir;
+        //DEB << "Validating " << dir;
         if(false)  // determine path as valid (scan contents and parse for correctness)
             return false;
     }

+ 6 - 6
src/classes/astyle.cpp

@@ -25,7 +25,7 @@ static inline
 QString read_stylesheet(const AStyle::StyleSheet stylesheet)
 {
     QFileInfo qss_file_info = AStyle::defaultStyleSheets[stylesheet];
-    DEB << "reading:" << ":" + qss_file_info.fileName();
+//    DEB << "reading:" << ":" + qss_file_info.fileName();
 
     QFile file(":" + qss_file_info.fileName());
     file.open(QFile::ReadOnly | QFile::Text);
@@ -41,11 +41,11 @@ void AStyle::setup()
     // [G]: Are there leaks when style changes?
     QVariant app_style = ASettings::read(ASettings::Main::Style);
     if(!app_style.toBool()){
-        DEB << "Setting style to default:" << defaultStyle;
+        //DEB << "Setting style to default:" << defaultStyle;
         app_style = defaultStyle;
         ASettings::write(ASettings::Main::Style, app_style);
     }
-    DEB << "Style set to:" << app_style;
+    //DEB << "Style set to:" << app_style;
     QApplication::setStyle(QStyleFactory::create(app_style.toString()));
     currentStyle = app_style.toString();
 
@@ -55,14 +55,14 @@ void AStyle::setup()
         app_stylesheet = defaultStyleSheet;
         ASettings::write(ASettings::Main::StyleSheet, app_stylesheet);
     }
-    DEB << "Stylesheet set to:" << app_stylesheet;
+    //DEB << "Stylesheet set to:" << app_stylesheet;
     qApp->setStyleSheet(read_stylesheet(static_cast<StyleSheet>(app_stylesheet.toUInt())));
     currentStyleSheet = app_stylesheet.toString();
 }
 
 void AStyle::setStyle(const QString style)
 {
-    DEB << "Setting style to:" << style;
+    //DEB << "Setting style to:" << style;
     QApplication::setStyle(QStyleFactory::create(style));
     ASettings::write(ASettings::Main::Style, style);
     currentStyle = style;
@@ -70,7 +70,7 @@ void AStyle::setStyle(const QString style)
 
 void AStyle::setStyleSheet(const StyleSheet stylesheet)
 {
-    DEB << "Setting stylesheet to:" << defaultStyleSheets[stylesheet].baseName();
+    //DEB << "Setting stylesheet to:" << defaultStyleSheets[stylesheet].baseName();
     qApp->setStyleSheet(read_stylesheet(stylesheet));
     ASettings::write(ASettings::Main::StyleSheet, stylesheet);
     currentStyleSheet = defaultStyleSheets[stylesheet].fileName();

+ 2 - 2
src/database/declarations.h

@@ -37,8 +37,8 @@ struct DataPosition {
     DataPosition& operator=(const DataPosition& other) = default;
 
     REPR(DataPosition,
-         "tableName=" + object.tableName + ", "
-         "rowId=" + object.rowId
+         "tableName=" + object.tableName
+         + ", rowId=" + QString::number(object.rowId)
          )
 };