Browse Source

Complete Legacy status widget redesign, added multiplatform scaling

Ivan Arkhipov 5 years ago
parent
commit
e69efa1bef

+ 1 - 0
build_res.pri

@@ -11,6 +11,7 @@ exists($$BIN_PATH/res) {
 EXT_RES =                                                                   \
     "$${PROJECT_ROOT_PATH}/resources/backgrounds.qrc            -o $$BIN_PATH/data01.gtr"     \
     "$${PROJECT_ROOT_PATH}/resources/common.qrc                 -o $$BIN_PATH/data02.gtr"     \
+    "$${PROJECT_ROOT_PATH}/resources/backgrounds_advanced.qrc   -o $$BIN_PATH/data_adv.gtr"
 
 for (RES, EXT_RES) {
     win32 {

+ 1 - 1
src/Legacy-advanced/Legacy-advanced.pro

@@ -73,7 +73,7 @@ LIBS += -llibzlibstatic
 
 CONFIG(debug, debug|release) {
         RESOURCES += \
-                $${PROJECT_ROOT_PATH}/resources/backgrounds.qrc \
+                $${PROJECT_ROOT_PATH}/resources/backgrounds_advanced.qrc \
                 $${PROJECT_ROOT_PATH}/resources/common.qrc
 } else {
         include(../../build_res.pri)

+ 1 - 1
src/Legacy-advanced/main.cpp

@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
     }
 
     qDebug() << "Registering resources";
-    QResource::registerResource(QApplication::applicationDirPath() + "/data01.gtr");
+    QResource::registerResource(QApplication::applicationDirPath() + "/data_adv.gtr");
     QResource::registerResource(QApplication::applicationDirPath() + "/data02.gtr");
 
     QFontDatabase::addApplicationFont(":/assets/fonts/trajan.ttf");

+ 1 - 1
src/Legacy-advanced/object_script.Legacy-advanced.Debug

@@ -1,5 +1,5 @@
 INPUT(
-./..\..\build\debug\Legacy-advanced\rcc\qrc_backgrounds.o
+./..\..\build\debug\Legacy-advanced\rcc\qrc_backgrounds_advanced.o
 ./..\..\build\debug\Legacy-advanced\rcc\qrc_common.o
 ./..\..\build\debug\Legacy-advanced\obj\main.o
 ./..\..\build\debug\Legacy-advanced\obj\downloader.o

+ 4 - 9
src/Legacy/Legacy.pro

@@ -25,15 +25,12 @@ SOURCES += \
     widgets/rusificationwidget.cpp \
     widgets/settingswidget.cpp \
     widgets/statuswidget.cpp \
-    widgets/weeklycodewidget.cpp \
     widgets/newslistwidget.cpp \
     widgets/newspiece.cpp \
-    widgets/statusflagwidget.cpp \
     widgets/serverstatuswidget.cpp \
     models/selfupdater.cpp \
-    widgets/eventslistwidget.cpp \
     widgets/chooseversiondialog.cpp \
-    widgets/tooltiplabel.cpp
+    widgets/weeklycodewidget.cpp
 
 HEADERS += \
     models/downloader.h \
@@ -46,15 +43,13 @@ HEADERS += \
     widgets/rusificationwidget.h \
     widgets/settingswidget.h \
     widgets/statuswidget.h \
-    widgets/weeklycodewidget.h \
     widgets/newslistwidget.h \
     widgets/newspiece.h \
-    widgets/statusflagwidget.h \
     widgets/serverstatuswidget.h \
     models/selfupdater.h \
-    widgets/eventslistwidget.h \
     widgets/chooseversiondialog.h \
-    widgets/tooltiplabel.h
+    widgets/weeklycodewidget.h \
+    constants.h
 
 FORMS += \
     widgets/helpwidget.ui \
@@ -65,7 +60,7 @@ FORMS += \
     widgets/newspiece.ui \
     widgets/serverstatuswidget.ui \
     widgets/chooseversiondialog.ui \
-    widgets/tooltiplabel.ui
+    widgets/weeklycodewidget.ui
 
 win32:RC_ICONS = $${PROJECT_ROOT_PATH}/resources/appicon.ico
 

+ 21 - 0
src/Legacy/constants.h

@@ -0,0 +1,21 @@
+#ifndef CONSTANTS_H
+#define CONSTANTS_H
+
+const double default_window_width = 1000;
+const double default_window_height = 648;
+
+const double default_pixels_in_11_pt = 13;
+const double default_pixels_in_10_pt = 12;
+const double default_pixels_in_9_pt = 11;
+const double default_pixels_in_8_pt = 9;
+
+// Defined and should be updated only by MainWindow!!!
+extern double window_height;
+extern double window_width;
+
+extern int pixels_in_11_pt;
+extern int pixels_in_10_pt;
+extern int pixels_in_9_pt;
+extern int pixels_in_8_pt;
+
+#endif // CONSTANTS_H

+ 11 - 4
src/Legacy/main.cpp

@@ -10,6 +10,15 @@
 #include <QResource>
 #include <QFontDatabase>
 
+// Global. Should be updated only by MainWindow!!!
+double window_height = 1000;
+double window_width = 648;
+
+int pixels_in_11_pt = 13;
+int pixels_in_10_pt = 12;
+int pixels_in_9_pt = 11;
+int pixels_in_8_pt = 9;
+
 int main(int argc, char *argv[])
 {
     setlocale(LC_ALL,"Russian");
@@ -30,10 +39,8 @@ int main(int argc, char *argv[])
     QResource::registerResource(QApplication::applicationDirPath() + "/data01.gtr");
     QResource::registerResource(QApplication::applicationDirPath() + "/data02.gtr");
 
-    QFontDatabase::addApplicationFont(":/assets/fonts/trajan.ttf");
-    QFontDatabase::addApplicationFont(":/assets/fonts/trajan_bold.otf");
-    QFontDatabase::addApplicationFont(":/assets/fonts/viking.ttf");
-    QFontDatabase::addApplicationFont(":/assets/fonts/title.ttf");
+    QFontDatabase::addApplicationFont("qrc:/fonts/trajan.ttf");
+    QFontDatabase::addApplicationFont("qrc:/fonts/trajan_bold.otf");
 
     qDebug() << "Starting main frame initialisation...";
 

+ 2 - 8
src/Legacy/object_script.Legacy.Debug

@@ -12,15 +12,12 @@ INPUT(
 ./..\..\build\debug\Legacy\obj\rusificationwidget.o
 ./..\..\build\debug\Legacy\obj\settingswidget.o
 ./..\..\build\debug\Legacy\obj\statuswidget.o
-./..\..\build\debug\Legacy\obj\weeklycodewidget.o
 ./..\..\build\debug\Legacy\obj\newslistwidget.o
 ./..\..\build\debug\Legacy\obj\newspiece.o
-./..\..\build\debug\Legacy\obj\statusflagwidget.o
 ./..\..\build\debug\Legacy\obj\serverstatuswidget.o
 ./..\..\build\debug\Legacy\obj\selfupdater.o
-./..\..\build\debug\Legacy\obj\eventslistwidget.o
 ./..\..\build\debug\Legacy\obj\chooseversiondialog.o
-./..\..\build\debug\Legacy\obj\tooltiplabel.o
+./..\..\build\debug\Legacy\obj\weeklycodewidget.o
 ./..\..\build\debug\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\debug\Legacy\obj\moc_downloader.o
 ./..\..\build\debug\Legacy\obj\moc_filesystem.o
@@ -32,13 +29,10 @@ INPUT(
 ./..\..\build\debug\Legacy\obj\moc_rusificationwidget.o
 ./..\..\build\debug\Legacy\obj\moc_settingswidget.o
 ./..\..\build\debug\Legacy\obj\moc_statuswidget.o
-./..\..\build\debug\Legacy\obj\moc_weeklycodewidget.o
 ./..\..\build\debug\Legacy\obj\moc_newslistwidget.o
 ./..\..\build\debug\Legacy\obj\moc_newspiece.o
-./..\..\build\debug\Legacy\obj\moc_statusflagwidget.o
 ./..\..\build\debug\Legacy\obj\moc_serverstatuswidget.o
 ./..\..\build\debug\Legacy\obj\moc_selfupdater.o
-./..\..\build\debug\Legacy\obj\moc_eventslistwidget.o
 ./..\..\build\debug\Legacy\obj\moc_chooseversiondialog.o
-./..\..\build\debug\Legacy\obj\moc_tooltiplabel.o
+./..\..\build\debug\Legacy\obj\moc_weeklycodewidget.o
 );

+ 2 - 8
src/Legacy/object_script.Legacy.Release

@@ -10,15 +10,12 @@ INPUT(
 ./..\..\build\release\Legacy\obj\rusificationwidget.o
 ./..\..\build\release\Legacy\obj\settingswidget.o
 ./..\..\build\release\Legacy\obj\statuswidget.o
-./..\..\build\release\Legacy\obj\weeklycodewidget.o
 ./..\..\build\release\Legacy\obj\newslistwidget.o
 ./..\..\build\release\Legacy\obj\newspiece.o
-./..\..\build\release\Legacy\obj\statusflagwidget.o
 ./..\..\build\release\Legacy\obj\serverstatuswidget.o
 ./..\..\build\release\Legacy\obj\selfupdater.o
-./..\..\build\release\Legacy\obj\eventslistwidget.o
 ./..\..\build\release\Legacy\obj\chooseversiondialog.o
-./..\..\build\release\Legacy\obj\tooltiplabel.o
+./..\..\build\release\Legacy\obj\weeklycodewidget.o
 ./..\..\build\release\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\release\Legacy\obj\moc_downloader.o
 ./..\..\build\release\Legacy\obj\moc_filesystem.o
@@ -30,13 +27,10 @@ INPUT(
 ./..\..\build\release\Legacy\obj\moc_rusificationwidget.o
 ./..\..\build\release\Legacy\obj\moc_settingswidget.o
 ./..\..\build\release\Legacy\obj\moc_statuswidget.o
-./..\..\build\release\Legacy\obj\moc_weeklycodewidget.o
 ./..\..\build\release\Legacy\obj\moc_newslistwidget.o
 ./..\..\build\release\Legacy\obj\moc_newspiece.o
-./..\..\build\release\Legacy\obj\moc_statusflagwidget.o
 ./..\..\build\release\Legacy\obj\moc_serverstatuswidget.o
 ./..\..\build\release\Legacy\obj\moc_selfupdater.o
-./..\..\build\release\Legacy\obj\moc_eventslistwidget.o
 ./..\..\build\release\Legacy\obj\moc_chooseversiondialog.o
-./..\..\build\release\Legacy\obj\moc_tooltiplabel.o
+./..\..\build\release\Legacy\obj\moc_weeklycodewidget.o
 );

+ 0 - 99
src/Legacy/widgets/eventslistwidget.cpp

@@ -1,99 +0,0 @@
-#include "eventslistwidget.h"
-#include <QtConcurrent/QtConcurrent>
-#include <QLabel>
-#include <QStringList>
-#include <QSpacerItem>
-#include <widgets/newspiece.h>
-
-EventsListWidget::EventsListWidget(QWidget *parent) : QWidget(parent)
-{
-    event_downloader.targetBytearray = &events_data;
-    event_downloader.setUrl(QUrl("http://translate.lotros.ru/events/get/1"));
-
-    event_layout = new QVBoxLayout(this);
-    event_layout->setSpacing(7);
-    event_layout->setObjectName(QStringLiteral("events_layout"));
-    event_layout->setContentsMargins(11, 11, 11, 0);
-
-    connect(&event_update_timer, &QTimer::timeout, &event_downloader, &Downloader::start);
-    connect(&event_downloader, &Downloader::downloadFinished, this, &EventsListWidget::updateEvents);
-    emit event_downloader.start();
-    event_update_timer.setInterval(1000 * 60); // 60 seconds;
-    event_update_timer.start();
-}
-
-EventsListWidget::~EventsListWidget()
-{
-    event_update_timer.stop();
-}
-
-void EventsListWidget::updateEvents()
-{
-    if (!qApp)
-        return;
-
-    qDebug() << "Received data: " << QString(events_data);
-
-    if (events_data.size() == 0) {
-        constructEventPiece(0, "Не могу загрузить список событий", "Загрузка списка событий не удалась. Чтобы просмотреть текущие игровые события, перейдите на <a href='http://translate.lotros.ru/'>http://translate.lotros.ru/</a>", "http://translate.lotros.ru/", "");
-        return;
-    }
-
-    QStringList events_list = QString(events_data).split("|");
-    events_data.clear();
-
-    for (int i = 0; i < events_list.size(); i++) {
-        QStringList event_piece = events_list[i].split(":::");
-
-        qDebug() << "Processing event " << event_piece;
-
-        QString title = event_piece[0];
-        QString img_src = event_piece[1];
-        QString desrc = event_piece[2];
-        QString date_begin = event_piece[3];
-        QString date_end = event_piece[4];
-        QString date_formatted = event_piece[5];
-
-        constructEventPiece(i, title, desrc, "", date_formatted);
-
-        QtConcurrent::run([i, this, img_src](){
-            Downloader img_dwnld;
-            QByteArray img = "";
-            img_dwnld.setUrl(QUrl(img_src));
-            img_dwnld.targetBytearray = &img;
-            img_dwnld.start();
-            img_dwnld.waitForDownloaded();
-            qDebug() << "Downloaded " << img_src;
-            QPixmap img_pixmap;
-            img_pixmap.loadFromData(img);
-            QMetaObject::invokeMethod(this, "setImgToEventPiece", Qt::QueuedConnection, Q_ARG(int, i), Q_ARG(QPixmap, img_pixmap));
-        });
-    }
-}
-
-void EventsListWidget::constructEventPiece(int piece_id, QString title, QString text, QString news_src, QString news_date)
-{
-    NewsPiece* old_piece = findChild<NewsPiece*>("event_piece_" + QString::number(piece_id));
-
-    if (old_piece) {
-        event_layout->removeWidget(old_piece);
-        old_piece->deleteLater();
-    }
-
-    NewsPiece* news_piece = new NewsPiece(this);
-    news_piece->setObjectName(QStringLiteral("event_piece_") + QString::number(piece_id));
-    news_piece->setIcon(QPixmap(QString::fromUtf8(":/appicon.ico")).scaled(40, 40));
-    news_piece->setTitle(title, news_src);
-    news_piece->setContents(text);
-    news_piece->setDate(news_date);
-
-    event_layout->addWidget(news_piece, piece_id, 0);
-}
-
-void EventsListWidget::setImgToEventPiece(int piece_id, QPixmap img)
-{
-    NewsPiece* piece = findChild<NewsPiece*>("event_piece_" + QString::number(piece_id));
-    if (!piece)
-        return;
-    piece->setIcon(img);
-}

+ 0 - 39
src/Legacy/widgets/eventslistwidget.h

@@ -1,39 +0,0 @@
-#ifndef EVENTSLISTWIDGET_H
-#define EVENTSLISTWIDGET_H
-
-#include <QWidget>
-#include <QVBoxLayout>
-#include "models/downloader.h"
-#include <QTimer>
-#include <QMutex>
-
-class EventsListWidget : public QWidget
-{
-    Q_OBJECT
-public:
-    explicit EventsListWidget(QWidget *parent = nullptr);
-    ~EventsListWidget();
-
-signals:
-    void eventsUpdated();
-
-public slots:
-    void updateEvents();
-private slots:
-    void setImgToEventPiece(int piece_id, QPixmap img);
-
-private:
-    void constructEventPiece(int piece_id, QString title, QString text, QString news_src, QString news_date);
-
-private:
-    QVBoxLayout* event_layout;
-    QTimer event_update_timer;
-    QByteArray events_data;
-    Downloader event_downloader;
-
-signals:
-
-public slots:
-};
-
-#endif // EVENTSLISTWIDGET_H

+ 31 - 39
src/Legacy/widgets/mainwindow.cpp

@@ -1,5 +1,6 @@
 #include "mainwindow.h"
 #include "ui_mainwindow.h"
+#include "constants.h"
 
 #include "models/patchdownloader.h"
 #include "models/lotrodatmanager.h"
@@ -16,6 +17,7 @@
 #include <QDesktopWidget>
 #include <QtConcurrent/QtConcurrent>
 #include <QGraphicsBlurEffect>
+#include <QFont>
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent, Qt::Window | Qt::FramelessWindowHint),
@@ -73,9 +75,6 @@ MainWindow::MainWindow(QWidget *parent) :
 
     setupMenuHoverWidget();
 
-    updateGeometry();
-    repaint();
-
     qDebug() << "Initialising background updates";
     background_update_timer.setInterval(30 * 1000);
     connect(&background_update_timer, &QTimer::timeout, this, &MainWindow::randomChangeBackground);
@@ -88,10 +87,6 @@ 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,17 +110,33 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
 
 void MainWindow::resizeEvent(QResizeEvent * event)
 {
+    if (event->size().width() == -1 || event->size().height() == -1)
+        return;
+
     int width = event->size().width();
     int height = event->size().height();
 
+    double dpi = qApp->desktop()->physicalDpiX();
+    const double default_dpi = 96;
+    qDebug() << "DPI IS" << dpi;
+
+    window_width = width;
+    window_height = height;
+
+    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);
+
     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 / 648);
-    ui->content_area->resize(width * 1000 / 1000, height * 520 / 648);
+    ui->content_area->resize(width * 1000 / 1000, height * 538 / 648);
     setupWindowBackgroundAndMask(current_bg);
-    choose_locale_dialog->resize(size());
-    changeFontSizeRecursive(100, this);
+    choose_locale_dialog->resize(event->size());
+
+    updateFontSizes();
 }
 
 void MainWindow::randomChangeBackground()
@@ -279,35 +290,6 @@ void MainWindow::hideAllContentWidgets()
     help_widget->hide();
 }
 
-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(menuentry_font_size * percent / 100);
-    if (widget_name.contains("_small"))
-        widget_font.setPixelSize(small_font_size * percent / 100);
-    if (widget_name.contains("_common"))
-        widget_font.setPixelSize(common_font_size * percent / 100);
-    if (widget_name.contains("_title"))
-        widget_font.setPixelSize(title_font_size * percent / 100);
-    if (widget_name.contains("_supertitle"))
-        widget_font.setPixelSize(supertitle_font_size * percent / 100);
-    if (widget_name.contains("_bigbutton"))
-        widget_font.setPixelSize(bigbutton_font_size * percent / 100);
-
-    widget->setFont(widget_font);
-
-    for (QObject* child : widget->children())
-        if (child->isWidgetType()) {
-            QWidget* w = qobject_cast<QWidget *>(child);
-            changeFontSizeRecursive(percent, w);
-        }
-}
 
 void MainWindow::showChooseVersionDialog()
 {
@@ -324,6 +306,16 @@ void MainWindow::hideChooseVersionDialog()
     choose_locale_dialog->hide();
 }
 
+void MainWindow::updateFontSizes()
+{
+    QFont font = QFont(ui->menuentry_1->font());
+    font.setPixelSize(pixels_in_10_pt);
+    ui->menuentry_1->setFont(font);
+    ui->menuentry_2->setFont(font);
+    ui->menuentry_3->setFont(font);
+    ui->menuentry_4->setFont(font);
+}
+
 void MainWindow::on_closeButton_clicked()
 {
     hide();

+ 2 - 8
src/Legacy/widgets/mainwindow.h

@@ -7,6 +7,7 @@
 #include <QPixmap>
 #include <QBitmap>
 #include <QGraphicsBlurEffect>
+#include <QFont>
 
 #include "statuswidget.h"
 #include "rusificationwidget.h"
@@ -29,12 +30,12 @@ class MainWindow : public QMainWindow
 
 public:
     explicit MainWindow(QWidget *parent = 0);
-    void changeFontSizeRecursive(size_t percent, QWidget* widget);
     ~MainWindow();
 
 public slots:
     void showChooseVersionDialog();
     void hideChooseVersionDialog();
+    void updateFontSizes();
 
 protected:
     void mouseMoveEvent(QMouseEvent *event) override;
@@ -101,13 +102,6 @@ private:
     QTimer background_update_timer;
 
     const int MAX_PIXMAP_ID = 14;
-
-    const size_t small_font_size = 13; // Trajan Pro 3
-    const size_t common_font_size = 18; // EB Garamond
-    const size_t menuentry_font_size = 14; // Trajan Pro 3
-    const size_t title_font_size = 17; // Trajan Pro 3
-    const size_t supertitle_font_size = 32;
-    const size_t bigbutton_font_size = 22;
 };
 
 

+ 23 - 13
src/Legacy/widgets/mainwindow.ui

@@ -47,7 +47,7 @@
       <x>0</x>
       <y>110</y>
       <width>1000</width>
-      <height>520</height>
+      <height>538</height>
      </rect>
     </property>
     <property name="sizePolicy">
@@ -64,13 +64,13 @@
     </property>
     <layout class="QGridLayout" name="gridLayout_3">
      <property name="leftMargin">
-      <number>20</number>
+      <number>0</number>
      </property>
      <property name="topMargin">
       <number>0</number>
      </property>
      <property name="rightMargin">
-      <number>20</number>
+      <number>0</number>
      </property>
      <property name="bottomMargin">
       <number>0</number>
@@ -130,7 +130,7 @@
      <item>
       <widget class="MenuEntry" name="menuentry_1">
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Ignored" vsizetype="Expanding">
+        <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -144,6 +144,7 @@
        <property name="font">
         <font>
          <family>Trajan Pro 3</family>
+         <pointsize>10</pointsize>
          <weight>50</weight>
          <bold>false</bold>
         </font>
@@ -158,7 +159,7 @@
         <string notr="true">color: rgb(255, 255, 255);</string>
        </property>
        <property name="text">
-        <string>ГЛАВНАЯ</string>
+        <string>    главная    </string>
        </property>
        <property name="scaledContents">
         <bool>true</bool>
@@ -180,7 +181,7 @@
         <bool>true</bool>
        </property>
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Ignored" vsizetype="Expanding">
+        <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -188,6 +189,7 @@
        <property name="font">
         <font>
          <family>Trajan Pro 3</family>
+         <pointsize>10</pointsize>
          <weight>50</weight>
          <bold>false</bold>
         </font>
@@ -196,10 +198,10 @@
         <bool>true</bool>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(210, 210, 210);</string>
+        <string notr="true">color: rgb(255, 255, 255);</string>
        </property>
        <property name="text">
-        <string>  НАСТРОЙКИ  </string>
+        <string>  настройки  </string>
        </property>
        <property name="scaledContents">
         <bool>true</bool>
@@ -229,6 +231,7 @@
        <property name="font">
         <font>
          <family>Trajan Pro 3</family>
+         <pointsize>10</pointsize>
          <weight>50</weight>
          <bold>false</bold>
         </font>
@@ -237,10 +240,10 @@
         <bool>true</bool>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(210, 210, 210);</string>
+        <string notr="true">color: rgb(255, 255, 255);</string>
        </property>
        <property name="text">
-        <string notr="true">РУСИФИКАЦИЯ</string>
+        <string notr="true">помощь</string>
        </property>
        <property name="scaledContents">
         <bool>true</bool>
@@ -256,7 +259,7 @@
      <item>
       <widget class="MenuEntry" name="menuentry_4">
        <property name="sizePolicy">
-        <sizepolicy hsizetype="Ignored" vsizetype="Expanding">
+        <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -270,6 +273,7 @@
        <property name="font">
         <font>
          <family>Trajan Pro 3</family>
+         <pointsize>10</pointsize>
          <weight>50</weight>
          <bold>false</bold>
         </font>
@@ -281,10 +285,10 @@
         <enum>Qt::LeftToRight</enum>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(210, 210, 210);</string>
+        <string notr="true">color: rgb(255, 255, 255);</string>
        </property>
        <property name="text">
-        <string>  О НАСЛЕДИИ  </string>
+        <string>  о наследии  </string>
        </property>
        <property name="scaledContents">
         <bool>true</bool>
@@ -335,6 +339,9 @@
             <height>20</height>
            </size>
           </property>
+          <property name="cursor">
+           <cursorShape>PointingHandCursor</cursorShape>
+          </property>
           <property name="styleSheet">
            <string notr="true">QPushButton#minimizeButton {border-image: url(:/buttons/minimize.png) 0 0 0 0 stretch stretch; border: 0px;}
 
@@ -355,6 +362,9 @@ QPushButton#minimizeButton:hover {border-image: url(:/buttons/minimize.png) 0 0
             <height>20</height>
            </size>
           </property>
+          <property name="cursor">
+           <cursorShape>PointingHandCursor</cursorShape>
+          </property>
           <property name="styleSheet">
            <string notr="true">QPushButton#closeButton { border-image: url(:/buttons/close.png) 0 0 0 0 stretch stretch; }
 

+ 19 - 19
src/Legacy/widgets/newslistwidget.cpp

@@ -11,9 +11,9 @@ NewsListWidget::NewsListWidget(QWidget *parent) : QWidget(parent)
     news_downloader.setUrl(QUrl("http://translate.lotros.ru/groupware/launcher_news/30/1"));
 
     news_layout = new QVBoxLayout(this);
-    news_layout->setSpacing(7);
+    news_layout->setSpacing(10);
     news_layout->setObjectName(QStringLiteral("news_layout"));
-    news_layout->setContentsMargins(11, 11, 11, 11);
+    news_layout->setContentsMargins(2, 2, 10, 2);
     news_layout->setSizeConstraint(QLayout::SetNoConstraint);
     connect(&news_update_timer, &QTimer::timeout, &news_downloader, &Downloader::start);
     connect(&news_downloader, &Downloader::downloadFinished, this, &NewsListWidget::updateNews);
@@ -31,12 +31,12 @@ NewsListWidget::~NewsListWidget()
 
 void NewsListWidget::leaveEvent(QEvent *event)
 {
-    emit mouseLeaved();
+    emit showNoToolTip();
 }
 
 void NewsListWidget::enterEvent(QEvent *event)
 {
-    emit mouseEntered("<p><i>Новости.</i></p>Нажмите на заголовок новости, чтобы открыть её на сайте проекта.");
+    emit showHelpToolTip();
 }
 
 void NewsListWidget::updateNews()
@@ -63,18 +63,18 @@ void NewsListWidget::updateNews()
 
         constructNewsPiece(i, news_title, news_desrc, news_src, news_date);
 
-        QtConcurrent::run([i, this, img_src](){
-            Downloader img_dwnld;
-            QByteArray img = "";
-            img_dwnld.setUrl(QUrl(img_src));
-            img_dwnld.targetBytearray = &img;
-            img_dwnld.start();
-            img_dwnld.waitForDownloaded();
-            qDebug() << "Downloaded " << img_src;
-            QPixmap img_pixmap;
-            img_pixmap.loadFromData(img);
-            QMetaObject::invokeMethod(this, "setImgToNewsPiece", Qt::QueuedConnection, Q_ARG(int, i), Q_ARG(QPixmap, img_pixmap));
-        });
+//        QtConcurrent::run([i, this, img_src](){
+//            Downloader img_dwnld;
+//            QByteArray img = "";
+//            img_dwnld.setUrl(QUrl(img_src));
+//            img_dwnld.targetBytearray = &img;
+//            img_dwnld.start();
+//            img_dwnld.waitForDownloaded();
+//            qDebug() << "Downloaded " << img_src;
+//            QPixmap img_pixmap;
+//            img_pixmap.loadFromData(img);
+//            QMetaObject::invokeMethod(this, "setImgToNewsPiece", Qt::QueuedConnection, Q_ARG(int, i), Q_ARG(QPixmap, img_pixmap));
+//        });
     }
 
     QSpacerItem* verticalSpacer = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
@@ -92,9 +92,9 @@ void NewsListWidget::constructNewsPiece(int piece_id, QString title, QString tex
 
     NewsPiece* news_piece = new NewsPiece(this);
     news_piece->setObjectName(QStringLiteral("news_piece_") + QString::number(piece_id));
-    news_piece->setIcon(QPixmap(QString::fromUtf8(":/appicon.ico")).scaled(40, 40));
+//    news_piece->setIcon(QPixmap(QString::fromUtf8(":/appicon.ico")).scaled(40, 40));
     news_piece->setTitle(title, news_src);
-    news_piece->setContents(text);
+//    news_piece->setContents(text);
     news_piece->setDate(news_date);
 
     news_layout->addWidget(news_piece, piece_id, 0);
@@ -105,5 +105,5 @@ void NewsListWidget::setImgToNewsPiece(int piece_id, QPixmap img)
     NewsPiece* piece = findChild<NewsPiece*>("news_piece_" + QString::number(piece_id));
     if (!piece)
         return;
-    piece->setIcon(img);
+//    piece->setIcon(img);
 }

+ 2 - 2
src/Legacy/widgets/newslistwidget.h

@@ -19,8 +19,8 @@ protected:
     virtual void enterEvent(QEvent * event) override;
 
 signals:
-    void mouseEntered(QString tooltip);
-    void mouseLeaved();
+    void showHelpToolTip();
+    void showNoToolTip();
     void newsUpdated();
 
 public slots:

+ 3 - 24
src/Legacy/widgets/newspiece.cpp

@@ -13,27 +13,16 @@ void NewsPiece::setTitle(const QString &title, const QString &url)
 {
     _title = title;
     _url = url;
-    ui->news_head_small->setText("<a style=\"color: #cfa644; text-decoration:none;\" href = '" + QString(url).remove("\n") + "'>" + QString(title).remove("\n") + "</a>");
+    ui->news_title->setText("<a style=\"color: #cfa644; text-decoration:none;\" href = '" + QString(url).remove("\n") + "'>" + QString(title).remove("\n") + "</a>");
     resize(sizeHint());
 }
 
 void NewsPiece::setDate(const QString &date)
 {
-    ui->news_date_small->setText(QString(date).remove("\n"));
+    ui->news_date->setText(QString(date).remove("\n"));
     resize(sizeHint());
 }
 
-void NewsPiece::setContents(const QString &contents)
-{
-    ui->news_content_common->setText(QString(contents).remove("\n"));
-    resize(sizeHint());
-}
-
-void NewsPiece::setIcon(const QPixmap &pixmap)
-{
-    ui->news_icon->setPixmap(pixmap.scaled(ui->news_icon->sizeHint()));
-}
-
 QString NewsPiece::getTitle()
 {
     return _title;
@@ -46,17 +35,7 @@ QString NewsPiece::getUrl()
 
 QString NewsPiece::getDate()
 {
-    return ui->news_date_small->text();
-}
-
-QString NewsPiece::getContents()
-{
-    return ui->news_content_common->text();
-}
-
-QPixmap NewsPiece::getIcon()
-{
-    return *ui->news_icon->pixmap();
+    return ui->news_date->text();
 }
 
 NewsPiece::~NewsPiece()

+ 0 - 4
src/Legacy/widgets/newspiece.h

@@ -16,14 +16,10 @@ public:
 
     void setTitle(const QString &title, const QString &url);
     void setDate(const QString &date);
-    void setContents(const QString &contents);
-    void setIcon(const QPixmap &pixmap);
 
     QString getTitle();
     QString getUrl();
     QString getDate();
-    QString getContents();
-    QPixmap getIcon();
 
     ~NewsPiece();
 

+ 63 - 151
src/Legacy/widgets/newspiece.ui

@@ -6,23 +6,27 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>656</width>
-    <height>423</height>
+    <width>350</width>
+    <height>103</height>
    </rect>
   </property>
   <property name="sizePolicy">
-   <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+   <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
   </property>
-  <property name="minimumSize">
-   <size>
-    <width>350</width>
-    <height>0</height>
-   </size>
+  <property name="styleSheet">
+   <string notr="true">QWidget#weekly_code_widget{
+background-color:rgba(0,0,0,220);
+border-radius: 5px;
+border: 2px solid qlineargradient(spread:reflect, x1:1, y1:1, x2:0, y2:1, stop:0 rgba(33, 24, 12, 255), stop:0.5 rgba(126, 97, 61, 255), stop:1 rgba(33, 24, 1, 255));
+}</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_2">
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
    <property name="sizeConstraint">
     <enum>QLayout::SetNoConstraint</enum>
    </property>
@@ -38,169 +42,70 @@
    <property name="bottomMargin">
     <number>0</number>
    </property>
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <item row="0" column="0">
+   <item>
     <widget class="QWidget" name="piece_widget" native="true">
      <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+      <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="styleSheet">
       <string notr="true">QWidget#piece_widget{
-border-radius: 10px;
-background-color: rgba(30, 0, 0, 100);
+background-color:rgba(0,0,0,30);
+border-radius: 5px;
+border: 1px solid qlineargradient(spread:reflect, x1:1, y1:1, x2:0, y2:1, stop:0 rgba(33, 24, 12, 255), stop:0.5 rgba(126, 97, 61, 255), stop:1 rgba(33, 24, 1, 255));
 }
 
 QWidget {
-color: white;
-}
-
-QLabel{
-border-radius: 2px;
-background-color:rgba(0,0,0,0);
+color:white;
 }</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <property name="spacing">
+       <number>4</number>
+      </property>
       <property name="sizeConstraint">
        <enum>QLayout::SetNoConstraint</enum>
       </property>
       <property name="leftMargin">
-       <number>11</number>
+       <number>7</number>
+      </property>
+      <property name="topMargin">
+       <number>7</number>
       </property>
       <property name="rightMargin">
-       <number>11</number>
+       <number>7</number>
       </property>
       <property name="bottomMargin">
-       <number>5</number>
-      </property>
-      <property name="horizontalSpacing">
-       <number>11</number>
+       <number>7</number>
       </property>
-      <property name="verticalSpacing">
-       <number>0</number>
-      </property>
-      <item row="0" column="1" rowspan="2" colspan="3">
-       <widget class="QWidget" name="widget" native="true">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <layout class="QVBoxLayout" name="verticalLayout">
-         <property name="spacing">
-          <number>5</number>
-         </property>
-         <property name="sizeConstraint">
-          <enum>QLayout::SetNoConstraint</enum>
-         </property>
-         <property name="leftMargin">
-          <number>5</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>5</number>
-         </property>
-         <property name="bottomMargin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QLabel" name="news_head_small">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="Ignored">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="font">
-            <font>
-             <family>Trajan Pro 3</family>
-             <pointsize>9</pointsize>
-             <weight>50</weight>
-             <italic>false</italic>
-             <bold>false</bold>
-            </font>
-           </property>
-           <property name="styleSheet">
-            <string notr="true"/>
-           </property>
-           <property name="text">
-            <string>Рейд &quot;Ледяная наковальня Кузницы Зимы&quot; снова работает jhgf jhgf jhgf jhgf jhgf jhgf hh </string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-           <property name="openExternalLinks">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="news_date_small">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="Ignored">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="font">
-            <font>
-             <family>Trajan Pro 3</family>
-             <pointsize>8</pointsize>
-             <weight>50</weight>
-             <bold>false</bold>
-            </font>
-           </property>
-           <property name="styleSheet">
-            <string notr="true"/>
-           </property>
-           <property name="text">
-            <string>15 ноября 2018 - 19 ноября 2018</string>
-           </property>
-           <property name="textFormat">
-            <enum>Qt::RichText</enum>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item row="2" column="0" colspan="4">
-       <widget class="QLabel" name="news_content_common">
+      <item>
+       <widget class="QLabel" name="news_title">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+         <sizepolicy hsizetype="Preferred" vsizetype="Ignored">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="font">
          <font>
-          <family>EB Garamond</family>
-          <pointsize>11</pointsize>
+          <family>Trajan Pro 3</family>
+          <pointsize>8</pointsize>
+          <weight>50</weight>
           <italic>false</italic>
+          <bold>false</bold>
+          <kerning>false</kerning>
          </font>
         </property>
+        <property name="cursor">
+         <cursorShape>PointingHandCursor</cursorShape>
+        </property>
         <property name="styleSheet">
-         <string notr="true">color: rgb(210, 210, 210);</string>
+         <string notr="true"/>
         </property>
         <property name="text">
-         <string>Съешь ещё этих мягких французских булок, да выпей же чаю. — мем, порождённый русскоязычной версией Windows (вернее, программой fontview.exe, которая входит в дефолтную поставку, начиная аж с незапамятных времён Windows 95).
-
-Таким хитроумным способом Винда демонстрирует юзеру, каким образом выглядят буквы в кириллических шрифтах для пользователей перевода Windows для России (болгарам же и другим пользователям кириллических шрифтов на эти ваши булки положить с прибором). Выбор именно этой фразы оправдывается тем, что в ней содержатся все буквы русского алфавита, а также запятая и точка (такие фразы именуются «панграммами»).
-
-</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+         <string>Рейд &quot;Ледяная наковальня Кузницы Зимы&quot; снова работает.</string>
         </property>
         <property name="wordWrap">
          <bool>true</bool>
@@ -210,28 +115,35 @@ background-color:rgba(0,0,0,0);
         </property>
        </widget>
       </item>
-      <item row="0" column="0" rowspan="2">
-       <widget class="QLabel" name="news_icon">
+      <item>
+       <widget class="QLabel" name="news_date">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <sizepolicy hsizetype="Preferred" vsizetype="Ignored">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
-        <property name="minimumSize">
-         <size>
-          <width>45</width>
-          <height>45</height>
-         </size>
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>6</pointsize>
+          <italic>false</italic>
+         </font>
         </property>
-        <property name="maximumSize">
-         <size>
-          <width>45</width>
-          <height>45</height>
-         </size>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(215, 215, 215);</string>
         </property>
         <property name="text">
-         <string/>
+         <string>02.04.2019</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+        <property name="openExternalLinks">
+         <bool>true</bool>
         </property>
        </widget>
       </item>

+ 1 - 2
src/Legacy/widgets/serverstatuswidget.cpp

@@ -29,8 +29,7 @@ void ServerStatusWidget::updateStatus()
     QStringList servers = QString(downloaded_data).split("|||");
     foreach (QString server, servers) {
         QStringList data = server.split(":::");
-        QWidget* widget = findChild<QWidget*>(QString(data[0]).toLower() + "_common");
-        qDebug() << data;
+        QWidget* widget = findChild<QWidget*>(QString(data[0]).toLower());
         if (!widget)
             continue;
         if (data.size() > 1 && data[1] == "on")

+ 163 - 116
src/Legacy/widgets/serverstatuswidget.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>364</width>
-    <height>154</height>
+    <width>149</width>
+    <height>385</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -19,6 +19,9 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
+  <property name="autoFillBackground">
+   <bool>false</bool>
+  </property>
   <layout class="QGridLayout" name="gridLayout">
    <property name="leftMargin">
     <number>0</number>
@@ -36,257 +39,301 @@
     <number>0</number>
    </property>
    <item row="0" column="0">
-    <widget class="QWidget" name="us_cluster" native="true">
+    <widget class="QWidget" name="other_servers" native="true">
      <property name="styleSheet">
       <string notr="true">color:white;</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout_7">
+     <layout class="QVBoxLayout" name="verticalLayout_9">
       <property name="spacing">
-       <number>5</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
+       <number>8</number>
       </property>
       <item>
-       <widget class="QLabel" name="us_label_common">
+       <widget class="QLabel" name="anor">
         <property name="font">
          <font>
           <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
          </font>
         </property>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(255, 255, 127);</string>
+        </property>
         <property name="text">
-         <string>US-кластер</string>
+         <string>Anor</string>
         </property>
         <property name="alignment">
-         <set>Qt::AlignCenter</set>
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="Line" name="line">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
+       <widget class="QLabel" name="arkenstone">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="arkenstone_common">
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
          <string>Arkenstone</string>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="brandywine_common">
-        <property name="styleSheet">
-         <string notr="true">color: rgb(255, 255, 127);</string>
-        </property>
-        <property name="text">
-         <string>Brandywine</string>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="crickhollow_common">
-        <property name="styleSheet">
-         <string notr="true">color: rgb(255, 255, 127);</string>
-        </property>
-        <property name="text">
-         <string>Crickhollow</string>
+       <widget class="QLabel" name="belegaer">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="gladden_common">
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Gladden</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="landroval_common">
-        <property name="styleSheet">
-         <string notr="true">color: rgb(255, 255, 127);</string>
+         <string>Belegaer</string>
         </property>
-        <property name="text">
-         <string>Landroval</string>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QWidget" name="eu_cluster" native="true">
-     <property name="styleSheet">
-      <string notr="true">color:white;</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_8">
-      <property name="spacing">
-       <number>5</number>
-      </property>
       <item>
-       <widget class="QLabel" name="eu_label_common">
+       <widget class="QLabel" name="brandywine">
         <property name="font">
          <font>
           <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
          </font>
         </property>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(255, 255, 127);</string>
+        </property>
         <property name="text">
-         <string>EU-кластер</string>
+         <string>Brandywine</string>
         </property>
         <property name="alignment">
-         <set>Qt::AlignCenter</set>
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="Line" name="line_2">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
+       <widget class="QLabel" name="crickhollow">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="belegaer_common">
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Belegaer</string>
+         <string>Crickhollow</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="evernight_common">
+       <widget class="QLabel" name="evernight">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
          <string>Evernight</string>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="gwaihir_common">
-        <property name="styleSheet">
-         <string notr="true">color: rgb(255, 255, 127);</string>
-        </property>
-        <property name="text">
-         <string>Gwaihir</string>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="laurelin_common">
+       <widget class="QLabel" name="gladden">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Laurelin</string>
+         <string>Gladden</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="sirannon_common">
+       <widget class="QLabel" name="gwaihir">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Sirannon</string>
+         <string>Gwaihir</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="0" column="2">
-    <widget class="QWidget" name="other_servers" native="true">
-     <property name="styleSheet">
-      <string notr="true">color:white;</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_9">
-      <property name="spacing">
-       <number>5</number>
-      </property>
       <item>
-       <widget class="QLabel" name="legendary_servers_label_common">
+       <widget class="QLabel" name="ithil">
         <property name="font">
          <font>
           <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
          </font>
         </property>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(255, 255, 127);</string>
+        </property>
         <property name="text">
-         <string>Legendary Servers</string>
+         <string>Ithil</string>
         </property>
         <property name="alignment">
-         <set>Qt::AlignCenter</set>
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="Line" name="line_3">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
+       <widget class="QLabel" name="landroval">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
         </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="anor_common">
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Anor</string>
+         <string>Landroval</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="ithil_common">
+       <widget class="QLabel" name="laurelin">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
-         <string>Ithil</string>
+         <string>Laurelin</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLabel" name="pts_label_common">
+       <widget class="QLabel" name="sirannon">
         <property name="font">
          <font>
           <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
          </font>
         </property>
+        <property name="styleSheet">
+         <string notr="true">color: rgb(255, 255, 127);</string>
+        </property>
         <property name="text">
-         <string>Public Test Servers</string>
+         <string>Sirannon</string>
         </property>
         <property name="alignment">
-         <set>Qt::AlignCenter</set>
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="Line" name="line_5">
+       <spacer name="verticalSpacer">
         <property name="orientation">
-         <enum>Qt::Horizontal</enum>
+         <enum>Qt::Vertical</enum>
         </property>
-       </widget>
+        <property name="sizeType">
+         <enum>QSizePolicy::Fixed</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>10</height>
+         </size>
+        </property>
+       </spacer>
       </item>
       <item>
-       <widget class="QLabel" name="bullroarer_common">
+       <widget class="QLabel" name="bullroarer">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(255, 255, 127);</string>
         </property>
         <property name="text">
          <string>Bullroarer</string>
         </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
        </widget>
       </item>
      </layout>

+ 0 - 102
src/Legacy/widgets/statusflagwidget.cpp

@@ -1,102 +0,0 @@
-#include "statusflagwidget.h"
-#include <QApplication>
-#include <QtConcurrent/QtConcurrent>
-#include <QPainter>
-#include <QPaintEvent>
-#include <QToolTip>
-
-StatusFlagWidget::StatusFlagWidget(QWidget *parent) : QWidget(parent)
-{
-    setAttribute(Qt::WA_Hover);
-    setMouseTracking(true);
-    changeFlagId(3);
-    changeImageSrcInstantly(current_flag_src);
-}
-
-void StatusFlagWidget::changeImageSrcAnimated(const QString &src)
-{
-    if (!qApp)
-        return;
-
-    QPixmap *cur_bg = new QPixmap(current_bg);
-    QPixmap *new_bg= new QPixmap(QPixmap(src));
-
-    QtConcurrent::run([cur_bg, new_bg, src, this](){
-        const int iterations_num = 100;
-        const int iteration_sleep = 20;
-
-        for (int i = 0; i < iterations_num && qApp; i++) {
-            if (!(is_hovered && current_flag_hover_src == src) && !(!is_hovered && current_flag_src == src))
-                break;
-
-            QPainter painter;
-            painter.begin(cur_bg);
-            painter.setOpacity(double(10 + i) / double(iterations_num));
-            painter.setCompositionMode(QPainter::CompositionMode_Source);
-            painter.drawPixmap(0,0, *new_bg);
-            painter.end();
-            bg_lock.lock();
-            current_bg = *cur_bg;
-            bg_lock.unlock();
-            QMetaObject::invokeMethod(this, "repaint", Qt::QueuedConnection);
-            QThread::msleep(iteration_sleep);
-        }
-        delete cur_bg;
-        delete new_bg;
-    });
-}
-
-void StatusFlagWidget::changeImageSrcInstantly(const QString &src)
-{
-    current_bg = QPixmap(src);
-    repaint();
-}
-
-void StatusFlagWidget::changeFlagId(int new_flag_id)
-{
-    if (new_flag_id == flag_id)
-        return;
-    flag_id = new_flag_id;
-    current_flag_src = ":/flags/flag" + QString::number(flag_id) + ".png";
-    current_flag_hover_src = ":/flags/flag" + QString::number(flag_id) + "_hover.png";
-    emit flagIdChanged(flag_id);
-}
-
-void StatusFlagWidget::enterEvent(QEvent * event)
-{
-    is_hovered = true;
-    changeImageSrcAnimated(current_flag_hover_src);
-    QWidget::enterEvent(event);
-    event->ignore();
-    emit mouseEntered("Нажмите, чтобы переключиться между новостями/текущими событиями и статусом серверов.");
-}
-
-void StatusFlagWidget::paintEvent(QPaintEvent *event)
-{
-    Q_UNUSED(event);
-    QPainter painter;
-    painter.begin(this);
-    painter.drawPixmap(0,0, current_bg);
-    painter.end();
-}
-
-void StatusFlagWidget::leaveEvent(QEvent * event)
-{
-    is_hovered = false;
-    changeImageSrcAnimated(current_flag_src);
-    QWidget::leaveEvent(event);
-    event->ignore();
-    emit mouseLeaved();
-}
-
-void StatusFlagWidget::mousePressEvent(QMouseEvent *ev)
-{
-    if (flag_id == 2) {
-        changeFlagId(3);
-        changeImageSrcInstantly(current_flag_hover_src);
-    } else {
-        changeFlagId(2);
-        changeImageSrcInstantly(current_flag_hover_src);
-    }
-    QWidget::mousePressEvent(ev);
-}

+ 0 - 40
src/Legacy/widgets/statusflagwidget.h

@@ -1,40 +0,0 @@
-#ifndef STATUSFLAGWIDGET_H
-#define STATUSFLAGWIDGET_H
-
-#include <QWidget>
-#include <QMutex>
-
-class StatusFlagWidget : public QWidget
-{
-    Q_OBJECT
-public:
-    explicit StatusFlagWidget(QWidget *parent = nullptr);
-
-protected:
-    virtual void leaveEvent(QEvent * event) override;
-    virtual void enterEvent(QEvent * event) override;
-    virtual void paintEvent(QPaintEvent *event) override;
-    virtual void mousePressEvent(QMouseEvent *ev) override;
-
-signals:
-    void mouseEntered(QString tooltip);
-    void flagIdChanged(int flag_id);
-    void mouseLeaved();
-
-public slots:
-    void changeImageSrcAnimated(const QString& src);
-    void changeImageSrcInstantly(const QString& src);
-    void changeFlagId(int new_flag_id);
-
-private:
-    QMutex bg_lock;
-    int flag_id;
-    bool is_hovered;
-
-    QString current_flag_src;
-    QString current_flag_hover_src;
-
-    QPixmap current_bg;
-};
-
-#endif // STATUSFLAGWIDGET_H

+ 87 - 61
src/Legacy/widgets/statuswidget.cpp

@@ -3,6 +3,7 @@
 #include "widgets/mainwindow.h"
 #include "models/patchdownloader.h"
 #include "models/lotrodatmanager.h"
+#include "constants.h"
 
 #include <QDesktopServices>
 #include <QUrl>
@@ -15,22 +16,19 @@ StatusWidget::StatusWidget(QSettings* settings, PatchDownloader* patch_downloade
 {
 
     ui->setupUi(this);
-    connect(ui->announcements_list, &NewsListWidget::newsUpdated, this, &StatusWidget::invokeUpdateFontSize);
-    connect(ui->server_status_flag, &StatusFlagWidget::flagIdChanged, this, &StatusWidget::changeCentralWidget);
-    ui->status_widget->hide();
 
     connect(patch_updater, &PatchDownloader::downloadStarted, this, &StatusWidget::onPatchDownloaderStarted, Qt::QueuedConnection);
     connect(patch_updater, &PatchDownloader::progressChanged, this, &StatusWidget::onPatchDownloaderProgressChanged, Qt::QueuedConnection);
     connect(patch_updater, &PatchDownloader::downloadCompleted, this, &StatusWidget::onPatchDownloaderFinished, Qt::QueuedConnection);
-    ui->bottom_widget->hide();
-    ui->tooltip->hide();
-
-    connect(ui->weekly_code, &WeeklyCodeWidget::mouseEntered, this, &StatusWidget::showTooltip);
-    connect(ui->weekly_code, &WeeklyCodeWidget::mouseLeaved, this, &StatusWidget::hideTooltip);
-    connect(ui->server_status_flag, &StatusFlagWidget::mouseEntered, this, &StatusWidget::showTooltip);
-    connect(ui->server_status_flag, &StatusFlagWidget::mouseLeaved, this, &StatusWidget::hideTooltip);
-    connect(ui->announcements_list, &NewsListWidget::mouseEntered, this, &StatusWidget::showTooltip);
-    connect(ui->announcements_list, &NewsListWidget::mouseLeaved, this, &StatusWidget::hideTooltip);
+
+    connect(ui->weekly_code_widget, &WeeklyCodeWidget::showCompletedTooltip, this, &StatusWidget::setToolTipToWeeklyCodeComplete);
+    connect(ui->weekly_code_widget, &WeeklyCodeWidget::showHelpTooltip, this, &StatusWidget::setToolTipToWeeklyCodeHelp);
+    connect(ui->weekly_code_widget, &WeeklyCodeWidget::showNoTooltip, this, &StatusWidget::resetToolTip);
+
+    connect(ui->news_list, &NewsListWidget::showHelpToolTip, this, &StatusWidget::setToolTipToNewsHelp);
+    connect(ui->news_list, &NewsListWidget::showNoToolTip, this, &StatusWidget::resetToolTip);
+
+    resetToolTip();
 }
 
 StatusWidget::~StatusWidget()
@@ -38,36 +36,75 @@ StatusWidget::~StatusWidget()
     delete ui;
 }
 
-void StatusWidget::showTooltip(QString text)
-{
-    ui->tooltip->updateText(text);
-    ui->tooltip->show();
-}
-
-void StatusWidget::hideTooltip()
-{
-    ui->tooltip->hide();
+void StatusWidget::updateFontsSizes()
+{
+    QFont pt10_font = QFont(ui->news_label->font());
+    pt10_font.setPixelSize(pixels_in_10_pt);
+    QFont pt9_font = QFont(ui->progress_label->font());
+    pt9_font.setPixelSize(pixels_in_9_pt);
+    QFont pt11_font = QFont(ui->game_button->font());
+    pt11_font.setPixelSize(pixels_in_11_pt);
+    QFont pt8_font = QFont(ui->images_label->font());
+    pt8_font.setPixelSize(pixels_in_8_pt);
+
+    ui->progress_label->setFont(pt8_font);
+    ui->game_button->setFont(pt11_font);
+    ui->news_label->setFont(pt10_font);
+    ui->news_tooltip->setFont(pt9_font);
+    ui->images_label->setFont(pt8_font);
+    ui->images_status->setFont(pt8_font);
+    ui->sounds_label->setFont(pt8_font);
+    ui->sounds_status->setFont(pt8_font);
+    ui->texts_label->setFont(pt8_font);
+    ui->texts_status->setFont(pt8_font);
+    ui->videos_label->setFont(pt8_font);
+    ui->videos_status->setFont(pt8_font);
+    ui->weekly_code_tooltip_1->setFont(pt9_font);
+    ui->weekly_code_tooltip_2->setFont(pt9_font);
+}
+
+void StatusWidget::resizeEvent(QResizeEvent *event)
+{
+    double coefficient = window_width / default_window_width;
+    ui->game_button->move(QPoint(840, 460) * coefficient);
+    ui->game_button->resize(QSize(150, 60) * coefficient);
+    ui->progressBar->move(QPoint(330, 480) * coefficient);
+    ui->progressBar->resize(QSize(501, 40) * coefficient);
+    ui->progress_label->move(QPoint(330, 450) * coefficient);
+    ui->progress_label->resize(QSize(501, 31) * coefficient);
+    ui->news_label->move(QPoint(57, 33)* coefficient);
+    ui->news_label->resize(QSize(180, 21) * coefficient);
+    ui->news_scroll_area->move(QPoint(40, 75) * coefficient);
+    ui->news_scroll_area->resize(QSize(250, 440) * coefficient);
+    ui->server_status_widget->move(QPoint(820, 90) * coefficient);
+    ui->server_status_widget->resize(QSize(155, 320) * coefficient);
+    ui->weekly_code_widget->move(QPoint(810, 13) * coefficient);
+    ui->weekly_code_widget->resize(QSize(173, 57) * coefficient);
+    ui->witch_king_widget->move(QPoint(315, 20) * coefficient);
+    ui->witch_king_widget->resize(QSize(511, 421) * coefficient);
+    ui->witch_king_text_content->move(QPoint(50, 30) * coefficient);
+    ui->witch_king_text_content->resize(QSize(331, 101) * coefficient);
+
+
+    updateFontsSizes();
 }
 
 void StatusWidget::onPatchDownloaderStarted()
 {
     qDebug() << "Status widget received DownloadStarted signal!";
-    ui->bottom_widget->show();
-    ui->process_label->setText("Загрузка обновлений патчей...");
+    ui->progress_label->setText("Загрузка обновлений патчей...");
     ui->progressBar->setValue(0);
 }
 
 void StatusWidget::onPatchDownloaderFinished()
 {
-    ui->process_label->setText("Загрузка обновлений патчей завершена...");
+    ui->progress_label->setText("Загрузка обновлений патчей завершена!");
     ui->progressBar->setValue(100);
-    ui->bottom_widget->hide();
 }
 
 void StatusWidget::onPatchDownloaderProgressChanged(quint64 bytesDownloaded, quint64 bytesTotal, QString download_speed_formatted, QString elapsed_time_formatted)
 {
-    ui->bottom_widget->show();
-    ui->process_label->setText("Загрузка " + download_speed_formatted + ". Загружено "
+    ui->progress_label->setText("Загрузка " + download_speed_formatted + ". Загружено "
                                + Downloader::getSizeFormatted(bytesDownloaded) + " из " + Downloader::getSizeFormatted(bytesTotal)
                                + " (" + QString::number(bytesDownloaded * 100 / bytesTotal) + "%) ");
                                //+ "\nОставшееся время: " + elapsed_time_formatted);
@@ -75,55 +112,44 @@ void StatusWidget::onPatchDownloaderProgressChanged(quint64 bytesDownloaded, qui
     ui->progressBar->setValue(bytesDownloaded * 100 / bytesTotal + 5);
 }
 
-void StatusWidget::changeCentralWidget()
-{
-    if (ui->announcements_widget->isHidden()) {
-        ui->announcements_widget->show();
-        ui->status_widget->hide();
-    } else {
-        ui->announcements_widget->hide();
-        ui->status_widget->show();
-    }
-}
-
-void StatusWidget::invokeUpdateFontSize()
+void StatusWidget::on_game_button_clicked()
 {
     MainWindow* window = qobject_cast<MainWindow*>(parentWidget()->parentWidget()->parentWidget());
-    window->changeFontSizeRecursive(100, this);
+    window->showChooseVersionDialog();
 }
 
-void StatusWidget::on_site_link_button_clicked()
+void StatusWidget::setToolTipToWeeklyCodeHelp()
 {
-    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/"));
-}
+    ui->patches_status->hide();
+    ui->weekly_code_tooltip_2->hide();
+    ui->news_tooltip->hide();
 
-void StatusWidget::on_forum_link_button_clicked()
-{
-    QDesktopServices::openUrl(QUrl("http://lotros.ru/"));
+    ui->weekly_code_tooltip_1->show();
 }
 
-void StatusWidget::on_guides_link_button_clicked()
+void StatusWidget::setToolTipToWeeklyCodeComplete()
 {
-    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/guides"));
-}
+    ui->patches_status->hide();
+    ui->weekly_code_tooltip_1->hide();
+    ui->news_tooltip->hide();
 
-void StatusWidget::on_addons_link_button_clicked()
-{
-    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/mathoms"));
+    ui->weekly_code_tooltip_2->show();
 }
 
-void StatusWidget::on_bugreport_link_button_clicked()
+void StatusWidget::setToolTipToNewsHelp()
 {
-    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/bugs/add"));
-}
+    ui->patches_status->hide();
+    ui->weekly_code_tooltip_1->hide();
+    ui->weekly_code_tooltip_2->hide();
 
-void StatusWidget::on_donate_link_button_clicked()
-{
-    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/donate"));
+    ui->news_tooltip->show();
 }
 
-void StatusWidget::on_game_button_clicked()
+void StatusWidget::resetToolTip()
 {
-    MainWindow* window = qobject_cast<MainWindow*>(parentWidget()->parentWidget()->parentWidget());
-    window->showChooseVersionDialog();
+    ui->weekly_code_tooltip_1->hide();
+    ui->weekly_code_tooltip_2->hide();
+    ui->news_tooltip->hide();
+
+    ui->patches_status->show();
 }

+ 9 - 16
src/Legacy/widgets/statuswidget.h

@@ -20,8 +20,10 @@ public:
     ~StatusWidget();
 
 public slots:
-    void showTooltip(QString text);
-    void hideTooltip();
+    void updateFontsSizes();
+
+protected:
+    void resizeEvent(QResizeEvent *event) override;
 
 private slots:
     void onPatchDownloaderStarted();
@@ -30,23 +32,14 @@ private slots:
                                           QString download_speed_formatted,
                                           QString elapsed_time_formatted);
 
-    void changeCentralWidget();
-
-    void invokeUpdateFontSize();
-
-    void on_site_link_button_clicked();
-
-    void on_forum_link_button_clicked();
-
-    void on_guides_link_button_clicked();
-
-    void on_addons_link_button_clicked();
+    void on_game_button_clicked();
 
-    void on_bugreport_link_button_clicked();
+    void setToolTipToWeeklyCodeHelp();
+    void setToolTipToWeeklyCodeComplete();
+    void setToolTipToNewsHelp();
+    void resetToolTip();
 
-    void on_donate_link_button_clicked();
 
-    void on_game_button_clicked();
 
 private:
     Ui::StatusWidget *ui;

File diff suppressed because it is too large
+ 432 - 869
src/Legacy/widgets/statuswidget.ui


+ 0 - 62
src/Legacy/widgets/tooltiplabel.cpp

@@ -1,62 +0,0 @@
-#include "tooltiplabel.h"
-#include "ui_tooltiplabel.h"
-
-#include <QtConcurrent/QtConcurrent>
-
-TooltipLabel::TooltipLabel(QWidget *parent) :
-    QWidget(parent),
-    ui(new Ui::TooltipLabel)
-{
-    ui->setupUi(this);
-    effect.setOpacity(0);
-    setGraphicsEffect(&effect);
-    QWidget::show();
-    isHidden = true;
-}
-
-TooltipLabel::~TooltipLabel()
-{
-    delete ui;
-}
-
-void TooltipLabel::show()
-{
-    isHidden = false;
-    QtConcurrent::run([this](){
-        const int iterations_num = 20;
-        const int iteration_sleep = 10;
-
-        for (int i = 0; i < iterations_num && qApp && !isHidden; ++i) {
-            qreal opacity = double(i) / 20.0;
-            effect.setOpacity(opacity);
-            QMetaObject::invokeMethod(this, "updateOpacity", Qt::QueuedConnection, Q_ARG(qreal, opacity));
-            QThread::msleep(iteration_sleep);
-        }
-    });
-}
-
-void TooltipLabel::hide()
-{
-    isHidden = true;
-    QtConcurrent::run([this](){
-        const int iterations_num = 20;
-        const int iteration_sleep = 10;
-
-        for (int i = iterations_num - 1; i >= 0 && qApp && isHidden; --i) {
-            qreal opacity = double(i) / 20.0;
-            QMetaObject::invokeMethod(this, "updateOpacity", Qt::QueuedConnection, Q_ARG(qreal, opacity));
-            QThread::msleep(iteration_sleep);
-        }
-    });
-}
-
-void TooltipLabel::updateText(QString text)
-{
-    ui->label_small->setText(text);
-}
-
-void TooltipLabel::updateOpacity(double opacity)
-{
-    effect.setOpacity(opacity);
-    setGraphicsEffect(&effect);
-}

+ 0 - 176
src/Legacy/widgets/tooltiplabel.ui

@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>TooltipLabel</class>
- <widget class="QWidget" name="TooltipLabel">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>499</width>
-    <height>396</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <property name="leftMargin">
-    <number>0</number>
-   </property>
-   <property name="topMargin">
-    <number>0</number>
-   </property>
-   <property name="rightMargin">
-    <number>0</number>
-   </property>
-   <property name="bottomMargin">
-    <number>0</number>
-   </property>
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <item row="0" column="0">
-    <widget class="QWidget" name="widget" native="true">
-     <property name="minimumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-topleft.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QWidget" name="widget_4" native="true">
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-top.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="2">
-    <widget class="QWidget" name="widget_8" native="true">
-     <property name="minimumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-topright.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QWidget" name="widget_2" native="true">
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-left.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QWidget" name="content" native="true">
-     <property name="styleSheet">
-      <string notr="true">QWidget#content{
-border-image: url(:/backgrounds/translucent54-background.png);
-}</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_small">
-        <property name="styleSheet">
-         <string notr="true">color:white;</string>
-        </property>
-        <property name="text">
-         <string>TextLabel</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-        <property name="wordWrap">
-         <bool>true</bool>
-        </property>
-        <property name="openExternalLinks">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="1" column="2">
-    <widget class="QWidget" name="widget_9" native="true">
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-right.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QWidget" name="widget_3" native="true">
-     <property name="minimumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-botleft.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1">
-    <widget class="QWidget" name="widget_6" native="true">
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-bottom.png);</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="2">
-    <widget class="QWidget" name="widget_7" native="true">
-     <property name="minimumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>8</width>
-       <height>8</height>
-      </size>
-     </property>
-     <property name="styleSheet">
-      <string notr="true">border-image: url(:/backgrounds/translucent54-border-botright.png);</string>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 21 - 54
src/Legacy/widgets/weeklycodewidget.cpp

@@ -1,3 +1,5 @@
+#include "widgets/weeklycodewidget.h"
+#include "ui_weeklycodewidget.h"
 #include "weeklycodewidget.h"
 #include <QApplication>
 #include <QtConcurrent/QtConcurrent>
@@ -5,13 +7,13 @@
 #include <QPaintEvent>
 #include <QClipboard>
 
-WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) : QLabel(parent)
+WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) :
+    QWidget(parent), ui(new Ui::WeeklyCodeWidget)
 {
     setAttribute(Qt::WA_Hover);
     setMouseTracking(true);
-    current_bg = QPixmap(":/buttons/lotr_circle.png").scaled(130, 130);
-    changeImageSrc(":/buttons/lotr_circle.png");
-    setText("ЗАГРУЗКА");
+    ui->setupUi(this);
+    ui->code->setText("загрузка...");
     code_data = "";
 
     code_downloader.targetBytearray = &code_data;
@@ -24,68 +26,34 @@ WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) : QLabel(parent)
     code_update_timer.start();
 }
 
