Common: Add title, modal information to ProgressCallback

This commit is contained in:
Connor McLaughlin
2020-08-06 19:32:53 +10:00
parent 8c1a72f640
commit 6e586311e8
6 changed files with 65 additions and 48 deletions

View File

@ -29,6 +29,11 @@ void QtProgressCallback::SetCancellable(bool cancellable)
m_dialog.setCancelButtonText(cancellable ? tr("Cancel") : QString());
}
void QtProgressCallback::SetTitle(const char* title)
{
m_dialog.setWindowTitle(QString::fromUtf8(title));
}
void QtProgressCallback::SetStatusText(const char* text)
{
BaseProgressCallback::SetStatusText(text);
@ -83,23 +88,7 @@ bool QtProgressCallback::ModalConfirmation(const char* message)
QMessageBox::No) == QMessageBox::Yes);
}
u32 QtProgressCallback::ModalPrompt(const char* message, u32 num_options, ...)
void QtProgressCallback::ModalInformation(const char* message)
{
enum : u32
{
MAX_OPTIONS = 3,
};
std::array<QString, MAX_OPTIONS> options;
std::va_list ap;
va_start(ap, num_options);
for (u32 i = 0; i < num_options && i < MAX_OPTIONS; i++)
options[i] = QString::fromUtf8(va_arg(ap, const char*));
va_end(ap);
return static_cast<u32>(QMessageBox::question(&m_dialog, tr("Question"), QString::fromUtf8(message), options[0],
options[1], options[2], 0, 0));
QMessageBox::information(&m_dialog, tr("Information"), QString::fromUtf8(message));
}