mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-17 20:58:07 +02:00
Rename new namespace to avoid WinAPI name clash, review fixes
This commit is contained in:
parent
5636b9076f
commit
23e46be992
@ -19,6 +19,7 @@
|
||||
#include "../../lib/texts/Languages.h"
|
||||
#include "../../lib/VCMIDirs.h"
|
||||
#include "../../lib/filesystem/Filesystem.h"
|
||||
#include "../../vcmiqt/MessageBox.h"
|
||||
#include "../helper.h"
|
||||
#include "../languages.h"
|
||||
#include "../innoextract.h"
|
||||
@ -122,7 +123,7 @@ void FirstLaunchView::on_pushButtonDataCopy_clicked()
|
||||
#else
|
||||
// iOS can't display modal dialogs when called directly on button press
|
||||
// https://bugreports.qt.io/browse/QTBUG-98651
|
||||
QTimer::singleShot(0, this, [this]{ copyHeroesData(); });
|
||||
MessageBoxCustom::showDialog(this, [this]{ copyHeroesData(); });
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -130,7 +131,7 @@ void FirstLaunchView::on_pushButtonGogInstall_clicked()
|
||||
{
|
||||
// iOS can't display modal dialogs when called directly on button press
|
||||
// https://bugreports.qt.io/browse/QTBUG-98651
|
||||
QTimer::singleShot(0, this, &FirstLaunchView::extractGogData);
|
||||
MessageBoxCustom::showDialog(this, [this]{extractGogData();});
|
||||
}
|
||||
|
||||
void FirstLaunchView::enterSetup()
|
||||
|
@ -228,7 +228,7 @@ void StartGameTab::on_buttonImportFiles_clicked()
|
||||
|
||||
// iOS can't display modal dialogs when called directly on button press
|
||||
// https://bugreports.qt.io/browse/QTBUG-98651
|
||||
QTimer::singleShot(0, this, importFunctor);
|
||||
MessageBoxCustom::showDialog(this, importFunctor);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonInstallTranslation_clicked()
|
||||
@ -270,7 +270,7 @@ void StartGameTab::on_buttonHelpImportFiles_clicked()
|
||||
" - VCMI configuration files (.json)\n"
|
||||
);
|
||||
|
||||
MessageBox::information(this, ui->buttonImportFiles->text(), message);
|
||||
MessageBoxCustom::information(this, ui->buttonImportFiles->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonInstallTranslationHelp_clicked()
|
||||
@ -280,7 +280,7 @@ void StartGameTab::on_buttonInstallTranslationHelp_clicked()
|
||||
"VCMI provides translations of the game into various languages that you can use. "
|
||||
"Use this option to automatically install such translation to your language."
|
||||
);
|
||||
MessageBox::information(this, ui->buttonInstallTranslation->text(), message);
|
||||
MessageBoxCustom::information(this, ui->buttonInstallTranslation->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonActivateTranslationHelp_clicked()
|
||||
@ -290,7 +290,7 @@ void StartGameTab::on_buttonActivateTranslationHelp_clicked()
|
||||
"Use this option to enable it."
|
||||
);
|
||||
|
||||
MessageBox::information(this, ui->buttonActivateTranslation->text(), message);
|
||||
MessageBoxCustom::information(this, ui->buttonActivateTranslation->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonUpdateModsHelp_clicked()
|
||||
@ -302,7 +302,7 @@ void StartGameTab::on_buttonUpdateModsHelp_clicked()
|
||||
"You many want to postpone mod update until you finish any of your ongoing games."
|
||||
);
|
||||
|
||||
MessageBox::information(this, ui->buttonUpdateMods->text(), message);
|
||||
MessageBoxCustom::information(this, ui->buttonUpdateMods->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonChroniclesHelp_clicked()
|
||||
@ -315,7 +315,7 @@ void StartGameTab::on_buttonChroniclesHelp_clicked()
|
||||
"This will generate and install mod for VCMI that contains imported chronicles"
|
||||
);
|
||||
|
||||
MessageBox::information(this, ui->labelChronicles->text(), message);
|
||||
MessageBoxCustom::information(this, ui->labelChronicles->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonMissingSoundtrackHelp_clicked()
|
||||
@ -326,7 +326,7 @@ void StartGameTab::on_buttonMissingSoundtrackHelp_clicked()
|
||||
"To resolve this problem, please copy missing mp3 files from Heroes III to VCMI data files directory manually "
|
||||
"or reinstall VCMI and re-import Heroes III data files"
|
||||
);
|
||||
MessageBox::information(this, ui->labelMissingSoundtrack->text(), message);
|
||||
MessageBoxCustom::information(this, ui->labelMissingSoundtrack->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonMissingVideoHelp_clicked()
|
||||
@ -337,7 +337,7 @@ void StartGameTab::on_buttonMissingVideoHelp_clicked()
|
||||
"To resolve this problem, please copy VIDEO.VID file from Heroes III to VCMI data files directory manually "
|
||||
"or reinstall VCMI and re-import Heroes III data files"
|
||||
);
|
||||
MessageBox::information(this, ui->labelMissingVideo->text(), message);
|
||||
MessageBoxCustom::information(this, ui->labelMissingVideo->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonMissingFilesHelp_clicked()
|
||||
@ -348,7 +348,7 @@ void StartGameTab::on_buttonMissingFilesHelp_clicked()
|
||||
"To resolve this problem, please reinstall game and reimport data files using supported version of Heroes III. "
|
||||
"VCMI requires Heroes III: Shadow of Death or Complete Edition to run, which you can get (for example) from gog.com"
|
||||
);
|
||||
MessageBox::information(this, ui->labelMissingFiles->text(), message);
|
||||
MessageBoxCustom::information(this, ui->labelMissingFiles->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonMissingCampaignsHelp_clicked()
|
||||
@ -359,7 +359,7 @@ void StartGameTab::on_buttonMissingCampaignsHelp_clicked()
|
||||
"To resolve this problem, please copy missing data files from Heroes III to VCMI data files directory manually "
|
||||
"or reinstall VCMI and re-import Heroes III data files"
|
||||
);
|
||||
MessageBox::information(this, ui->labelMissingCampaigns->text(), message);
|
||||
MessageBoxCustom::information(this, ui->labelMissingCampaigns->text(), message);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonPresetExport_clicked()
|
||||
@ -391,7 +391,7 @@ void StartGameTab::on_buttonPresetNew_clicked()
|
||||
refreshPresets();
|
||||
}
|
||||
};
|
||||
MessageBox::showDialog(functor);
|
||||
MessageBoxCustom::showDialog(this, functor);
|
||||
}
|
||||
|
||||
void StartGameTab::on_buttonPresetDelete_clicked()
|
||||
@ -433,5 +433,5 @@ void StartGameTab::on_buttonPresetRename_clicked()
|
||||
refreshPresets();
|
||||
}
|
||||
};
|
||||
MessageBox::showDialog(functor);
|
||||
MessageBoxCustom::showDialog(this, functor);
|
||||
}
|
||||
|
@ -15,21 +15,21 @@
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
namespace MessageBox
|
||||
namespace MessageBoxCustom
|
||||
{
|
||||
#ifdef VCMI_IOS
|
||||
// iOS can't display modal dialogs when called directly on button press
|
||||
// https://bugreports.qt.io/browse/QTBUG-98651
|
||||
|
||||
template<typename Functor>
|
||||
void showDialog(const Functor & f)
|
||||
inline void showDialog(QWidget *parent, const Functor & f)
|
||||
{
|
||||
QTimer::singleShot(0, this, f);
|
||||
QTimer::singleShot(0, parent, f);
|
||||
}
|
||||
|
||||
void information(QWidget *parent, const QString &title, const QString& text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton)
|
||||
inline void information(QWidget *parent, const QString &title, const QString& text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton)
|
||||
{
|
||||
QTimer::singleShot(0, this, [=](){
|
||||
QTimer::singleShot(0, parent, [=](){
|
||||
QMessageBox::information(parent, title, text, buttons, defaultButton);
|
||||
});
|
||||
}
|
||||
@ -37,12 +37,12 @@ namespace MessageBox
|
||||
#else
|
||||
|
||||
template<typename Functor>
|
||||
void showDialog(const Functor & f)
|
||||
inline void showDialog(QWidget *parent, const Functor & f)
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
void information(QWidget *parent, const QString &title, const QString& text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton)
|
||||
inline void information(QWidget *parent, const QString &title, const QString& text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton)
|
||||
{
|
||||
QMessageBox::information(parent, title, text, buttons, defaultButton);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user