From 35e199b579c8cc132b23cefa4207e583344c8902 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 3 Dec 2016 09:36:51 +0100 Subject: [PATCH] Prep for Nightly (#4089) * Prep for Nightly * Compile fix * Much nicer :) * One more * Fix * Last one * Cosmetics --- companion/src/CMakeLists.txt | 7 +++++-- companion/src/constants.h | 6 ++++++ companion/src/helpers.cpp | 27 +++++++++++++------------- companion/src/mainwindow.cpp | 6 +++--- companion/src/mdichild.cpp | 3 +++ companion/src/simulator.cpp | 6 +++--- radio/src/gui/common/stdlcd/popups.cpp | 2 +- 7 files changed, 35 insertions(+), 22 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 269e7cd58..d00bac181 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -27,6 +27,9 @@ if(DEBUG_STORAGE_IMPORT) add_definitions(-DDEBUG_STORAGE_IMPORT) message(STATUS "Storage import debugging enabled") endif() +if(DEBUG) + add_definitions(-DDEBUG) +endif() option(TABLE_LAYOUT "Use QTableWidget for grid layouts") # Disabled by default if(TABLE_LAYOUT) @@ -384,7 +387,7 @@ if(APPLE) file(GLOB simulator_plugins "${CMAKE_BINARY_DIR}/libopentx-*${CMAKE_SHARED_LIBRARY_SUFFIX}") set(companion_res_dir ${COMPANION_NAME}.app/Contents/Resources) install(FILES ${simulator_plugins} DESTINATION "${companion_res_dir}" COMPONENT Runtime) - + # Write qt.conf to tell qt where to find it plugins file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" "[Paths]\nPlugins = Plugins\n") @@ -402,7 +405,7 @@ if(APPLE) get_target_property(QPA_PLUGIN Qt5::QCocoaIntegrationPlugin LOCATION) install(FILES ${QPA_PLUGIN} DESTINATION "${plugin_dest_dir}/platforms/" COMPONENT Runtime) set(bundle_qt_libs "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/platforms/libqcocoa.dylib") - + # Add icon set(MACOSX_BUNDLE_ICON_FILE iconmac.icns) set(MAC_ICON_FILE ${COMPANION_SRC_DIRECTORY}/images/${MACOSX_BUNDLE_ICON_FILE}) diff --git a/companion/src/constants.h b/companion/src/constants.h index b33551600..8f35dab24 100644 --- a/companion/src/constants.h +++ b/companion/src/constants.h @@ -64,4 +64,10 @@ const char * const ARROW_UP = "\xE2\x86\x91"; const char * const ARROW_RIGHT = "\xE2\x86\x92"; const char * const ARROW_DOWN = "\xE2\x86\x93"; +#if defined(DEBUG) +#define HORUS_READY_FOR_RELEASE() true +#else +#define HORUS_READY_FOR_RELEASE() false +#endif + #endif // _CONSTANTS_H_ diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 41da88481..436cd4822 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -25,7 +25,7 @@ #endif #if !defined WIN32 && defined __GNUC__ #include -#endif +#endif #include "appdata.h" #include "helpers.h" #include "simulatordialog.h" @@ -600,7 +600,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti b->addItem(item.toString(model), item.toValue()); if (item == source) b->setCurrentIndex(b->count()-1); } - + if (flags & POPULATE_SWITCHES) { for (int i=0; igetCapability(Switches); i++) { item = RawSource(SOURCE_TYPE_SWITCH, i); @@ -685,7 +685,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti } QString image2qstring(QImage image) -{ +{ if (image.isNull()) return ""; QBuffer buffer; @@ -713,7 +713,7 @@ int findmult(float value, float base) break; } } - + return mult; } @@ -790,7 +790,7 @@ QString getTheme() break; default: Theme="yerico"; - break; + break; } return Theme; } @@ -820,7 +820,8 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) } BoardEnum board = GetCurrentFirmware()->getBoard(); SimulatorDialog * dialog; - if (board == BOARD_HORUS) { + + if (board == BOARD_HORUS && HORUS_READY_FOR_RELEASE()) { dialog = new SimulatorDialogHorus(parent, simulator, flags); GetEepromInterface()->saveFile(*simuData, g.profile[g.id()].sdPath()); dialog->start(NULL); @@ -851,7 +852,7 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) firmware->saveEEPROM((uint8_t *)eeprom.data(), *simuData, 0, firmware->getCapability(SimulatorVariant)); dialog->start(eeprom); } - + dialog->exec(); delete dialog; delete simuData; @@ -880,7 +881,7 @@ QPixmap makePixMap(const QImage & image) else { result = result.convertToFormat(QImage::Format_Mono); } - + return QPixmap::fromImage(result); } @@ -976,7 +977,7 @@ bool caseInsensitiveLessThan(const QString &s1, const QString &s2) return s1.toLower() < s2.toLower(); } -bool GpsGlitchFilter::isGlitch(GpsCoord coord) +bool GpsGlitchFilter::isGlitch(GpsCoord coord) { if ((fabs(coord.latitude) < 0.1) && (fabs(coord.longitude) < 0.1)) { return true; @@ -1016,7 +1017,7 @@ bool GpsLatLonFilter::isValid(GpsCoord coord) return true; } -double toDecimalCoordinate(const QString & value) +double toDecimalCoordinate(const QString & value) { if (value.isEmpty()) return 0.0; double temp = int(value.left(value.length()-1).toDouble() / 100); @@ -1112,7 +1113,7 @@ void TableLayout::addLayout(int row, int column, QLayout * layout) #endif } -void TableLayout::resizeColumnsToContents() +void TableLayout::resizeColumnsToContents() { #if defined(TABLE_LAYOUT) tableWidget->resizeColumnsToContents(); @@ -1120,7 +1121,7 @@ void TableLayout::resizeColumnsToContents() #endif } -void TableLayout::setColumnWidth(int col, int width) +void TableLayout::setColumnWidth(int col, int width) { #if defined(TABLE_LAYOUT) tableWidget->setColumnWidth(col, width); @@ -1128,7 +1129,7 @@ void TableLayout::setColumnWidth(int col, int width) #endif } -void TableLayout::pushRowsUp(int row) +void TableLayout::pushRowsUp(int row) { #if defined(TABLE_LAYOUT) #else diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index e36c51fa2..be5621654 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -557,7 +557,7 @@ void MainWindow::openDocURL() void MainWindow::openFile() { QString fileFilter; - if (GetCurrentFirmware()->getBoard() == BOARD_HORUS) { + if (GetCurrentFirmware()->getBoard() == BOARD_HORUS && HORUS_READY_FOR_RELEASE()) { fileFilter = tr(OTX_FILES_FILTER); } else { @@ -751,7 +751,7 @@ void MainWindow::loadBackup() void MainWindow::readEeprom() { - if(GetCurrentFirmware()->getBoard()== BOARD_HORUS) { + if(GetCurrentFirmware()->getBoard()== BOARD_HORUS && HORUS_READY_FOR_RELEASE()) { // just an example QString path = findMassstoragePath("RADIO"); if (path.isEmpty()) { @@ -950,7 +950,7 @@ void MainWindow::updateMenus() bool hasMdiChild = (activeMdiChild() != 0); bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection()); - if(false /*GetCurrentFirmware()->getBoard() == BOARD_HORUS*/) { + if(GetCurrentFirmware()->getBoard() == BOARD_HORUS && !HORUS_READY_FOR_RELEASE()) { newAct->setEnabled(false); openAct->setEnabled(false); saveAct->setEnabled(false); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 264312c3c..a55cc756f 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -84,6 +84,9 @@ void MdiChild::eepromInterfaceChanged() { ui->modelsList->refreshList(); ui->SimulateTxButton->setEnabled(GetCurrentFirmware()/*firmware*/->getCapability(Simulation)); + if (GetCurrentFirmware()->getBoard() == BOARD_HORUS && !HORUS_READY_FOR_RELEASE()) { + ui->SimulateTxButton->setDisabled(GetCurrentFirmware()/*firmware*/->getCapability(Simulation)); + } updateTitle(); } diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index 9e19e2041..7ba096ba5 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -45,7 +45,7 @@ #endif #ifdef __APPLE__ -#include +#include class MyProxyStyle : public QProxyStyle { @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) } } if (!ok) { - firmwareId = QInputDialog::getItem(0, QObject::tr("Radio type"), + firmwareId = QInputDialog::getItem(0, QObject::tr("Radio type"), QObject::tr("Which radio type do you want to simulate?"), firmwareIds, currentIdx, false, &ok); } @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) showMessage(QObject::tr("ERROR: Simulator %1 not found").arg(firmwareId), QMessageBox::Critical); return 2; } - if (factory->type() == BOARD_HORUS) + if (factory->type() == BOARD_HORUS && HORUS_READY_FOR_RELEASE()) dialog = new SimulatorDialogHorus(NULL, factory->create()); else if (factory->type() == BOARD_FLAMENCO) dialog = new SimulatorDialogFlamenco(NULL, factory->create()); diff --git a/radio/src/gui/common/stdlcd/popups.cpp b/radio/src/gui/common/stdlcd/popups.cpp index b226fff47..c71ae235a 100644 --- a/radio/src/gui/common/stdlcd/popups.cpp +++ b/radio/src/gui/common/stdlcd/popups.cpp @@ -126,7 +126,7 @@ const char * runPopupMenu(event_t event) killEvents(event); // no break #endif - + case EVT_KEY_BREAK(KEY_EXIT): popupMenuNoItems = 0; s_menu_item = 0;