parent
b273a449e3
commit
cd03e1fc74
|
@ -1042,15 +1042,15 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
if (Utilities::ProcessTranslated()) {
|
if (Utilities::ProcessTranslated()) {
|
||||||
QErrorMessage *error_message = new QErrorMessage;
|
s.beginGroup(kSettingsGroup);
|
||||||
error_message->setAttribute(Qt::WA_DeleteOnClose);
|
const bool ignore_rosetta = s.value("ignore_rosetta", false).toBool();
|
||||||
error_message->resize(600, 220);
|
s.endGroup();
|
||||||
Utilities::CenterWidgetOnScreen(Utilities::GetScreen(this), error_message);
|
if (!ignore_rosetta) {
|
||||||
error_message->showMessage(tr("It is detected that Strawberry is running under Rosetta. Strawberry currently have limited macOS support, and running Strawberry under Rosetta is unsupported and known to have issues. If you want to use Strawberry on the current CPU, you should build Strawberry from source. For instructions see.: https://wiki.strawberrymusicplayer.org/wiki/Compile"));
|
MessageDialog *rosetta_message = new MessageDialog(this);
|
||||||
for (QObject *obj : error_message->children()) {
|
rosetta_message->set_settings_group(kSettingsGroup);
|
||||||
if (QCheckBox *checkbox = qobject_cast<QCheckBox*>(obj)) {
|
rosetta_message->set_do_not_show_message_again("ignore_rosetta");
|
||||||
checkbox->hide();
|
rosetta_message->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("It is detected that Strawberry is running under Rosetta. Strawberry currently have limited macOS support, and running Strawberry under Rosetta is unsupported and known to have issues. If you want to use Strawberry on the current CPU, you should build Strawberry from source. For instructions see.: https://wiki.strawberrymusicplayer.org/wiki/Compile"), IconLoader::Load("dialog-warning"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,16 +22,19 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QIcon>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "utilities/screenutils.h"
|
||||||
#include "messagedialog.h"
|
#include "messagedialog.h"
|
||||||
#include "ui_messagedialog.h"
|
#include "ui_messagedialog.h"
|
||||||
|
|
||||||
MessageDialog::MessageDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_MessageDialog) {
|
MessageDialog::MessageDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_MessageDialog), parent_(parent) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
|
@ -45,6 +48,31 @@ MessageDialog::MessageDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_Mess
|
||||||
|
|
||||||
MessageDialog::~MessageDialog() { delete ui_; }
|
MessageDialog::~MessageDialog() { delete ui_; }
|
||||||
|
|
||||||
|
void MessageDialog::ShowMessage(const QString &title, const QString &message, const QIcon &icon) {
|
||||||
|
|
||||||
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
if (!icon.isNull()) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
const QPixmap pixmap = icon.pixmap(QSize(64, 64), devicePixelRatioF());
|
||||||
|
#else
|
||||||
|
const QPixmap pixmap = icon.pixmap(QSize(64, 64));
|
||||||
|
#endif
|
||||||
|
ui_->label_logo->setPixmap(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_->label_text->setText(message);
|
||||||
|
ui_->label_text->adjustSize();
|
||||||
|
adjustSize();
|
||||||
|
|
||||||
|
if (parent_) {
|
||||||
|
Utilities::CenterWidgetOnScreen(Utilities::GetScreen(parent_), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MessageDialog::DoNotShowMessageAgain() {
|
void MessageDialog::DoNotShowMessageAgain() {
|
||||||
|
|
||||||
if (!settings_group_.isEmpty() && !do_not_show_message_again_.isEmpty()) {
|
if (!settings_group_.isEmpty() && !do_not_show_message_again_.isEmpty()) {
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#define MESSAGEDIALOG_H
|
#define MESSAGEDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QString>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
class Ui_MessageDialog;
|
class Ui_MessageDialog;
|
||||||
|
|
||||||
|
@ -34,11 +36,14 @@ class MessageDialog : public QDialog {
|
||||||
void set_settings_group(const QString &settings_group) { settings_group_ = settings_group; }
|
void set_settings_group(const QString &settings_group) { settings_group_ = settings_group; }
|
||||||
void set_do_not_show_message_again(const QString &do_not_show_message_again) { do_not_show_message_again_ = do_not_show_message_again; }
|
void set_do_not_show_message_again(const QString &do_not_show_message_again) { do_not_show_message_again_ = do_not_show_message_again; }
|
||||||
|
|
||||||
|
void ShowMessage(const QString &title, const QString &message, const QIcon &icon = QIcon());
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void DoNotShowMessageAgain();
|
void DoNotShowMessageAgain();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ui_MessageDialog *ui_;
|
Ui_MessageDialog *ui_;
|
||||||
|
QWidget *parent_;
|
||||||
QString settings_group_;
|
QString settings_group_;
|
||||||
QString do_not_show_message_again_;
|
QString do_not_show_message_again_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue