浏览代码

First version on Galadriel tooltip realisation

Ivan Arkhipov 4 年之前
父节点
当前提交
0df2d1feda

+ 5 - 9
src/Legacy/widgets/serverstatuswidget.cpp

@@ -63,7 +63,7 @@ void ServerStatusWidget::leaveEvent(QEvent *event)
 void ServerStatusWidget::enterEvent(QEvent *event)
 {
     event->ignore();
-    emit showServersTooltip();
+    emit showServersTooltip(server_status_tooltip_);
 }
 
 void ServerStatusWidget::updateStatus()
@@ -103,13 +103,11 @@ void ServerStatusWidget::updateStatus()
 void ServerStatusWidget::updateTechWorksMessage()
 {
     if (tech_work_message_data.isEmpty()) {
-        QString result;
         if (!servers_disabled) {
-            result = "ИГРОВЫЕ СЕРВЕРЫ LOTRO РАБОТАЮТ В ШТАТНОМ РЕЖИМЕ";
+            server_status_tooltip_ = "ИГРОВЫЕ СЕРВЕРЫ LOTRO РАБОТАЮТ В ШТАТНОМ РЕЖИМЕ";
         } else {
-            result = "<p style =\"color:#ff0000\">СЕРВЕРЫ ИГРЫ ОТКЛЮЧЕНЫ</p>";
+            server_status_tooltip_ = "<p style =\"color:#ff0000\">СЕРВЕРЫ ИГРЫ ОТКЛЮЧЕНЫ</p>";
         }
-        emit updateServersTooltip(result);
         tech_work_message_data = "";
         return;
     }
@@ -125,13 +123,11 @@ void ServerStatusWidget::updateTechWorksMessage()
     QString day = "<span style =\"font-family:Trajan Pro 3\">" + list[2] + "</span>";
     QString month = QString(" " + list[3]).toUpper();
 
-    QString result;
     if (!servers_disabled) {
-        result = "<p style=\"color:#ffff7f\">ПЛАНИРУЕТСЯ ОТКЛЮЧЕНИЕ СЕРВЕРОВ ИГРЫ " + day + month + " С " + time_beginning + " ДО " + time_end+ " (МСК).</p>";
+        server_status_tooltip_ = "<p style=\"color:#ffff7f\">ПЛАНИРУЕТСЯ ОТКЛЮЧЕНИЕ СЕРВЕРОВ ИГРЫ " + day + month + " С " + time_beginning + " ДО " + time_end+ " (МСК).</p>";
     } else {
-        result = "<p style=\"color:#ff0000\">СЕРВЕРЫ ИГРЫ ОТКЛЮЧЕНЫ<br>ВРЕМЯ ПРОФ.РАБОТ: " + day + month + " С " + time_beginning + " ДО " + time_end + " (МСК).</p>";
+        server_status_tooltip_ = "<p style=\"color:#ff0000\">СЕРВЕРЫ ИГРЫ ОТКЛЮЧЕНЫ<br>ВРЕМЯ ПРОФ.РАБОТ: " + day + month + " С " + time_beginning + " ДО " + time_end + " (МСК).</p>";
     }
 
     tech_work_message_data = "";
-    emit updateServersTooltip(result);
 }

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

@@ -22,9 +22,8 @@ public slots:
     void updateFontsSizes();
 
 signals:
-    void showServersTooltip();
+    void showServersTooltip(QString tooltip);
     void showNoTooltip();
-    void updateServersTooltip(QString tooltip);
 
 protected:
     void resizeEvent(QResizeEvent *event) override;
@@ -36,6 +35,7 @@ public slots:
     void updateTechWorksMessage();
 
 private:
+    QString server_status_tooltip_;
     QTimer update_timer;
 
     Downloader status_downloader;

+ 183 - 190
src/Legacy/widgets/statuswidget.cpp

@@ -17,38 +17,27 @@ StatusWidget::StatusWidget(PatchList *legacy_patches, QWidget *parent)
     , ui(new Ui::StatusWidget)
     , legacy_patches_(legacy_patches)
 {
-
     ui->setupUi(this);
     last_statusbar_update_time_.start();
 
-    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->weekly_code_widget, &WeeklyCodeWidget::showCompletedTooltip, this, [this](){setToolTipMessage("ЕЖЕНЕДЕЛЬНЫЙ КОД СКОПИРОВАН В БУФЕР ОБМЕНА", E_INFO);});
+    connect(ui->weekly_code_widget, &WeeklyCodeWidget::showHelpTooltip, this, [this](){setToolTipMessage("КЛИКНИТЕ ПО ЕЖЕНЕДЕЛЬНОМУ КОДУ, ЧТОБЫ СКОПИРОВАТЬ ЕГО", E_INFO);});
+    connect(ui->weekly_code_widget, &WeeklyCodeWidget::showNoTooltip, this, [this](){unsetToolTipMessage(E_INFO);});
 
-    connect(ui->news_list, &NewsListWidget::showHelpToolTip, this, &StatusWidget::setToolTipToNewsHelp);
-    connect(ui->news_list, &NewsListWidget::showNoToolTip, this, &StatusWidget::resetToolTip);
+    connect(ui->news_list, &NewsListWidget::showHelpToolTip, this, [this](){setToolTipMessage("НАЖМИТЕ НА ЗАГОЛОВОК НОВОСТИ, ЧТОБЫ ОТКРЫТЬ ЕЕ В БРАУЗЕРЕ", E_INFO);});
+    connect(ui->news_list, &NewsListWidget::showNoToolTip, this, [this](){unsetToolTipMessage(E_INFO);});
 
-    connect(ui->server_status_widget, &ServerStatusWidget::updateServersTooltip, ui->server_status_tooltip, &QLabel::setText);
-    connect(ui->server_status_widget, &ServerStatusWidget::showServersTooltip, this, &StatusWidget::setToolTipToServersStatus);
-    connect(ui->server_status_widget, &ServerStatusWidget::showNoTooltip, this, &StatusWidget::resetToolTip);
+    connect(ui->server_status_widget, &ServerStatusWidget::showServersTooltip, this, [this](QString message){setToolTipMessage(message, E_INFO);});
+    connect(ui->server_status_widget, &ServerStatusWidget::showNoTooltip, this, [this](){unsetToolTipMessage(E_INFO);});
 
-    tooltip_effects[ui->news_tooltip->objectName()] = new QGraphicsOpacityEffect(ui->news_tooltip);
-    tooltip_effects[ui->weekly_code_tooltip_1->objectName()] = new QGraphicsOpacityEffect(ui->weekly_code_tooltip_1);
-    tooltip_effects[ui->weekly_code_tooltip_2->objectName()] = new QGraphicsOpacityEffect(ui->weekly_code_tooltip_2);
-    tooltip_effects[ui->patches_status->objectName()] = new QGraphicsOpacityEffect(ui->patches_status);
-    tooltip_effects[ui->server_status_tooltip->objectName()] = new QGraphicsOpacityEffect(ui->server_status_tooltip);
+    tooltip_effects[ui->galadriel_tooltip_1->objectName()] = new QGraphicsOpacityEffect(ui->galadriel_tooltip_1);
+    tooltip_effects[ui->galadriel_tooltip_2->objectName()] = new QGraphicsOpacityEffect(ui->galadriel_tooltip_2);
 
-    tooltip_animations[ui->news_tooltip->objectName()] = new QPropertyAnimation(tooltip_effects[ui->news_tooltip->objectName()], "opacity");
-    tooltip_animations[ui->weekly_code_tooltip_1->objectName()] = new QPropertyAnimation(tooltip_effects[ui->weekly_code_tooltip_1->objectName()], "opacity");
-    tooltip_animations[ui->weekly_code_tooltip_2->objectName()] = new QPropertyAnimation(tooltip_effects[ui->weekly_code_tooltip_2->objectName()], "opacity");
-    tooltip_animations[ui->patches_status->objectName()] = new QPropertyAnimation(tooltip_effects[ui->patches_status->objectName()], "opacity");
-    tooltip_animations[ui->server_status_tooltip->objectName()] = new QPropertyAnimation(tooltip_effects[ui->server_status_tooltip->objectName()], "opacity");
+    tooltip_animations[ui->galadriel_tooltip_1->objectName()] = new QPropertyAnimation(tooltip_effects[ui->galadriel_tooltip_1->objectName()], "opacity");
+    tooltip_animations[ui->galadriel_tooltip_2->objectName()] = new QPropertyAnimation(tooltip_effects[ui->galadriel_tooltip_2->objectName()], "opacity");
 
-    ui->news_tooltip->setGraphicsEffect(tooltip_effects[ui->news_tooltip->objectName()]);
-    ui->weekly_code_tooltip_1->setGraphicsEffect(tooltip_effects[ui->weekly_code_tooltip_1->objectName()]);
-    ui->weekly_code_tooltip_2->setGraphicsEffect(tooltip_effects[ui->weekly_code_tooltip_2->objectName()]);
-    ui->patches_status->setGraphicsEffect(tooltip_effects[ui->patches_status->objectName()]);
-    ui->server_status_tooltip->setGraphicsEffect(tooltip_effects[ui->server_status_tooltip->objectName()]);
+    ui->galadriel_tooltip_1->setGraphicsEffect(tooltip_effects[ui->galadriel_tooltip_1->objectName()]);
+    ui->galadriel_tooltip_2->setGraphicsEffect(tooltip_effects[ui->galadriel_tooltip_2->objectName()]);
 
     foreach (QPropertyAnimation* animation, tooltip_animations) {
         animation->setDuration(350);
@@ -61,9 +50,6 @@ StatusWidget::StatusWidget(PatchList *legacy_patches, QWidget *parent)
         effect->setOpacity(0);
     }
 
-    active_tooltip = nullptr;
-    resetToolTip();
-
     connect(legacy_patches_, &PatchList::patchOperationsStarted, this, &StatusWidget::onPatchTotalOperationsStarted);
     connect(legacy_patches_, &PatchList::patchOperationsFinished, this, &StatusWidget::onPatchTotalOperationsFinished);
     connect(legacy_patches_, &PatchList::progressChanged, this, &StatusWidget::onPatchTotalProgressChanged);
@@ -82,23 +68,32 @@ StatusWidget::~StatusWidget()
 
 void StatusWidget::updateFontsSizes()
 {
-    ui->progress_label->setFont(crimson_10pt);
     ui->game_button->setFont(trajan_11pt);
     ui->news_label->setFont(trajan_10pt);
+}
 
-    ui->graphicspatch_label->setFont(crimson_11pt);
-    ui->graphicspatch_status->setFont(crimson_11pt);
-    ui->soundspatch_label->setFont(crimson_11pt);
-    ui->soundspatch_status->setFont(crimson_11pt);
-    ui->textspatch_label->setFont(crimson_11pt);
-    ui->textspatch_status->setFont(crimson_11pt);
-    ui->videospatch_label->setFont(crimson_11pt);
-    ui->videospatch_status->setFont(crimson_11pt);
-
-    ui->news_tooltip->setFont(garamond_11pt);
-    ui->weekly_code_tooltip_1->setFont(garamond_11pt);
-    ui->weekly_code_tooltip_2->setFont(garamond_11pt);
-    ui->server_status_tooltip->setFont(garamond_11pt);
+void StatusWidget::setToolTipMessage(QString message, StatusWidget::ToolTipState state)
+{
+    tooltip_messages_[state] = message;
+    tooltip_state_ = ToolTipState(int(tooltip_state_) | int(state));
+    if (tooltip_state_ < state * 2) {
+        fadeBetweenToolTips(message);
+    }
+}
+
+void StatusWidget::unsetToolTipMessage(StatusWidget::ToolTipState state)
+{
+    tooltip_state_ = ToolTipState(int(tooltip_state_) & (~int(state)));
+
+    if (tooltip_state_ & E_INFO) {
+        fadeBetweenToolTips(tooltip_messages_[E_INFO]);
+    } else if (tooltip_state_ & E_ERROR) {
+        fadeBetweenToolTips(tooltip_messages_[E_ERROR]);
+    } else if (tooltip_state_ & E_PROCESS) {
+        fadeBetweenToolTips(tooltip_messages_[E_PROCESS]);
+    } else {
+        fadeBetweenToolTips(tooltip_messages_[E_RANDOM]);
+    }
 }
 
 void StatusWidget::resizeEvent(QResizeEvent *)
@@ -136,49 +131,47 @@ void StatusWidget::resizeEvent(QResizeEvent *)
     updateFontsSizes();
 }
 
