mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 21:05:26 +03:00
Re #3160: fixed Windows compilation, help/warnings shown in a message box (they were not visible on Windows) (ported from master)
This commit is contained in:
parent
0db5072bed
commit
493130504b
2 changed files with 19 additions and 6 deletions
|
@ -93,6 +93,8 @@ ELSE()
|
|||
MESSAGE( "QT lupdate not found!" )
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-DQXT_STATIC)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
COMMAND ${XSDCXX_EXECUTABLE} cxx-tree --root-element-all --generate-serialization --output-dir ${PROJECT_BINARY_DIR}/ ${PROJECT_SOURCE_DIR}/radio.xsd
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/radio.hxx ${PROJECT_BINARY_DIR}/radio.cxx
|
||||
|
|
|
@ -80,6 +80,14 @@ class MyProxyStyle : public QProxyStyle
|
|||
};
|
||||
#endif
|
||||
|
||||
|
||||
void showMessage(const QString & message, enum QMessageBox::Icon icon = QMessageBox::NoIcon) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(message);
|
||||
msgBox.setIcon(icon);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(companion);
|
||||
|
@ -111,8 +119,7 @@ int main(int argc, char *argv[])
|
|||
sdlFlags |= SDL_INIT_AUDIO;
|
||||
#endif
|
||||
if (SDL_Init(sdlFlags) < 0) {
|
||||
QTextStream stream(stderr);
|
||||
stream << "WARNING: couldn't initialize SDL: " << SDL_GetError() << endl;
|
||||
showMessage(QObject::tr("WARNING: couldn't initialize SDL:\n%1").arg(SDL_GetError()), QMessageBox::Warning);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -146,13 +153,18 @@ int main(int argc, char *argv[])
|
|||
options.alias("help", "h");
|
||||
options.parse(QCoreApplication::arguments());
|
||||
if(options.count("help") || options.showUnrecognizedWarning()) {
|
||||
options.showUsage();
|
||||
QString msg;
|
||||
QTextStream stream(&msg);
|
||||
stream << "Usage: simulator [OPTION]... [EEPROM.BIN FILE] " << endl << endl;
|
||||
stream << "Options:" << endl;
|
||||
options.showUsage(false, stream);
|
||||
// list all available radios
|
||||
QTextStream stream(stdout);
|
||||
stream << endl << "Available radios:" << endl;
|
||||
foreach(QString name, firmwareIds) {
|
||||
stream << "\t" << name << endl;
|
||||
}
|
||||
// display
|
||||
showMessage(msg, QMessageBox::Information);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -201,8 +213,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
SimulatorFactory *factory = getSimulatorFactory(firmwareId);
|
||||
if (!factory) {
|
||||
QTextStream stream(stderr);
|
||||
stream << "factory not found" << endl;
|
||||
showMessage(QObject::tr("ERROR: Simulator %1 not found").arg(firmwareId), QMessageBox::Critical);
|
||||
return 2;
|
||||
}
|
||||
if (factory->type() == BOARD_HORUS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue