|
@@ -18,6 +18,7 @@
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
#include <QGraphicsBlurEffect>
|
|
|
#include <QFont>
|
|
|
+#include <QFontDatabase>
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint),
|
|
@@ -25,6 +26,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
{
|
|
|
setObjectName("ApplicationMainWindow");
|
|
|
ui->setupUi(this);
|
|
|
+ currently_active_entry = ui->menuentry_1;
|
|
|
+ currently_hover_entry = nullptr;
|
|
|
+
|
|
|
qDebug() << "Initialising Settings module";
|
|
|
QSettings *settings = new QSettings(qApp->applicationDirPath() + "/legacy_v2.ini", QSettings::IniFormat);
|
|
|
|
|
@@ -117,25 +121,39 @@ void MainWindow::resizeEvent(QResizeEvent * event)
|
|
|
int height = event->size().height();
|
|
|
|
|
|
double dpi = qApp->desktop()->physicalDpiX();
|
|
|
+ dpi = 96;
|
|
|
const double default_dpi = 96;
|
|
|
qDebug() << "DPI IS" << dpi;
|
|
|
|
|
|
window_width = width;
|
|
|
window_height = height;
|
|
|
|
|
|
+ pixels_in_12_pt = floor(default_pixels_in_12_pt * window_width * dpi / (default_window_width * default_dpi)+ 0.0001);
|
|
|
pixels_in_11_pt = floor(default_pixels_in_11_pt * window_width * dpi / (default_window_width * default_dpi)+ 0.0001);
|
|
|
pixels_in_10_pt = floor(default_pixels_in_10_pt * window_width * dpi / (default_window_width * default_dpi) + 0.0001);
|
|
|
pixels_in_9_pt = floor(default_pixels_in_9_pt * window_width * dpi / (default_window_width * default_dpi) + 0.0001);
|
|
|
pixels_in_8_pt = floor(default_pixels_in_8_pt * window_width * dpi / (default_window_width * default_dpi) + 0.0001);
|
|
|
+ pixels_in_7_pt = floor(default_pixels_in_7_pt * window_width * dpi / (default_window_width * default_dpi) + 0.0001);
|
|
|
+ pixels_in_6_pt = floor(default_pixels_in_6_pt * window_width * dpi / (default_window_width * default_dpi) + 0.0001);
|
|
|
+
|
|
|
+// qDebug() << "AAAAAAAAAAAAAA: " << pixels_in_6_pt << " " << pixels_in_7_pt << " " << pixels_in_8_pt << " " << pixels_in_9_pt << " " << pixels_in_10_pt << " " << pixels_in_11_pt << " " << pixels_in_12_pt;
|
|
|
|
|
|
- ui->menu_widget->move(width * 320 / 1000, height * 34 / 648);
|
|
|
- ui->menu_widget->resize(width * 650 / 1000, height * 53 / 648);
|
|
|
+// QMessageBox::information(nullptr, "DEBUG INFO",
|
|
|
+// "Window:" + QString::number(window_width) + "x" + QString::number(window_height) + "\n" +
|
|
|
+// "Screen:" + QString::number(qApp->desktop()->screenGeometry().width()) + "x" + QString::number(qApp->desktop()->screenGeometry().height()) + "\n" +
|
|
|
+// "DPI: " + QString::number(dpi) + "\n" +
|
|
|
+// "PixelsIn12Pt: " + QString::number(pixels_in_12_pt));
|
|
|
|
|
|
- ui->content_area->move(0, height * 110 / 648);
|
|
|
- ui->content_area->resize(width * 1000 / 1000, height * 538 / 648);
|
|
|
+ ui->menu_widget->move(width * 320 / default_window_width, height * 34 / default_window_height);
|
|
|
+ ui->menu_widget->resize(width * 650 / default_window_width, height * 53 / default_window_height);
|
|
|
+
|
|
|
+ ui->content_area->move(0, height * 110 / default_window_height);
|
|
|
+ ui->content_area->resize(width * 1000 / default_window_width, height * 538 / default_window_height);
|
|
|
setupWindowBackgroundAndMask(current_bg);
|
|
|
choose_locale_dialog->resize(event->size());
|
|
|
|
|
|
+ ui->closeButton->setMinimumSize(width * 20 / default_window_width, height * 20 / default_window_height);
|
|
|
+ ui->minimizeButton->setMinimumSize(width * 20 / default_window_width, height * 20 / default_window_height);
|
|
|
updateFontSizes();
|
|
|
}
|
|
|
|
|
@@ -186,31 +204,38 @@ MainWindow::~MainWindow()
|
|
|
|
|
|
void MainWindow::on_menuentry_1_clicked()
|
|
|
{
|
|
|
+ currently_active_entry = ui->menuentry_1;
|
|
|
hideAllContentWidgets();
|
|
|
status_widget->show();
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_2_clicked()
|
|
|
{
|
|
|
+ currently_active_entry = ui->menuentry_2;
|
|
|
hideAllContentWidgets();
|
|
|
- settings_widget->show();
|
|
|
+ rusification_widget->show();
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_3_clicked()
|
|
|
{
|
|
|
+ currently_active_entry = ui->menuentry_3;
|
|
|
hideAllContentWidgets();
|
|
|
- rusification_widget->show();
|
|
|
+ settings_widget->show();
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_menuentry_4_clicked()
|
|
|
{
|
|
|
+ currently_active_entry = ui->menuentry_4;
|
|
|
hideAllContentWidgets();
|
|
|
help_widget->show();
|
|
|
}
|
|
|
|
|
|
-void MainWindow::onHoverMenuentry()
|
|
|
+void MainWindow::onHoverMenuentry(MenuEntry *hovered_entry)
|
|
|
{
|
|
|
- moveMenuHoverWidget(MenuEntry::getHoverLabel());
|
|
|
+ if (currently_hover_entry != hovered_entry) {
|
|
|
+ currently_hover_entry = hovered_entry;
|
|
|
+ moveMenuHoverWidget(hovered_entry);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void MainWindow::setupWindowBackgroundAndMask(QPixmap background)
|
|
@@ -234,15 +259,15 @@ void MainWindow::makeConnections()
|
|
|
void MainWindow::setupMenuHoverWidget()
|
|
|
{
|
|
|
menuHoverWidget = new QWidget(ui->menu_widget);
|
|
|
- menuHoverWidget->setStyleSheet("background-color: rgba(55, 37, 31, 250);");
|
|
|
+ menuHoverWidget->setStyleSheet("background-color: rgba(55, 37, 31, 230);");
|
|
|
menuHoverWidget->resize(0, 0);
|
|
|
|
|
|
- connect(ui->menuentry_1, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
|
|
|
- connect(ui->menuentry_2, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
|
|
|
- connect(ui->menuentry_3, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
|
|
|
- connect(ui->menuentry_4, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
|
|
|
+ connect(ui->menuentry_1, &MenuEntry::entryIsHovered, this, &MainWindow::onHoverMenuentry);
|
|
|
+ connect(ui->menuentry_2, &MenuEntry::entryIsHovered, this, &MainWindow::onHoverMenuentry);
|
|
|
+ connect(ui->menuentry_3, &MenuEntry::entryIsHovered, this, &MainWindow::onHoverMenuentry);
|
|
|
+ connect(ui->menuentry_4, &MenuEntry::entryIsHovered, this, &MainWindow::onHoverMenuentry);
|
|
|
|
|
|
- MenuEntry::setActiveLabel(ui->menuentry_1);
|
|
|
+ currently_active_entry = ui->menuentry_1;
|
|
|
menu_hover_checker_timer.setInterval(500);
|
|
|
connect(&menu_hover_checker_timer, &QTimer::timeout, this, &MainWindow::checkMenuIsHovered);
|
|
|
menu_hover_checker_timer.start();
|
|
@@ -277,8 +302,8 @@ void MainWindow::checkMenuIsHovered()
|
|
|
QWidget *hovered = qApp->widgetAt(pos);
|
|
|
if (!hovered || hovered->objectName().size() < 4 ||
|
|
|
(hovered->objectName().left(9) != "menuentry" && hovered->objectName() != "menu_widget")) {
|
|
|
- moveMenuHoverWidget(MenuEntry::getActiveLabel());
|
|
|
- MenuEntry::setHoverLabel(nullptr);
|
|
|
+ moveMenuHoverWidget(currently_active_entry);
|
|
|
+ currently_hover_entry = nullptr;
|
|
|
}
|
|
|
}
|
|
|
|