qtutils: rename QMessageBox wrapper to avoid conflicts on win32
This commit is contained in:
@@ -47,7 +47,7 @@ QFrame *QtUtils::CreateVerticalLine()
|
||||
return l;
|
||||
}
|
||||
|
||||
int QtUtils::MessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &message, QMessageBox::StandardButtons buttons)
|
||||
int QtUtils::MsgBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &message, QMessageBox::StandardButtons buttons)
|
||||
{
|
||||
QMessageBox b(parent);
|
||||
b.setIcon(icon);
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
#include <QFrame>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "common/define.h"
|
||||
|
||||
#ifdef MessageBox
|
||||
#undef MessageBox
|
||||
#endif
|
||||
|
||||
namespace olive {
|
||||
|
||||
class QtUtils {
|
||||
@@ -56,7 +50,7 @@ public:
|
||||
|
||||
static QFrame* CreateVerticalLine();
|
||||
|
||||
static int MessageBox(QWidget *parent, QMessageBox::Icon icon, const QString& title, const QString& message, QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
static int MsgBox(QWidget *parent, QMessageBox::Icon icon, const QString& title, const QString& message, QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
static QDateTime GetCreationDate(const QFileInfo &info);
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ rational ExportDialog::GetSelectedTimebase() const
|
||||
void ExportDialog::StartExport()
|
||||
{
|
||||
if (!video_enabled_->isChecked() && !audio_enabled_->isChecked() && !subtitles_enabled_->isChecked()) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Invalid parameters"),
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Invalid parameters"),
|
||||
tr("Video, audio, and subtitles are disabled. There's nothing to export."));
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ void ExportDialog::StartExport()
|
||||
|
||||
// If it doesn't, see if the user wants to append it automatically. If not, we don't abort the export.
|
||||
if (!proposed_filename.endsWith(necessary_ext, Qt::CaseInsensitive)) {
|
||||
if (QtUtils::MessageBox(this, QMessageBox::Warning, tr("Invalid filename"),
|
||||
if (QtUtils::MsgBox(this, QMessageBox::Warning, tr("Invalid filename"),
|
||||
tr("The filename must contain the extension \"%1\". Would you like to append it "
|
||||
"automatically?").arg(necessary_ext),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
@@ -288,7 +288,7 @@ void ExportDialog::StartExport()
|
||||
// If the directory does not exist, try to create it
|
||||
QDir dest_dir(file_info.path());
|
||||
if (!FileFunctions::DirectoryIsValid(dest_dir)) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Failed to create output directory"),
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Failed to create output directory"),
|
||||
tr("The intended output directory doesn't exist and Olive couldn't create it. "
|
||||
"Please choose a different filename."));
|
||||
return;
|
||||
@@ -298,7 +298,7 @@ void ExportDialog::StartExport()
|
||||
if (video_tab_->IsImageSequenceSet()) {
|
||||
// Ensure filename contains digits
|
||||
if (!Encoder::FilenameContainsDigitPlaceholder(proposed_filename)) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Invalid filename"),
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Invalid filename"),
|
||||
tr("Export is set to an image sequence, but the filename does not have a section for digits "
|
||||
"(formatted as [#####] where the amount of # is the amount of digits)."));
|
||||
return;
|
||||
@@ -308,7 +308,7 @@ void ExportDialog::StartExport()
|
||||
int64_t needed_digit_count = GetDigitCount(frame_count);
|
||||
int current_digit_count = Encoder::GetImageSequencePlaceholderDigitCount(proposed_filename);
|
||||
if (current_digit_count < needed_digit_count) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Invalid filename"),
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Invalid filename"),
|
||||
tr("Filename doesn't contain enough digits for the amount of frames "
|
||||
"this export will need (need %1 for %n frame(s)).", nullptr, frame_count)
|
||||
.arg(QString::number(needed_digit_count)));
|
||||
@@ -318,7 +318,7 @@ void ExportDialog::StartExport()
|
||||
|
||||
// Validate if the file exists and whether the user wishes to overwrite it
|
||||
if (file_info.exists()) {
|
||||
if (QtUtils::MessageBox(this, QMessageBox::Warning, tr("Confirm Overwrite"),
|
||||
if (QtUtils::MsgBox(this, QMessageBox::Warning, tr("Confirm Overwrite"),
|
||||
tr("The file \"%1\" already exists. Do you want to overwrite it?")
|
||||
.arg(proposed_filename),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
@@ -330,7 +330,7 @@ void ExportDialog::StartExport()
|
||||
if (video_enabled_->isChecked()
|
||||
&& (video_tab_->GetSelectedCodec() == ExportCodec::kCodecH264 || video_tab_->GetSelectedCodec() == ExportCodec::kCodecH265)
|
||||
&& (video_tab_->width_slider()->GetValue()%2 != 0 || video_tab_->height_slider()->GetValue()%2 != 0)) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Invalid Parameters"),
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Invalid Parameters"),
|
||||
tr("Width and height must be multiples of 2."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void SequenceDialog::SetNameIsEditable(bool e)
|
||||
void SequenceDialog::accept()
|
||||
{
|
||||
if (name_field_->isEnabled() && name_field_->text().isEmpty()) {
|
||||
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Error editing Sequence"), tr("Please enter a name for this Sequence."));
|
||||
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Error editing Sequence"), tr("Please enter a name for this Sequence."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void SequenceDialog::accept()
|
||||
|
||||
void SequenceDialog::SetAsDefaultClicked()
|
||||
{
|
||||
if (QtUtils::MessageBox(this, QMessageBox::Question, tr("Confirm Set As Default"),
|
||||
if (QtUtils::MsgBox(this, QMessageBox::Question, tr("Confirm Set As Default"),
|
||||
tr("Are you sure you want to set the current parameters as defaults?"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
// Maybe replace with Preset system
|
||||
|
||||
Reference in New Issue
Block a user