Merge pull request #2111 from Cacodemon345/newqt

qt: Windows fixes
This commit is contained in:
Miran Grča
2022-02-12 19:54:55 +01:00
committed by GitHub
2 changed files with 7 additions and 12 deletions

View File

@@ -43,6 +43,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
#include "qt_winrawinputfilter.hpp" #include "qt_winrawinputfilter.hpp"
#include "qt_winmanagerfilter.hpp" #include "qt_winmanagerfilter.hpp"
#include <86box/win.h> #include <86box/win.h>
#include <Shobjidl.h>
#endif #endif
extern "C" extern "C"
@@ -165,6 +166,7 @@ int main(int argc, char* argv[]) {
auto font_name = QObject::tr("FONT_NAME"); auto font_name = QObject::tr("FONT_NAME");
auto font_size = QObject::tr("FONT_SIZE"); auto font_size = QObject::tr("FONT_SIZE");
QApplication::setFont(QFont(font_name, font_size.toInt())); QApplication::setFont(QFont(font_name, font_size.toInt()));
SetCurrentProcessExplicitAppUserModelID(L"86Box.86Box");
#endif #endif
if (! pc_init_modules()) { if (! pc_init_modules()) {
ui_msgbox_header(MBX_FATAL, (void*)IDS_2120, (void*)IDS_2056); ui_msgbox_header(MBX_FATAL, (void*)IDS_2120, (void*)IDS_2056);

View File

@@ -67,10 +67,6 @@ extern "C" {
#include <array> #include <array>
#include <unordered_map> #include <unordered_map>
#ifdef Q_OS_WINDOWS
#include <Shobjidl.h>
#endif
#include "qt_settings.hpp" #include "qt_settings.hpp"
#include "qt_machinestatus.hpp" #include "qt_machinestatus.hpp"
#include "qt_mediamenu.hpp" #include "qt_mediamenu.hpp"
@@ -93,14 +89,6 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
#ifdef Q_OS_WINDOWS
SetCurrentProcessExplicitAppUserModelID(L"86Box.86Box");
auto font_name = tr("FONT_NAME");
auto font_size = tr("FONT_SIZE");
QApplication::setFont(QFont(font_name, font_size.toInt()));
#endif
mm = std::make_shared<MediaMenu>(this); mm = std::make_shared<MediaMenu>(this);
MediaMenu::ptr = mm; MediaMenu::ptr = mm;
status = std::make_unique<MachineStatus>(this); status = std::make_unique<MachineStatus>(this);
@@ -138,6 +126,11 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection); connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection);
connect(this, &MainWindow::setTitle, this, [this,toolbar_label](const QString& title) { connect(this, &MainWindow::setTitle, this, [this,toolbar_label](const QString& title) {
if (dopause && !hide_tool_bar)
{
toolbar_label->setText(toolbar_label->text() + " - PAUSED -");
return;
}
if (!hide_tool_bar) if (!hide_tool_bar)
#ifdef _WIN32 #ifdef _WIN32
toolbar_label->setText(title); toolbar_label->setText(title);