-void StatusWidget::setToolTipToWeeklyCodeHelp()
-{
-    fadeBetweenToolTips(ui->weekly_code_tooltip_1);
-}
-
-void StatusWidget::setToolTipToWeeklyCodeComplete()
-{
-    fadeBetweenToolTips(ui->weekly_code_tooltip_2);
-}
-
-void StatusWidget::setToolTipToNewsHelp()
-{
-    fadeBetweenToolTips(ui->news_tooltip);
-}
-
-void StatusWidget::setToolTipToServersStatus()
-{
-    fadeBetweenToolTips(ui->server_status_tooltip);
-}
-
-void StatusWidget::resetToolTip()
-{
-    fadeBetweenToolTips(ui->patches_status);
-}
-
-void StatusWidget::fadeBetweenToolTips(QWidget* next_tooltip)
+void StatusWidget::fadeBetweenToolTips(QString next_tooltip_message)
 {
-    if (active_tooltip) {
-        QPropertyAnimation* active_tooltip_anim = tooltip_animations[active_tooltip->objectName()];
-
-        active_tooltip_anim->setDirection(QAbstractAnimation::Backward);
-
-        if (active_tooltip_anim->state() == QAbstractAnimation::Stopped)
-            active_tooltip_anim->start();
+    if (!galadriel_tooltip_1_type) {
+        // Previous state:
+        // tooltip1 - hiding, tooltip2 - showing.
+        galadriel_tooltip_1_type = true;
+
+        ui->galadriel_tooltip_1->setText(next_tooltip_message);
+
+        qDebug() << "StatusWidget: Showing message: " << ui->galadriel_tooltip_1->text();
+        qDebug() << "StatusWidget: Hiding message: " << ui->galadriel_tooltip_2->text();
+
+        QPropertyAnimation* showing_anim = tooltip_animations[ui->galadriel_tooltip_1->objectName()];
+        showing_anim->setDirection(QAbstractAnimation::Forward);
+        if (showing_anim->state() == QAbstractAnimation::Stopped)
+            showing_anim->start();
+
+        QPropertyAnimation* hiding_anim = tooltip_animations[ui->galadriel_tooltip_2->objectName()];
+        hiding_anim->setDirection(QAbstractAnimation::Backward);
+        if (hiding_anim->state() == QAbstractAnimation::Stopped)
+            hiding_anim->start();
+    } else {
+        // Previous state:
+        // tooltip1 - showing, tooltip2 - hiding.
+        galadriel_tooltip_1_type = false;
+
+        ui->galadriel_tooltip_2->setText(next_tooltip_message);
+
+        qDebug() << "StatusWidget: Showing message: " << ui->galadriel_tooltip_2->text();
+        qDebug() << "StatusWidget: Hiding message: " << ui->galadriel_tooltip_1->text();
+
+        QPropertyAnimation* showing_anim = tooltip_animations[ui->galadriel_tooltip_2->objectName()];
+        showing_anim->setDirection(QAbstractAnimation::Forward);
+        if (showing_anim->state() == QAbstractAnimation::Stopped)
+            showing_anim->start();
+
+        QPropertyAnimation* hiding_anim = tooltip_animations[ui->galadriel_tooltip_1->objectName()];
+        hiding_anim->setDirection(QAbstractAnimation::Backward);
+        if (hiding_anim->state() == QAbstractAnimation::Stopped)
+            hiding_anim->start();
     }
-
-    QPropertyAnimation* next_active_tooltip_anim = tooltip_animations[next_tooltip->objectName()];
-    next_active_tooltip_anim->setDirection(QAbstractAnimation::Forward);
-
-    if (next_active_tooltip_anim->state() == QAbstractAnimation::Stopped)
-        next_active_tooltip_anim->start();
-
-    active_tooltip = next_tooltip;
 }
 
 void StatusWidget::onPatchTotalOperationsStarted()
@@ -194,83 +187,83 @@ void StatusWidget::onPatchTotalOperationsFinished()
     ui->game_button->setEnabled(true);
     ui->check_for_updates_button->setEnabled(true);
 
-    for (Patch* patch : legacy_patches_->getPatchList()) {
-        QString label_name = patch->getPatchName().toLower() + "_status";
-        QLabel *label = findChild<QLabel*>(label_name);
-        if (!label) {
-            return;
-        }
-
-        QString install_date;
-        if (!(install_date = Settings::getValue("UpdateDates/" + patch->getPatchName()).toString()).isEmpty()) {
-            label->setText("Патч версии от " + install_date);
-        } else {
-            label->setText("Все операции с патчем завершены.");
-        }
-    }
-
-    ui->progress_label->setText("");
+//    for (Patch* patch : legacy_patches_->getPatchList()) {
+//        QString label_name = patch->getPatchName().toLower() + "_status";
+//        QLabel *label = findChild<QLabel*>(label_name);
+//        if (!label) {
+//            return;
+//        }
+
+//        QString install_date;
+//        if (!(install_date = Settings::getValue("UpdateDates/" + patch->getPatchName()).toString()).isEmpty()) {
+//            label->setText("Патч версии от " + install_date);
+//        } else {
+//            label->setText("Все операции с патчем завершены.");
+//        }
+//    }
+
+//    ui->progress_label->setText("");
 }
 
 void StatusWidget::onPatchOperationStarted(Patch::Operation operation, Patch *patch)
 {
-    QString label_name = patch->getPatchName().toLower() + "_status";
-    QLabel *label = findChild<QLabel*>(label_name);
-    patch_operations[patch] = operation;
-    if (!label) {
-        return;
-    }
-
-    switch (operation) {
-    case Patch::E_CHECKFORUPDATES:
-        label->setText("Проверка наличия обновлений...");
-        break;
-    case Patch::E_DOWNLOAD:
-        label->setText("Подготовка к загрузке данных...");
-        break;
-    case Patch::E_INSTALL:
-        label->setText("Ожидание начала установки...");
-        break;
-    case Patch::E_ACTIVATE:
-        label->setText("Ожидание начала активации...");
-    default:
-        break;
-    }
+//    QString label_name = patch->getPatchName().toLower() + "_status";
+//    QLabel *label = findChild<QLabel*>(label_name);
+//    patch_operations[patch] = operation;
+//    if (!label) {
+//        return;
+//    }
+
+//    switch (operation) {
+//    case Patch::E_CHECKFORUPDATES:
+//        label->setText("Проверка наличия обновлений...");
+//        break;
+//    case Patch::E_DOWNLOAD:
+//        label->setText("Подготовка к загрузке данных...");
+//        break;
+//    case Patch::E_INSTALL:
+//        label->setText("Ожидание начала установки...");
+//        break;
+//    case Patch::E_ACTIVATE:
+//        label->setText("Ожидание начала активации...");
+//    default:
+//        break;
+//    }
 }
 
 void StatusWidget::onPatchOperationFinished(Patch::Operation operation, Patch *patch)
 {
-    if (all_patch_operations_finished_) {
-        return;
-    }
-
-    QString label_name = patch->getPatchName().toLower() + "_status";
-    QLabel *label = findChild<QLabel*>(label_name);
-
-    if (!label) {
-        return;
-    }
-
-    switch (operation) {
-    case Patch::E_CHECKFORUPDATES:
-        label->setText("Проверка обновлений завершена");
-        break;
-    case Patch::E_DOWNLOAD:
-        label->setText("Загрузка данных завершена");
-        break;
-    case Patch::E_INSTALL:
-        label->setText("Установка патча завершена");
-        break;
-    case Patch::E_ACTIVATE:
-        label->setText("Активация патча завершена");
-    default:
-        break;
-    }
+//    if (all_patch_operations_finished_) {
+//        return;
+//    }
+
+//    QString label_name = patch->getPatchName().toLower() + "_status";
+//    QLabel *label = findChild<QLabel*>(label_name);
+
+//    if (!label) {
+//        return;
+//    }
+
+//    switch (operation) {
+//    case Patch::E_CHECKFORUPDATES:
+//        label->setText("Проверка обновлений завершена");
+//        break;
+//    case Patch::E_DOWNLOAD:
+//        label->setText("Загрузка данных завершена");
+//        break;
+//    case Patch::E_INSTALL:
+//        label->setText("Установка патча завершена");
+//        break;
+//    case Patch::E_ACTIVATE:
+//        label->setText("Активация патча завершена");
+//    default:
+//        break;
+//    }
 }
 
 void StatusWidget::onPatchTotalProgressChanged(Patch::OperationProgress operation_progress)
 {
-    updateStatusBar(operation_progress);
+//    updateStatusBar(operation_progress);
 }
 
 void StatusWidget::on_game_button_clicked()