-void WeeklyCodeWidget::changeImageSrc(const QString &src)
+WeeklyCodeWidget::~WeeklyCodeWidget()
 {
-    if (!qApp)
-        return;
-
-    img_src = src;
-    QPixmap *cur_bg = new QPixmap(current_bg.scaled(130, 130));
-    QPixmap *new_bg= new QPixmap(QPixmap(src).scaled(130, 130));
-
-    QtConcurrent::run([cur_bg, new_bg, src, this](){
-        const int iterations_num = 50;
-        const int iteration_sleep = 40;
-
-        for (int i = 0; i < iterations_num && qApp; i++) {
-            if (img_src != src)
-                break;
-
-            QPainter painter;
-            painter.begin(cur_bg);
-            painter.setOpacity(double(10 + i) / double(iterations_num));
-            painter.setCompositionMode(QPainter::CompositionMode_Source);
-            painter.drawPixmap(0,0, *new_bg);
-            painter.end();
-            bg_lock.lock();
-            current_bg = *cur_bg;
-            bg_lock.unlock();
-            QMetaObject::invokeMethod(this, "repaint", Qt::QueuedConnection);
-            QThread::msleep(iteration_sleep);
-        }
-        delete cur_bg;
-        delete new_bg;
-    });
-
+    delete ui;
 }
 
 void WeeklyCodeWidget::enterEvent(QEvent * event)
 {
-    changeImageSrc(":/buttons/lotr_circle_hover.png");
     QWidget::enterEvent(event);
     event->ignore();
-    emit mouseEntered("<a href='http://www.lotro-mindon.ru/content/kak-poluchit-ezhenedelnyy-podarok'>Код недели.</a>\nНажмите, чтобы скопировать в буфер обмена");
-}
-
-void WeeklyCodeWidget::paintEvent(QPaintEvent *event)
-{
-    QPainter painter;
-    painter.begin(this);
-    painter.drawPixmap(0,0, current_bg);
-    painter.end();
-    QLabel::paintEvent(event);
+    if (QApplication::clipboard()->text() == ui->code->text())
+        emit showCompletedTooltip();
+    else
+        emit showHelpTooltip();
 }
 
 void WeeklyCodeWidget::mousePressEvent(QMouseEvent *ev)
 {
-    setStyleSheet("color: rgb(255, 150, 0);");
+    ui->code->setStyleSheet("color: rgb(255, 150, 0);");
     ev->ignore();
 }
 
 void WeeklyCodeWidget::mouseReleaseEvent(QMouseEvent *ev)
 {
-    setStyleSheet("color: rgb(255, 180, 0);");
-    QApplication::clipboard()->setText(text());
+    ui->code->setStyleSheet("color: rgb(255, 180, 0);");
+    if (ui->code->text() != "загрузка...") {
+        QApplication::clipboard()->setText(ui->code->text());
+        emit showCompletedTooltip();
+    }
     ev->ignore();
 }
 
