forked from qt-creator/qt-creator
Maemo: Link to OpenGL settings page on Qemu crash.
This commit is contained in:
@@ -30,8 +30,9 @@
|
||||
#include "maemoqemumanager.h"
|
||||
|
||||
#include "maemoglobal.h"
|
||||
#include "maemomanager.h"
|
||||
#include "maemoqemuruntimeparser.h"
|
||||
#include "maemoqemusettings.h"
|
||||
#include "maemosettingspages.h"
|
||||
#include "maemorunconfiguration.h"
|
||||
#include "maemotoolchain.h"
|
||||
#include "qtversionmanager.h"
|
||||
@@ -406,45 +407,27 @@ void MaemoQemuManager::qemuProcessError(QProcess::ProcessError error)
|
||||
|
||||
void MaemoQemuManager::qemuStatusChanged(QemuStatus status, const QString &error)
|
||||
{
|
||||
QString message;
|
||||
bool running = false;
|
||||
|
||||
switch (status) {
|
||||
case QemuStarting:
|
||||
running = true;
|
||||
break;
|
||||
case QemuFailedToStart:
|
||||
message = tr("Qemu failed to start: %1").arg(error);
|
||||
QMessageBox::warning(0, tr("Qemu error"),
|
||||
tr("Qemu failed to start: %1"));
|
||||
break;
|
||||
case QemuCrashed: {
|
||||
const MaemoQemuSettings::OpenGlMode openGlMode
|
||||
= MaemoQemuSettings::openGlMode();
|
||||
message = tr("Qemu crashed.");
|
||||
|
||||
// TODO: Provide a link to the settings page (how?).
|
||||
if (openGlMode == MaemoQemuSettings::HardwareAcceleration) {
|
||||
message += tr("\nYou have configured Qemu to use OpenGL "
|
||||
"hardware acceleration, which might not be supported by "
|
||||
"your system. You could try using software rendering instead.");
|
||||
} else if (openGlMode == MaemoQemuSettings::AutoDetect) {
|
||||
message += tr("\nQemu is currently configured to auto-detect the "
|
||||
"OpenGl mode, which is known to not work in some cases."
|
||||
"You might want to use software rendering instead");
|
||||
}
|
||||
case QemuCrashed:
|
||||
MaemoManager::instance().qemuSettingsPage()->showQemuCrashDialog();
|
||||
break;
|
||||
}
|
||||
case QemuFinished:
|
||||
message = error;
|
||||
break;
|
||||
case QemuUserReason:
|
||||
message = error;
|
||||
if (!error.isEmpty())
|
||||
QMessageBox::warning(0, tr("Qemu error"), error);
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(!"Missing handling of Qemu status");
|
||||
}
|
||||
|
||||
if (!message.isEmpty())
|
||||
QMessageBox::warning(0, tr("Qemu error"), message);
|
||||
updateStarterIcon(running);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,17 @@
|
||||
|
||||
#include "maemoconstants.h"
|
||||
#include "maemodeviceconfigurationssettingswidget.h"
|
||||
#include "maemoqemusettings.h"
|
||||
#include "maemoqemusettingswidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QFrame>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
@@ -163,5 +171,68 @@ void MaemoQemuSettingsPage::finish()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
class MaemoQemuCrashDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MaemoQemuCrashDialog(MaemoQemuSettingsPage *settingsPage)
|
||||
: m_settingsPage(settingsPage)
|
||||
{
|
||||
setWindowTitle(tr("Qemu error"));
|
||||
QString message = tr("Qemu crashed.");
|
||||
const MaemoQemuSettings::OpenGlMode openGlMode
|
||||
= MaemoQemuSettings::openGlMode();
|
||||
const QString linkString = QLatin1String("<p><a href=\"dummy\">")
|
||||
+ tr("Click here to change the OpenGL mode.")
|
||||
+ QLatin1String("</a>");
|
||||
if (openGlMode == MaemoQemuSettings::HardwareAcceleration) {
|
||||
message += tr("<p>You have configured Qemu to use OpenGL "
|
||||
"hardware acceleration, which might not be supported by "
|
||||
"your system. You could try using software rendering instead.");
|
||||
message += linkString;
|
||||
} else if (openGlMode == MaemoQemuSettings::AutoDetect) {
|
||||
message += tr("<p>Qemu is currently configured to auto-detect the "
|
||||
"OpenGL mode, which is known to not work in some cases."
|
||||
"You might want to use software rendering instead.");
|
||||
message += linkString;
|
||||
}
|
||||
QLabel * const messageLabel = new QLabel(message, this);
|
||||
messageLabel->setWordWrap(true);
|
||||
messageLabel->setTextFormat(Qt::RichText);
|
||||
connect(messageLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showSettingsPage()));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->addWidget(messageLabel);
|
||||
QFrame * const separator = new QFrame;
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
separator->setFrameShadow(QFrame::Sunken);
|
||||
mainLayout->addWidget(separator);
|
||||
QDialogButtonBox * const buttonBox = new QDialogButtonBox;
|
||||
buttonBox->addButton(QDialogButtonBox::Ok);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
mainLayout->addWidget(buttonBox);
|
||||
}
|
||||
|
||||
private:
|
||||
Q_SLOT void showSettingsPage()
|
||||
{
|
||||
Core::ICore::instance()->showOptionsDialog(m_settingsPage->category(),
|
||||
m_settingsPage->id());
|
||||
accept();
|
||||
}
|
||||
|
||||
MaemoQemuSettingsPage * const m_settingsPage;
|
||||
};
|
||||
|
||||
|
||||
void MaemoQemuSettingsPage::showQemuCrashDialog()
|
||||
{
|
||||
MaemoQemuCrashDialog dlg(this);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#include "maemosettingspages.moc"
|
||||
|
||||
@@ -89,6 +89,8 @@ public:
|
||||
virtual void apply();
|
||||
virtual void finish();
|
||||
|
||||
void showQemuCrashDialog();
|
||||
|
||||
private:
|
||||
QString m_keywords;
|
||||
MaemoQemuSettingsWidget *m_widget;
|
||||
|
||||
Reference in New Issue
Block a user