@@ -281,54 +274,54 @@ void StatusWidget::on_game_button_clicked()
 
 void StatusWidget::onPatchProgressChanged(Patch::OperationProgress progress, Patch *patch)
 {
-    QString label_name = patch->getPatchName().toLower() + "_status";
-    QLabel *label = findChild<QLabel*>(label_name);
-    if (!label) {
-        return;
-    }
-
-    switch (patch_operations[patch]) {
-    case Patch::E_CHECKFORUPDATES:
-        label->setText("Проверка наличия обновлений...");
-        break;
-    case Patch::E_DOWNLOAD:
-        label->setText("Загрузка... " + QString::number(progress.getDownloadPercent(), 'f', 1)
-                       + "% (" + Downloader::getSizeFormatted(progress.download_finished_bytes)
-                       + "/" + Downloader::getSizeFormatted(progress.download_total_bytes) + ")");
-        break;
-    case Patch::E_INSTALL:
-        label->setText("Установка... " + QString::number(progress.getInstallPercent(), 'f', 2)
-                       + "% (" + QString::number(progress.install_finished_parts) + "/" + QString::number(progress.install_total_parts) + ")");
-        break;
-    case Patch::E_ACTIVATE:
-        label->setText("Активация... " + QString::number(progress.getInstallPercent(), 'f', 2)
-                       + "% (" + QString::number(progress.install_finished_parts) + "/" + QString::number(progress.install_total_parts) + ")");
-    default:
-        break;
-    }
+//    QString label_name = patch->getPatchName().toLower() + "_status";
+//    QLabel *label = findChild<QLabel*>(label_name);
+//    if (!label) {
+//        return;
+//    }
+
+//    switch (patch_operations[patch]) {
+//    case Patch::E_CHECKFORUPDATES:
+//        label->setText("Проверка наличия обновлений...");
+//        break;
+//    case Patch::E_DOWNLOAD:
+//        label->setText("Загрузка... " + QString::number(progress.getDownloadPercent(), 'f', 1)
+//                       + "% (" + Downloader::getSizeFormatted(progress.download_finished_bytes)
+//                       + "/" + Downloader::getSizeFormatted(progress.download_total_bytes) + ")");
+//        break;
+//    case Patch::E_INSTALL:
+//        label->setText("Установка... " + QString::number(progress.getInstallPercent(), 'f', 2)
+//                       + "% (" + QString::number(progress.install_finished_parts) + "/" + QString::number(progress.install_total_parts) + ")");
+//        break;
+//    case Patch::E_ACTIVATE:
+//        label->setText("Активация... " + QString::number(progress.getInstallPercent(), 'f', 2)
+//                       + "% (" + QString::number(progress.install_finished_parts) + "/" + QString::number(progress.install_total_parts) + ")");
+//    default:
+//        break;
+//    }
 }
 
 
 void StatusWidget::updateStatusBar(Patch::OperationProgress progress)
 {
-    if (last_statusbar_update_time_.elapsed() > 500) {
-        QString text = "Выполнение операций...";
-        if (progress.download_total_bytes != 0) {
-            text += "\nЗагрузка данных: " + QString::number(progress.getDownloadPercent(), 'f', 1) + "% ("
-                    + Downloader::getSizeFormatted(progress.download_finished_bytes) + "/"
-                    + Downloader::getSizeFormatted(progress.download_total_bytes) + ", "
-                    + Downloader::getSpeedFormatted(progress.download_speed) + ")\n"
-                    + "До конца загрузки: " + Downloader::getElapsedTimeFormatted(progress.download_elapsed_time);
-        }
-
-        if (progress.install_total_parts != 0) {
-            text += "\nПрименение патчей: " + QString::number(progress.getInstallPercent()) + "% "
-                    + "(часть " + QString::number(progress.install_finished_parts + 1) + " из " + QString::number(progress.install_total_parts);
-        }
-
-        ui->progress_label->setText(text);
-        last_statusbar_update_time_.restart();
-    }
+//    if (last_statusbar_update_time_.elapsed() > 500) {
+//        QString text = "Выполнение операций...";
+//        if (progress.download_total_bytes != 0) {
+//            text += "\nЗагрузка данных: " + QString::number(progress.getDownloadPercent(), 'f', 1) + "% ("
+//                    + Downloader::getSizeFormatted(progress.download_finished_bytes) + "/"
+//                    + Downloader::getSizeFormatted(progress.download_total_bytes) + ", "
+//                    + Downloader::getSpeedFormatted(progress.download_speed) + ")\n"
+//                    + "До конца загрузки: " + Downloader::getElapsedTimeFormatted(progress.download_elapsed_time);
+//        }
+
+//        if (progress.install_total_parts != 0) {
+//            text += "\nПрименение патчей: " + QString::number(progress.getInstallPercent()) + "% "
+//                    + "(часть " + QString::number(progress.install_finished_parts + 1) + " из " + QString::number(progress.install_total_parts);
+//        }
+
+//        ui->progress_label->setText(text);
+//        last_statusbar_update_time_.restart();
+//    }
 }
 
 

+ 21 - 8
src/Legacy/widgets/statuswidget.h

@@ -7,6 +7,7 @@
 #include <QMap>
 #include <QPropertyAnimation>
 #include <QGraphicsOpacityEffect>
+#include <QLabel>
 
 #include "models/patchlist.h"
 
@@ -19,23 +20,29 @@ class StatusWidget : public QWidget
     Q_OBJECT
 
 public:
+    // States. Higher state value means higher priority on visualisation
+    enum ToolTipState : int {
+        E_INFO = 4,
+        E_ERROR = 2,
+        E_PROCESS = 1,
+        E_RANDOM = 0 // (state | E_RANDOM) should be always true (we can always show random message)
+    };
+
     explicit StatusWidget(PatchList *legacy_patches, QWidget *parent = 0);
     ~StatusWidget();
 
 public slots:
     void updateFontsSizes();
 
+    void setToolTipMessage(QString message, ToolTipState state);
+
+    void unsetToolTipMessage(ToolTipState state);
+
 protected:
     void resizeEvent(QResizeEvent *event) override;
 
 private slots:
-    void setToolTipToWeeklyCodeHelp();
-    void setToolTipToWeeklyCodeComplete();
-    void setToolTipToNewsHelp();
-    void setToolTipToServersStatus();
-    void resetToolTip();
-
-    void fadeBetweenToolTips(QWidget* next_tooltip);
+    void fadeBetweenToolTips(QString tooltip_message);
 
     void onPatchTotalOperationsStarted();
     void onPatchTotalOperationsFinished();
@@ -62,10 +69,16 @@ private:
 
     QMap<QString, QGraphicsOpacityEffect*> tooltip_effects;
     QMap<QString, QPropertyAnimation*> tooltip_animations;
+
+    bool galadriel_tooltip_1_type = false; // false = hiding, true - showing. Tooltip 2 is always opposite to tooltip 1
+
     QMap<Patch*, Patch::Operation> patch_operations;
-    QWidget* active_tooltip;
 
     QTime last_statusbar_update_time_;
+
+    ToolTipState tooltip_state_ = E_RANDOM;
+    QMap<ToolTipState, QString> tooltip_messages_;
+
 };
 
 #endif // STATUSWIDGET_H

+ 14 - 307
src/Legacy/widgets/statuswidget.ui

@@ -157,12 +157,12 @@ QScrollBar:vertical {
 border-image: url(:/characters/galadriel_with_text.png);
 }</string>
    </property>
-   <widget class="QLabel" name="weekly_code_tooltip_1">
+   <widget class="QLabel" name="galadriel_tooltip_2">
     <property name="geometry">
      <rect>
       <x>29</x>
       <y>17</y>
-      <width>396</width>
+      <width>371</width>
       <height>114</height>
      </rect>
     </property>
@@ -174,10 +174,10 @@ border-image: url(:/characters/galadriel_with_text.png);
      </font>
     </property>
     <property name="styleSheet">
-     <string/>
+     <string notr="true"/>
     </property>
     <property name="text">
-     <string>КЛИКНИТЕ ПО ЕЖЕНЕДЕЛЬНОМУ КОДУ, ЧТОБЫ СКОПИРОВАТЬ ЕГО</string>
+     <string>TEST TOOLTIP USED FOR STYLE DESC</string>
     </property>
     <property name="alignment">
      <set>Qt::AlignCenter</set>
@@ -186,41 +186,28 @@ border-image: url(:/characters/galadriel_with_text.png);
      <bool>true</bool>
     </property>
    </widget>
-   <widget class="QLabel" name="news_tooltip">
+   <widget class="QToolButton" name="check_for_updates_button">
     <property name="geometry">
      <rect>
-      <x>29</x>
-      <y>17</y>
-      <width>396</width>
-      <height>114</height>
+      <x>0</x>
+      <y>470</y>
+      <width>32</width>
+      <height>32</height>
      </rect>
     </property>
-    <property name="font">
-     <font>
-      <family>EB Garamond</family>
-      <pointsize>12</pointsize>
-      <italic>false</italic>
-     </font>
-    </property>
     <property name="styleSheet">
-     <string notr="true"/>
+     <string notr="true">border-image: url(:/buttons/restart.png);</string>
     </property>
     <property name="text">
-     <string>НАЖМИТЕ НА ЗАГОЛОВОК НОВОСТИ, ЧТОБЫ ОТКРЫТЬ ЕЁ В БРАУЗЕРЕ</string>
-    </property>
-    <property name="alignment">
-     <set>Qt::AlignCenter</set>
-    </property>
-    <property name="wordWrap">
-     <bool>true</bool>
+     <string/>
     </property>
    </widget>
-   <widget class="QLabel" name="weekly_code_tooltip_2">
+   <widget class="QLabel" name="galadriel_tooltip_1">
     <property name="geometry">
      <rect>
       <x>29</x>
       <y>17</y>
-      <width>396</width>
+      <width>371</width>
       <height>114</height>
      </rect>
     </property>
@@ -231,235 +218,11 @@ border-image: url(:/characters/galadriel_with_text.png);
       <italic>false</italic>
      </font>
     </property>
-    <property name="styleSheet">
-     <string/>
-    </property>
-    <property name="text">
-     <string>ЕЖЕНЕДЕЛЬНЫЙ КОД СКОПИРОВАН В БУФЕР ОБМЕНА</string>
-    </property>
-    <property name="alignment">
-     <set>Qt::AlignCenter</set>
-    </property>
-    <property name="wordWrap">
-     <bool>true</bool>
-    </property>
-   </widget>
-   <widget class="QWidget" name="patches_status" native="true">
-    <property name="geometry">
-     <rect>
-      <x>29</x>
-      <y>17</y>
-      <width>396</width>
-      <height>114</height>
-     </rect>
-    </property>
-    <layout class="QGridLayout" name="gridLayout">
-     <property name="leftMargin">
-      <number>11</number>
-     </property>
-     <property name="topMargin">
-      <number>0</number>
-     </property>
-     <property name="rightMargin">
-      <number>11</number>
-     </property>
-     <property name="bottomMargin">
-      <number>0</number>
-     </property>
-     <property name="horizontalSpacing">
-      <number>7</number>
-     </property>
-     <property name="verticalSpacing">
-      <number>5</number>
-     </property>
-     <item row="0" column="1">
-      <widget class="QLabel" name="textspatch_status">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>поиск и проверка обновлений...</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="graphicspatch_label">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>Картинки:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="0">
-      <widget class="QLabel" name="textspatch_label">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>Тексты:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="1">
-      <widget class="QLabel" name="soundspatch_status">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>получение информации...</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="soundspatch_label">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>Озвучка:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1">
-      <widget class="QLabel" name="graphicspatch_status">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>получение информации...</string>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="1">
-      <widget class="QLabel" name="videospatch_status">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>получение информации...</string>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="videospatch_label">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="font">
-        <font>
-         <family>Crimson Text</family>
-         <pointsize>11</pointsize>
-        </font>
-       </property>
-       <property name="text">
-        <string>Ролики:</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="2" rowspan="4">
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>0</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </widget>
-   <widget class="QLabel" name="server_status_tooltip">
-    <property name="geometry">
-     <rect>
-      <x>29</x>
-      <y>17</y>
-      <width>396</width>
-      <height>114</height>
-     </rect>
-    </property>
-    <property name="font">
-     <font>
-      <family>Crimson Text</family>
-      <pointsize>15</pointsize>
-      <italic>false</italic>
-     </font>
-    </property>
     <property name="styleSheet">
      <string notr="true"/>
     </property>
     <property name="text">
-     <string>Получение информации об игровых серверах...</string>
+     <string>TEST TOOLTIP USED FOR STYLE DESC</string>
     </property>
     <property name="alignment">
      <set>Qt::AlignCenter</set>
@@ -468,62 +231,6 @@ border-image: url(:/characters/galadriel_with_text.png);
      <bool>true</bool>
     </property>
    </widget>
-   <widget class="QLabel" name="progress_label">
-    <property name="geometry">
-     <rect>
-      <x>0</x>
-      <y>420</y>
-      <width>381</width>
-      <height>90</height>
-     </rect>
-    </property>
-    <property name="sizePolicy">
-     <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-      <horstretch>0</horstretch>
-      <verstretch>0</verstretch>
-     </sizepolicy>
-    </property>
-    <property name="font">
-     <font>
-      <family>Trajan Pro 3</family>
-      <pointsize>9</pointsize>
-      <weight>50</weight>
-      <bold>false</bold>
-     </font>
-    </property>
-    <property name="text">
-     <string/>
-    </property>
-    <property name="alignment">
-     <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
-    </property>
-    <property name="wordWrap">
-     <bool>false</bool>
-    </property>
-   </widget>
-   <widget class="QToolButton" name="check_for_updates_button">
-    <property name="geometry">
-     <rect>
-      <x>0</x>
-      <y>470</y>
-      <width>32</width>
-      <height>32</height>
-     </rect>
-    </property>
-    <property name="styleSheet">
-     <string notr="true">border-image: url(:/buttons/restart.png);</string>
-    </property>
-    <property name="text">
-     <string/>
-    </property>
-   </widget>
-   <zorder>weekly_code_tooltip_1</zorder>
-   <zorder>news_tooltip</zorder>
-   <zorder>weekly_code_tooltip_2</zorder>
-   <zorder>server_status_tooltip</zorder>
-   <zorder>patches_status</zorder>
-   <zorder>progress_label</zorder>
-   <zorder>check_for_updates_button</zorder>
   </widget>
   <widget class="QPushButton" name="game_button">
    <property name="geometry">