|
@@ -64,8 +64,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
hideAllContentWidgets();
|
|
|
status_widget->show();
|
|
|
|
|
|
- qDebug() << "Making fonts and making background";
|
|
|
- changeFontSizeRecursive(100, this);
|
|
|
+ qDebug() << "Making background";
|
|
|
|
|
|
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
|
|
|
current_bg_id = qrand() % MAX_PIXMAP_ID + 1;
|
|
@@ -89,6 +88,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
qDebug() << "Installing event filters to clickable objects";
|
|
|
setEventFilterRecursive(this);
|
|
|
|
|
|
+ qDebug() << "Adopting elements and fonts to window size";
|
|
|
+ resize(size());
|
|
|
+
|
|
|
+
|
|
|
qDebug() << "Finishing main frame initialisation";
|
|
|
show();
|
|
|
}
|
|
@@ -115,14 +118,14 @@ void MainWindow::resizeEvent(QResizeEvent * event)
|
|
|
int width = event->size().width();
|
|
|
int height = event->size().height();
|
|
|
|
|
|
- ui->menu_widget->move(width * 300 / 900, height * 35 / 650);
|
|
|
- ui->menu_widget->resize(width * 570 / 900, height * 50 / 650);
|
|
|
+ ui->menu_widget->move(width * 320 / 1000, height * 34 / 648);
|
|
|
+ ui->menu_widget->resize(width * 650 / 1000, height * 53 / 648);
|
|
|
|
|
|
- ui->content_area->move(0, height * 110 / 650);
|
|
|
- ui->content_area->resize(width * 900 / 900, height * 515 / 650);
|
|
|
+ ui->content_area->move(0, height * 110 / 648);
|
|
|
+ ui->content_area->resize(width * 1000 / 1000, height * 520 / 648);
|
|
|
setupWindowBackgroundAndMask(current_bg);
|
|
|
-// choose_locale_dialog->move(this->rect().center() - choose_locale_dialog->rect().center());
|
|
|
choose_locale_dialog->resize(size());
|
|
|
+ changeFontSizeRecursive(100, this);
|
|
|
}
|
|
|
|
|
|
void MainWindow::randomChangeBackground()
|
|
@@ -145,16 +148,18 @@ void MainWindow::randomChangeBackground()
|
|
|
|
|
|
QtConcurrent::run([cur_bg, new_bg, this](){
|
|
|
const int iterations_num = 150;
|
|
|
- const int iteration_sleep = 75;
|
|
|
+ const int iteration_sleep = 17;
|
|
|
+ const int starting_opacity_percent = 50;
|
|
|
|
|
|
- for (int i = 0; i < iterations_num && qApp; i++) {
|
|
|
+ for (int i = 0; i < iterations_num - starting_opacity_percent && qApp; i++) {
|
|
|
+ QPixmap composited_bg(*cur_bg);
|
|
|
QPainter painter;
|
|
|
- painter.begin(cur_bg);
|
|
|
- painter.setOpacity(double(10 + i) / double(iterations_num));
|
|
|
+ painter.begin(&composited_bg);
|
|
|
+ painter.setOpacity(double(starting_opacity_percent + i) / double(iterations_num));
|
|
|
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
|
|
painter.drawPixmap(0,0, *new_bg);
|
|
|
painter.end();
|
|
|
- QMetaObject::invokeMethod(this, "setupWindowBackgroundAndMask", Qt::QueuedConnection, Q_ARG(QPixmap, *cur_bg));
|
|
|
+ QMetaObject::invokeMethod(this, "setupWindowBackgroundAndMask", Qt::QueuedConnection, Q_ARG(QPixmap, composited_bg));
|
|
|
QThread::msleep(iteration_sleep);
|
|
|
}
|
|
|
delete cur_bg;
|
|
@@ -278,11 +283,12 @@ void MainWindow::changeFontSizeRecursive(size_t percent, QWidget *widget)
|
|
|
{
|
|
|
if (!widget)
|
|
|
return;
|
|
|
+
|
|
|
QFont widget_font = widget->font();
|
|
|
QString widget_name = widget->objectName();
|
|
|
|
|
|
if (widget_name.contains("menuentry"))
|
|
|
- widget_font.setPixelSize(small_font_size * percent / 100);
|
|
|
+ widget_font.setPixelSize(menuentry_font_size * percent / 100);
|
|
|
if (widget_name.contains("_small"))
|
|
|
widget_font.setPixelSize(small_font_size * percent / 100);
|
|
|
if (widget_name.contains("_common"))
|
|
@@ -300,7 +306,6 @@ void MainWindow::changeFontSizeRecursive(size_t percent, QWidget *widget)
|
|
|
if (child->isWidgetType()) {
|
|
|
QWidget* w = qobject_cast<QWidget *>(child);
|
|
|
changeFontSizeRecursive(percent, w);
|
|
|
- w->resize(w->sizeHint());
|
|
|
}
|
|
|
}
|
|
|
|