From 25646e3bd50fa4acd320d96e48beeebfc31d88fc Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 13 Dec 2020 23:52:08 +1000
Subject: Disable Fusion style for Haiku


diff --git a/main.cpp b/main.cpp
index 0b3119b..a119d1f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -17,8 +17,9 @@ int main(int argc, char *argv[])
 
     qRegisterMetaType<u64>("u64");
     qRegisterMetaType<address_t>("address_t");
+#ifndef Q_OS_HAIKU
     QApplication::setStyle(QStyleFactory::create("Fusion"));
-
+#endif
     QApplication a(argc, argv);
     a.setOrganizationName("redasm.io");
     a.setApplicationName("redasm");
-- 
2.28.0


From fb8618ceb0f62f43e5b353ce727242e68dac393c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 13 Dec 2020 23:52:25 +1000
Subject: Fix build for Qt 5.15


diff --git a/widgets/disassemblerlistingview/disassemblercolumnview.cpp b/widgets/disassemblerlistingview/disassemblercolumnview.cpp
index 2d42b87..258f3de 100644
--- a/widgets/disassemblerlistingview/disassemblercolumnview.cpp
+++ b/widgets/disassemblerlistingview/disassemblercolumnview.cpp
@@ -1,6 +1,7 @@
 #include "disassemblercolumnview.h"
 #include "../../themeprovider.h"
 #include <QPainter>
+#include <QPainterPath>
 
 DisassemblerColumnView::DisassemblerColumnView(QWidget *parent) : QWidget(parent), m_disassembler(nullptr), m_first(-1), m_last(-1)
 {
-- 
2.28.0


From c48e2da26c5a205d6ff6c814fae2341df3ce36ac Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 14 Dec 2020 10:32:14 +1000
Subject: Fix for mono font


diff --git a/dialogs/settingsdialog/settingsdialog.cpp b/dialogs/settingsdialog/settingsdialog.cpp
index 03a3bd2..04ddc1c 100644
--- a/dialogs/settingsdialog/settingsdialog.cpp
+++ b/dialogs/settingsdialog/settingsdialog.cpp
@@ -8,8 +8,11 @@ SettingsDialog::SettingsDialog(QWidget *parent): QDialog(parent), ui(new Ui::Set
 {
     ui->setupUi(this);
     ui->cbTheme->addItems(ThemeProvider::themes());
+#ifdef Q_OS_HAIKU
+    ui->fcbFonts->setFontFilters(QFontComboBox::AllFonts);
+#else
     ui->fcbFonts->setFontFilters(QFontComboBox::MonospacedFonts);
-
+#endif
     auto sizes = QFontDatabase::standardSizes();
 
     for(int size : sizes)
@@ -75,6 +78,12 @@ void SettingsDialog::updatePreview()
 
 void SettingsDialog::selectDefaultFont()
 {
+#ifdef Q_OS_HAIKU
+    QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+    ui->fcbFonts->setCurrentFont(font);
+	float kDPI = 96.0 / 70.0;
+    int size = QFontDatabase::systemFont(QFontDatabase::FixedFont).pointSize() * kDPI;
+#else
     QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
     ui->fcbFonts->setCurrentFont(font);
 
@@ -82,7 +91,7 @@ void SettingsDialog::selectDefaultFont()
 
     if(size == -1)
         size = qApp->fontMetrics().height();
-
+#endif
     this->selectSize(size);
 }
 
diff --git a/redasmsettings.cpp b/redasmsettings.cpp
index de5689f..7271679 100644
--- a/redasmsettings.cpp
+++ b/redasmsettings.cpp
@@ -52,11 +52,15 @@ QFont REDasmSettings::currentFont() const { return this->value("selected_font",
 
 int REDasmSettings::currentFontSize() const
 {
+#ifdef Q_OS_HAIKU
+	float kDPI = 96.0 / 70.0;
+    int size = QFontDatabase::systemFont(QFontDatabase::FixedFont).pointSize() * kDPI;
+#else
     int size = qApp->font().pixelSize();
 
     if(size == -1)
         size = qApp->fontMetrics().height();
-
+#endif
     return this->value("selected_font_size", size).toInt();
 }
 
@@ -68,7 +72,7 @@ QFont REDasmSettings::font()
 {
     REDasmSettings settings;
     QFont f = settings.currentFont();
-
+#ifndef Q_OS_HAIKU
     if(!(f.styleHint() & QFont::Monospace))
     {
         f.setFamily("Monospace"); // Force Monospaced font
@@ -76,5 +80,8 @@ QFont REDasmSettings::font()
     }
 
     f.setPointSize(settings.currentFontSize());
+#else
+    f.setPixelSize(settings.currentFontSize());
+#endif
     return f;
 }
-- 
2.28.0

