mirror of
https://github.com/opentx/opentx.git
synced 2025-07-17 13:25:20 +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!" )
|
MESSAGE( "QT lupdate not found!" )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DQXT_STATIC)
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(
|
ADD_CUSTOM_COMMAND(
|
||||||
COMMAND ${XSDCXX_EXECUTABLE} cxx-tree --root-element-all --generate-serialization --output-dir ${PROJECT_BINARY_DIR}/ ${PROJECT_SOURCE_DIR}/radio.xsd
|
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
|
OUTPUT ${PROJECT_BINARY_DIR}/radio.hxx ${PROJECT_BINARY_DIR}/radio.cxx
|
||||||
|
|
|
@ -80,6 +80,14 @@ class MyProxyStyle : public QProxyStyle
|
||||||
};
|
};
|
||||||
#endif
|
#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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(companion);
|
Q_INIT_RESOURCE(companion);
|
||||||
|
@ -111,8 +119,7 @@ int main(int argc, char *argv[])
|
||||||
sdlFlags |= SDL_INIT_AUDIO;
|
sdlFlags |= SDL_INIT_AUDIO;
|
||||||
#endif
|
#endif
|
||||||
if (SDL_Init(sdlFlags) < 0) {
|
if (SDL_Init(sdlFlags) < 0) {
|
||||||
QTextStream stream(stderr);
|
showMessage(QObject::tr("WARNING: couldn't initialize SDL:\n%1").arg(SDL_GetError()), QMessageBox::Warning);
|
||||||
stream << "WARNING: couldn't initialize SDL: " << SDL_GetError() << endl;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -146,13 +153,18 @@ int main(int argc, char *argv[])
|
||||||
options.alias("help", "h");
|
options.alias("help", "h");
|
||||||
options.parse(QCoreApplication::arguments());
|
options.parse(QCoreApplication::arguments());
|
||||||
if(options.count("help") || options.showUnrecognizedWarning()) {
|
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
|
// list all available radios
|
||||||
QTextStream stream(stdout);
|
|
||||||
stream << endl << "Available radios:" << endl;
|
stream << endl << "Available radios:" << endl;
|
||||||
foreach(QString name, firmwareIds) {
|
foreach(QString name, firmwareIds) {
|
||||||
stream << "\t" << name << endl;
|
stream << "\t" << name << endl;
|
||||||
}
|
}
|
||||||
|
// display
|
||||||
|
showMessage(msg, QMessageBox::Information);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,8 +213,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
SimulatorFactory *factory = getSimulatorFactory(firmwareId);
|
SimulatorFactory *factory = getSimulatorFactory(firmwareId);
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
QTextStream stream(stderr);
|
showMessage(QObject::tr("ERROR: Simulator %1 not found").arg(firmwareId), QMessageBox::Critical);
|
||||||
stream << "factory not found" << endl;
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (factory->type() == BOARD_HORUS)
|
if (factory->type() == BOARD_HORUS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue