QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
--- a/QTfrontend/campaign.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/campaign.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -19,7 +19,6 @@
#include <QDir>
#include <QFile>
#include <QTextStream>
-#include <QMessageBox>
#include <QPushButton>
#include <QListWidget>
#include <QStackedLayout>
--- a/QTfrontend/game.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/game.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -21,7 +21,6 @@
#include <QUuid>
#include <QColor>
#include <QStringListModel>
-#include <QMessageBox>
#include <QTextStream>
#include "game.h"
--- a/QTfrontend/gameuiconfig.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/gameuiconfig.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <QMessageBox>
#include <QCheckBox>
#include <QLineEdit>
#include <QDesktopWidget>
--- a/QTfrontend/hwform.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/hwform.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -897,10 +897,18 @@
void HWForm::DeleteTeam(const QString & teamName)
{
- ui.pageEditTeam->deleteTeam(teamName);
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Teams - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the team '%1'?").arg(teamName));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- UpdateTeamsLists();
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
+ {
+ ui.pageEditTeam->deleteTeam(teamName);
+ UpdateTeamsLists();
+ }
}
void HWForm::DeleteScheme()
@@ -908,7 +916,7 @@
ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes)
{
- QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Cannot delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
+ ShowErrorMessage(QMessageBox::tr("Cannot delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
}
else
{
@@ -934,10 +942,7 @@
QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list above"),
- tr("OK"));
+ ShowErrorMessage(QMessageBox::tr("Please select a record from the list"));
return;
}
CreateGame(0, 0, 0);
@@ -1229,10 +1234,10 @@
config->SaveOptions();
pnetserver = new HWNetServer;
- if(!pnetserver->StartServer(ui.pageNetServer->sbPort->value()))
+ if (!pnetserver->StartServer(ui.pageNetServer->sbPort->value()))
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to start the server"));
+ ShowErrorMessage(QMessageBox::tr("Unable to start the server"));
+
delete pnetserver;
pnetserver = 0;
return;
@@ -1271,14 +1276,15 @@
void HWForm::ForcedDisconnect(const QString & reason)
{
- if(pnetserver) return; // we have server - let it care of all things
+ if (pnetserver)
+ return; // we have server - let it care of all things
if (hwnet)
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"')));
-
+ QString errorStr = QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"'));
+ ShowErrorMessage(errorStr);
}
- if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack();
+ if (ui.Pages->currentIndex() != ID_PAGE_NET)
+ GoBack();
}
void HWForm::NetConnected()
@@ -1379,9 +1385,12 @@
void HWForm::ShowErrorMessage(const QString & msg)
{
- QMessageBox::warning(this,
- "Hedgewars",
- msg);
+ QMessageBox msgMsg(this);
+ msgMsg.setIcon(QMessageBox::Warning);
+ msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
+ msgMsg.setText(msg);
+ msgMsg.setWindowModality(Qt::WindowModal);
+ msgMsg.exec();
}
void HWForm::GetRecord(RecordType type, const QByteArray & record)
@@ -1674,8 +1683,17 @@
// hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home. This assumes no spaces in the data dir path
if (success) success = system(("sed -i 's/^\\(Exec=.*\\) \\([^ ]* %f\\)/\\1 "+cfgdir->absolutePath().replace(" ","\\\\ ").replace("/","\\/")+" \\2 --set-everything "+arguments+"/' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
#endif
- if (success) QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
- else QMessageBox::information(0, "", QMessageBox::tr("File association failed."));
+ if (success)
+ {
+ QMessageBox infoMsg(this);
+ infoMsg.setIcon(QMessageBox::Information);
+ infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success"));
+ infoMsg.setText(QMessageBox::tr("All file associations have been set"));
+ infoMsg.setWindowModality(Qt::WindowModal);
+ infoMsg.exec();
+ }
+ else
+ ShowErrorMessage(QMessageBox::tr("File association failed."));
}
void HWForm::saveDemoWithCustomName()
@@ -1711,8 +1729,7 @@
//Create Xml representation of google code issue first
if (!CreateIssueXml())
{
- QMessageBox::warning(this, QMessageBox::tr("Fields required"),
- QMessageBox::tr("Please fill out all fields"));
+ ShowErrorMessage(QMessageBox::tr("Please fill out all fields"));
return;
}
@@ -1758,18 +1775,23 @@
if (authToken.length() != 0)
{
- QMessageBox::information(this, QMessageBox::tr("Success"),
- QMessageBox::tr("Successfully posted the issue on code.google.com!"));
+
+ QMessageBox infoMsg(this);
+ infoMsg.setIcon(QMessageBox::Information);
+ infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success"));
+ infoMsg.setText(QMessageBox::tr("Successfully posted the issue on hedgewars.googlecode.com"));
+ infoMsg.setWindowModality(Qt::WindowModal);
+ infoMsg.exec();
+
ui.pageFeedback->summary->clear();
ui.pageFeedback->description->clear();
authToken = "";
return;
}
- if(!getAuthToken(str))
+ if (!getAuthToken(str))
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error during authentication with www.google.com"));
+ ShowErrorMessage(QMessageBox::tr("Error during authentication at google.com"));
return;
}
@@ -1782,12 +1804,10 @@
}
else if (authToken.length() == 0)
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error during authentication with www.google.com"));
+ ShowErrorMessage(QMessageBox::tr("Error during authentication at google.com"));
else
{
- QMessageBox::warning(this, QMessageBox::tr("Network"),
- QMessageBox::tr("Error creating the issue"));
+ ShowErrorMessage(QMessageBox::tr("Error reporting the issue, please try again later (or visit hedgewars.googlecode.come directly)"));
authToken = "";
}
--- a/QTfrontend/main.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/main.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -91,10 +91,12 @@
if (!tmpdir.exists(dir))
if (!tmpdir.mkdir(dir))
{
- QMessageBox::critical(0,
- QObject::tr("Error"),
- QObject::tr("Cannot create directory %1").arg(dir),
- QObject::tr("OK"));
+ QMessageBox directoryMsg(QApplication::activeWindow());
+ directoryMsg.setIcon(QMessageBox::Warning);
+ directoryMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
+ directoryMsg.setText(QMessageBox::tr("Cannot create directory %1").arg(dir));
+ directoryMsg.setWindowModality(Qt::WindowModal);
+ directoryMsg.exec();
return false;
}
return true;
@@ -205,10 +207,14 @@
datadir->cd(*cDataDir);
if(!datadir->cd("hedgewars/Data"))
{
- QMessageBox::critical(0, QMessageBox::tr("Error"),
- QMessageBox::tr("Failed to open data directory:\n%1\n"
- "Please check your installation").
- arg(datadir->absolutePath()+"/hedgewars/Data"));
+ QMessageBox missingMsg(QApplication::activeWindow());
+ missingMsg.setIcon(QMessageBox::Critical);
+ missingMsg.setWindowTitle(QMessageBox::tr("Main - Error"));
+ missingMsg.setText(QMessageBox::tr("Failed to open data directory:\n%1\n\n"
+ "Please check your installation!").
+ arg(datadir->absolutePath()+"/hedgewars/Data"));
+ missingMsg.setWindowModality(Qt::WindowModal);
+ missingMsg.exec();
return 1;
}
--- a/QTfrontend/net/netserver.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/net/netserver.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -17,8 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <QMessageBox>
-
#include "hwconsts.h"
#include "netserver.h"
--- a/QTfrontend/net/recorder.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/net/recorder.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -18,7 +18,6 @@
#include <QString>
#include <QByteArray>
-//#include <QMessageBox>
#include "recorder.h"
#include "gameuiconfig.h"
--- a/QTfrontend/net/tcpBase.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/net/tcpBase.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -21,7 +21,7 @@
#include <QMessageBox>
#include <QList>
-
+#include <QApplication>
#include <QImage>
#include "hwconsts.h"
@@ -45,10 +45,14 @@
IPCServer->setMaxPendingConnections(1);
if (!IPCServer->listen(QHostAddress::LocalHost))
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to start the server: %1.")
- .arg(IPCServer->errorString()));
- exit(0); // FIXME - should be graceful exit here
+ QMessageBox deniedMsg(QApplication::activeWindow());
+ deniedMsg.setIcon(QMessageBox::Critical);
+ deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+ deniedMsg.setText(QMessageBox::tr("Unable to start the server: %1.").arg(IPCServer->errorString()));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
+ exit(0); // FIXME - should be graceful exit here (lower Critical -> Warning above when implemented)
}
}
ipc_port=IPCServer->serverPort();
@@ -113,9 +117,13 @@
void TCPBase::StartProcessError(QProcess::ProcessError error)
{
- QMessageBox::critical(0, tr("Error"),
- tr("Unable to run engine: %1 (")
- .arg(error) + bindir->absolutePath() + "/hwengine)");
+ QMessageBox deniedMsg(QApplication::activeWindow());
+ deniedMsg.setIcon(QMessageBox::Critical);
+ deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error"));
+ deniedMsg.setText(QMessageBox::tr("Unable to run engine at ") + bindir->absolutePath() + "/hwengine\n" +
+ QMessageBox::tr("Error code: %1").arg(error));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
ClientDisconnect();
}
--- a/QTfrontend/ui/dialog/upload_video.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/dialog/upload_video.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -32,7 +32,6 @@
#include <QMessageBox>
#include <QRegExp>
#include <QRegExpValidator>
-#include <QMessageBox>
#include "upload_video.h"
#include "hwconsts.h"
@@ -233,7 +232,14 @@
errorStr += QMessageBox::tr("Login or password is incorrect");
else
errorStr += reply->errorString();
- QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
+
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Video upload - Error"));
+ deniedMsg.setText(errorStr);
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
setEditable(true);
return;
}
@@ -288,7 +294,14 @@
{
QString errorStr = QMessageBox::tr("Error while sending metadata to youtube.com:\n");
errorStr += reply->errorString();
- QMessageBox::warning(this, QMessageBox::tr("Error"), errorStr);
+
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Video upload - Error"));
+ deniedMsg.setText(errorStr);
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
+
setEditable(true);
return;
}
--- a/QTfrontend/ui/page/AbstractPage.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/AbstractPage.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -25,7 +25,6 @@
#include <QLabel>
#include <QSize>
#include <QFontMetricsF>
-#include <QMessageBox>
#include "qpushbuttonwithsound.h"
--- a/QTfrontend/ui/page/pageeditteam.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -383,9 +383,14 @@
void PageEditTeam::deleteTeam(const QString & name)
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel, this);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Teams - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the team '%1'?").arg(name));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
HWTeam(name).deleteFile();
}
--- a/QTfrontend/ui/page/pagenet.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pagenet.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -108,7 +108,12 @@
QModelIndex mi = tvServersList->currentIndex();
if(!mi.isValid())
{
- QMessageBox::information(this, tr("Error"), tr("Please select server from the list above"));
+ QMessageBox serverMsg(this);
+ serverMsg.setIcon(QMessageBox::Warning);
+ serverMsg.setWindowTitle(QMessageBox::tr("Netgame - Error"));
+ serverMsg.setText(QMessageBox::tr("Please select a server from the list"));
+ serverMsg.setWindowModality(Qt::WindowModal);
+ serverMsg.exec();
return;
}
QString host = model->index(mi.row(), 1).data().toString();
--- a/QTfrontend/ui/page/pagenetgame.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pagenetgame.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -157,10 +157,12 @@
else
{
leRoomName->clear();
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please enter room name"),
- tr("OK"));
+ QMessageBox roomMsg(this);
+ roomMsg.setIcon(QMessageBox::Warning);
+ roomMsg.setWindowTitle(QMessageBox::tr("Netgame - Error"));
+ roomMsg.setText(QMessageBox::tr("Please enter room name"));
+ roomMsg.setWindowModality(Qt::WindowModal);
+ roomMsg.exec();
}
}
--- a/QTfrontend/ui/page/pageplayrecord.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pageplayrecord.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -120,10 +120,12 @@
QListWidgetItem * curritem = DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list"),
- tr("OK"));
+ QMessageBox recordMsg(this);
+ recordMsg.setIcon(QMessageBox::Warning);
+ recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ recordMsg.setText(QMessageBox::tr("Please select record from the list"));
+ recordMsg.setWindowModality(Qt::WindowModal);
+ recordMsg.exec();
return ;
}
QFile rfile(curritem->data(Qt::UserRole).toString());
@@ -144,7 +146,14 @@
ok = rfile.rename(newfullname);
if(!ok)
- QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname);
+ {
+ QMessageBox renameMsg(this);
+ renameMsg.setIcon(QMessageBox::Warning);
+ renameMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ renameMsg.setText(QMessageBox::tr("Cannot rename to ") + newfullname);
+ renameMsg.setWindowModality(Qt::WindowModal);
+ renameMsg.exec();
+ }
else
FillFromDir(recType);
}
@@ -155,10 +164,12 @@
QListWidgetItem * curritem = DemosList->currentItem();
if (!curritem)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select record from the list"),
- tr("OK"));
+ QMessageBox recordMsg(this);
+ recordMsg.setIcon(QMessageBox::Warning);
+ recordMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ recordMsg.setText(QMessageBox::tr("Please select record from the list"));
+ recordMsg.setWindowModality(Qt::WindowModal);
+ recordMsg.exec();
return ;
}
QFile rfile(curritem->data(Qt::UserRole).toString());
@@ -167,7 +178,14 @@
ok = rfile.remove();
if(!ok)
- QMessageBox::critical(this, tr("Error"), tr("Cannot delete file"));
+ {
+ QMessageBox removeMsg(this);
+ removeMsg.setIcon(QMessageBox::Warning);
+ removeMsg.setWindowTitle(QMessageBox::tr("Record Play - Error"));
+ removeMsg.setText(QMessageBox::tr("Cannot delete file ") + rfile.fileName());
+ removeMsg.setWindowModality(Qt::WindowModal);
+ removeMsg.exec();
+ }
else
{
int i = DemosList->row(curritem);
--- a/QTfrontend/ui/page/pageroomslist.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pageroomslist.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -424,10 +424,14 @@
if (roomName->text().size())
emit askForCreateRoom(roomName->text());
else
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please enter room name"),
- tr("OK"));
+ {
+ QMessageBox roomNameMsg(this);
+ roomNameMsg.setIcon(QMessageBox::Warning);
+ roomNameMsg.setWindowTitle(QMessageBox::tr("Room Name - Error"));
+ roomNameMsg.setText(QMessageBox::tr("Please enter room name"));
+ roomNameMsg.setWindowModality(Qt::WindowModal);
+ roomNameMsg.exec();
+ }
}
void PageRoomsList::onJoinClick()
@@ -436,10 +440,12 @@
if(mdl.size() != 1)
{
- QMessageBox::critical(this,
- tr("Error"),
- tr("Please select room from the list"),
- tr("OK"));
+ QMessageBox roomNameMsg(this);
+ roomNameMsg.setIcon(QMessageBox::Warning);
+ roomNameMsg.setWindowTitle(QMessageBox::tr("Room Name - Error"));
+ roomNameMsg.setText(QMessageBox::tr("Please select room from the list"));
+ roomNameMsg.setWindowModality(Qt::WindowModal);
+ roomNameMsg.exec();
return;
}
@@ -467,10 +473,15 @@
void PageRoomsList::onJoinConfirmation(const QString & room)
{
- if (QMessageBox::warning(this,
- tr("Warning"),
- tr("The game you are trying to join has started.\nDo you still want to join the room?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
+
+ QMessageBox reallyJoinMsg(this);
+ reallyJoinMsg.setIcon(QMessageBox::Question);
+ reallyJoinMsg.setWindowTitle(QMessageBox::tr("Room Name - Are you sure?"));
+ reallyJoinMsg.setText(QMessageBox::tr("The game you are trying to join has started.\nDo you still want to join the room?"));
+ reallyJoinMsg.setWindowModality(Qt::WindowModal);
+ reallyJoinMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyJoinMsg.exec() == QMessageBox::Ok)
{
emit askForJoinRoom(room);
}
--- a/QTfrontend/ui/page/pagescheme.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pagescheme.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -519,13 +519,23 @@
int numberOfDefaultSchemes = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes;
if (selectScheme->currentIndex() < numberOfDefaultSchemes)
{
- QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Cannot delete default scheme '%1'!").arg(selectScheme->currentText()));
+ QMessageBox deniedMsg(this);
+ deniedMsg.setIcon(QMessageBox::Warning);
+ deniedMsg.setWindowTitle(QMessageBox::tr("Schemes - Warning"));
+ deniedMsg.setText(QMessageBox::tr("Cannot delete default scheme '%1'!").arg(selectScheme->currentText()));
+ deniedMsg.setWindowModality(Qt::WindowModal);
+ deniedMsg.exec();
}
else
{
- QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel);
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Schemes - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the game scheme '%1'?").arg(selectScheme->currentText()));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
- if (reallyDelete.exec() == QMessageBox::Ok)
+ if (reallyDeleteMsg.exec() == QMessageBox::Ok)
{
QAbstractItemModel * model = mapper->model();
model->removeRow(selectScheme->currentIndex());
--- a/QTfrontend/ui/page/pagevideos.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/page/pagevideos.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -839,11 +839,14 @@
return;
// ask user if (s)he is serious
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do remove %1?").arg(item->name),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the video '%1'?").arg(item->name));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyDeleteMsg.exec() != QMessageBox::Ok)
return;
// remove
@@ -860,11 +863,14 @@
return;
// ask user if (s)he is serious
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do remove %1 file(s)?", "", num).arg(num),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ QMessageBox reallyDeleteMsg(this);
+ reallyDeleteMsg.setIcon(QMessageBox::Question);
+ reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to remove %1 file(s)?", "", num).arg(num));
+ reallyDeleteMsg.setWindowModality(Qt::WindowModal);
+ reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyDeleteMsg.exec() != QMessageBox::Ok)
return;
// remove
@@ -1081,11 +1087,15 @@
if (item->pUploading)
{
- if (QMessageBox::question(this,
- tr("Are you sure?"),
- tr("Do you really want do cancel uploading %1?").arg(item->name),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes)
+ // ask user if (s)he is serious
+ QMessageBox reallyStopMsg(this);
+ reallyStopMsg.setIcon(QMessageBox::Question);
+ reallyStopMsg.setWindowTitle(QMessageBox::tr("Videos - Are you sure?"));
+ reallyStopMsg.setText(QMessageBox::tr("Do you really want to cancel uploading %1?").arg(item->name));
+ reallyStopMsg.setWindowModality(Qt::WindowModal);
+ reallyStopMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+
+ if (reallyStopMsg.exec() != QMessageBox::Ok)
return;
item->pUploading->deleteLater();
filesTable->setCellWidget(row, vcProgress, NULL); // remove progress bar
--- a/QTfrontend/ui/widget/drawmapwidget.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/widget/drawmapwidget.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -95,7 +95,14 @@
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName));
+ {
+ QMessageBox errorMsg(this);
+ errorMsg.setIcon(QMessageBox::Warning);
+ errorMsg.setWindowTitle(QMessageBox::tr("File error"));
+ errorMsg.setText(QMessageBox::tr("Cannot open '%1' for writing").arg(fileName));
+ errorMsg.setWindowModality(Qt::WindowModal);
+ errorMsg.exec();
+ }
else
file.write(qCompress(m_scene->encode()).toBase64());
}
@@ -108,7 +115,14 @@
QFile f(fileName);
if(!f.open(QIODevice::ReadOnly))
- QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName));
+ {
+ QMessageBox errorMsg(this);
+ errorMsg.setIcon(QMessageBox::Warning);
+ errorMsg.setWindowTitle(QMessageBox::tr("File error"));
+ errorMsg.setText(QMessageBox::tr("Cannot open '%1' for reading").arg(fileName));
+ errorMsg.setWindowModality(Qt::WindowModal);
+ errorMsg.exec();
+ }
else
m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
}
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -270,7 +270,14 @@
{
bool illegal = ammo.size() != cDefaultAmmoStore->size();
if (illegal)
- QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme"));
+ {
+ QMessageBox illegalMsg(this);
+ illegalMsg.setIcon(QMessageBox::Warning);
+ illegalMsg.setWindowTitle(QMessageBox::tr("Error"));
+ illegalMsg.setText(QMessageBox::tr("Cannot use the ammo '%1'!").arg(name));
+ illegalMsg.setWindowModality(Qt::WindowModal);
+ illegalMsg.exec();
+ }
int pos = WeaponsName->findText(name);
if ((pos == -1) || illegal) // prevent from overriding schemes with bad ones
--- a/QTfrontend/ui/widget/mapContainer.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -29,7 +29,6 @@
#include <QVBoxLayout>
#include <QIcon>
#include <QLineEdit>
-#include <QMessageBox>
#include <QStringListModel>
#include "hwconsts.h"
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <QMessageBox>
#include <QDir>
#include "qpushbuttonwithsound.h"
--- a/QTfrontend/util/libav_iteraction.cpp Tue Oct 23 05:21:44 2012 +0200
+++ b/QTfrontend/util/libav_iteraction.cpp Tue Oct 23 06:50:19 2012 +0200
@@ -27,7 +27,6 @@
#include <QVector>
#include <QList>
-#include <QMessageBox>
#include <QComboBox>
#include "HWApplication.h"