@@ -95,15 +63,14 @@ void WeeklyCodeWidget::updateCode()
     if (code_data.isEmpty())
         return;
 
-    setText(code_data);
+    ui->code->setText(code_data);
     repaint();
     code_data = "";
 }
 
 void WeeklyCodeWidget::leaveEvent(QEvent * event)
 {
-    qDebug() << Q_FUNC_INFO << this->objectName();
-    changeImageSrc(":/buttons/lotr_circle.png");
-    emit mouseLeaved();
+//    qDebug() << Q_FUNC_INFO << this->objectName();
+    emit showNoTooltip();
 }
 

+ 13 - 14
src/Legacy/widgets/weeklycodewidget.h

@@ -1,40 +1,39 @@
 #ifndef WEEKLYCODEWIDGET_H
 #define WEEKLYCODEWIDGET_H
 
-#include <QLabel>
-#include <QMutex>
+#include <QWidget>
 #include <QTimer>
 
 #include "models/downloader.h"
 
-class WeeklyCodeWidget : public QLabel
+namespace Ui {
+class WeeklyCodeWidget;
+}
+
+class WeeklyCodeWidget : public QWidget
 {
     Q_OBJECT
+
 public:
-    explicit WeeklyCodeWidget(QWidget* parent = nullptr);
+    explicit WeeklyCodeWidget(QWidget *parent = 0);
+    ~WeeklyCodeWidget();
 
 protected:
     virtual void leaveEvent(QEvent * event) override;
     virtual void enterEvent(QEvent * event) override;
-    virtual void paintEvent(QPaintEvent *event) override;
     virtual void mousePressEvent(QMouseEvent *ev) override;
     virtual void mouseReleaseEvent(QMouseEvent *ev) override;
 
 signals:
-    void mouseEntered(QString tooltip);
-    void mouseLeaved();
+    void showHelpTooltip();
+    void showCompletedTooltip();
+    void showNoTooltip();
 
 public slots:
     void updateCode();
 
-private slots:
-    void changeImageSrc(const QString& src);
-
 private:
-    QMutex bg_lock;
-    QString img_src;
-    QPixmap current_bg;
-
+    Ui::WeeklyCodeWidget *ui;
     QByteArray code_data;
     QTimer code_update_timer;
     Downloader code_downloader;

+ 114 - 0
src/Legacy/widgets/weeklycodewidget.ui

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WeeklyCodeWidget</class>
+ <widget class="QWidget" name="WeeklyCodeWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>320</width>
+    <height>240</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="weekly_code_widget_content" native="true">
+     <property name="cursor">
+      <cursorShape>PointingHandCursor</cursorShape>
+     </property>
+     <property name="autoFillBackground">
+      <bool>false</bool>
+     </property>
+     <property name="styleSheet">
+      <string notr="true">QWidget#weekly_code_widget_content{
+background-color:rgba(0,0,0,100);
+border-radius: 5px;
+border: 2px solid qlineargradient(spread:reflect, x1:1, y1:1, x2:0, y2:1, stop:0 rgba(33, 24, 12, 255), stop:0.5 rgba(126, 97, 61, 255), stop:1 rgba(33, 24, 1, 255));
+}</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <property name="leftMargin">
+       <number>10</number>
+      </property>
+      <property name="topMargin">
+       <number>5</number>
+      </property>
+      <property name="rightMargin">
+       <number>10</number>
+      </property>
+      <property name="bottomMargin">
+       <number>5</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="title">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>9</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color:white</string>
+        </property>
+        <property name="text">
+         <string>код недели:</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="code">
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>10</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+          <stylestrategy>PreferAntialias</stylestrategy>
+          <kerning>false</kerning>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color:#ffaa5e;</string>
+        </property>
+        <property name="text">
+         <string>TextLabel</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

Some files were not shown because too many files changed in this diff