|
@@ -1,3 +1,4 @@
|
|
|
|
+#include "ui_statuswidget.h"
|
|
#include "statuswidget.h"
|
|
#include "statuswidget.h"
|
|
|
|
|
|
#include "models/patchlist.h"
|
|
#include "models/patchlist.h"
|
|
@@ -10,68 +11,38 @@
|
|
#include <QUrl>
|
|
#include <QUrl>
|
|
#include <QDebug>
|
|
#include <QDebug>
|
|
#include <QMessageBox>
|
|
#include <QMessageBox>
|
|
|
|
+#include <QRandomGenerator>
|
|
|
|
|
|
StatusWidget::StatusWidget(PatchList *legacy_patches, QWidget *parent)
|
|
StatusWidget::StatusWidget(PatchList *legacy_patches, QWidget *parent)
|
|
: QWidget(parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::StatusWidget)
|
|
, ui(new Ui::StatusWidget)
|
|
, legacy_patches_(legacy_patches)
|
|
, legacy_patches_(legacy_patches)
|
|
{
|
|
{
|
|
-
|
|
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
last_statusbar_update_time_.start();
|
|
last_statusbar_update_time_.start();
|
|
|
|
+ ui->galadriel_tooltip_example->hide();
|
|
|
|
|
|
- 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);
|
|
|
|
-
|
|
|
|
- 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);
|
|
|
|
-
|
|
|
|
- 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_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");
|
|
|
|
-
|
|
|
|
- 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()]);
|
|
|
|
-
|
|
|
|
- foreach (QPropertyAnimation* animation, tooltip_animations) {
|
|
|
|
- animation->setDuration(350);
|
|
|
|
- animation->setStartValue(0);
|
|
|
|
- animation->setEndValue(1);
|
|
|
|
- animation->setDirection(QAbstractAnimation::Forward);
|
|
|
|
- }
|
|
|
|
|
|
+ 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);});
|
|
|
|
|
|
- foreach (QGraphicsOpacityEffect* effect, tooltip_effects) {
|
|
|
|
- effect->setOpacity(0);
|
|
|
|
- }
|
|
|
|
|
|
+ connect(ui->news_list, &NewsListWidget::showHelpToolTip, this, [this](){setToolTipMessage("НАЖМИТЕ НА ЗАГОЛОВОК НОВОСТИ, ЧТОБЫ ОТКРЫТЬ ЕЕ В БРАУЗЕРЕ", E_INFO);});
|
|
|
|
+ connect(ui->news_list, &NewsListWidget::showNoToolTip, this, [this](){unsetToolTipMessage(E_INFO);});
|
|
|
|
|
|
- active_tooltip = nullptr;
|
|
|
|
- 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);});
|
|
|
|
|
|
connect(legacy_patches_, &PatchList::patchOperationsStarted, this, &StatusWidget::onPatchTotalOperationsStarted);
|
|
connect(legacy_patches_, &PatchList::patchOperationsStarted, this, &StatusWidget::onPatchTotalOperationsStarted);
|
|
connect(legacy_patches_, &PatchList::patchOperationsFinished, this, &StatusWidget::onPatchTotalOperationsFinished);
|
|
connect(legacy_patches_, &PatchList::patchOperationsFinished, this, &StatusWidget::onPatchTotalOperationsFinished);
|
|
- connect(legacy_patches_, &PatchList::progressChanged, this, &StatusWidget::onPatchTotalProgressChanged);
|
|
|
|
|
|
+ connect(legacy_patches_, &PatchList::progressChanged, this, &StatusWidget::updatePatchProgressStatus);
|
|
|
|
|
|
- foreach (Patch* patch, legacy_patches_->getPatchList()) {
|
|
|
|
- connect(patch, &Patch::progressChanged, this, &StatusWidget::onPatchProgressChanged);
|
|
|
|
- connect(patch, &Patch::operationStarted, this, &StatusWidget::onPatchOperationStarted);
|
|
|
|
- connect(patch, &Patch::operationFinished, this, &StatusWidget::onPatchOperationFinished);
|
|
|
|
- }
|
|
|
|
|
|
+ generateRandomTooltipMessage();
|
|
|
|
+ random_tooltip_generator_timer_.setInterval(5 * 1000);
|
|
|
|
+ connect(&random_tooltip_generator_timer_, &QTimer::timeout, this, &StatusWidget::generateRandomTooltipMessage);
|
|
|
|
+ random_tooltip_generator_timer_.start();
|
|
|
|
+
|
|
|
|
+ process_completed_tooltip_hide_timer_.setInterval(10 * 1000); // 10 seconds message "Installation completed" will be shown
|
|
|
|
+ connect(&process_completed_tooltip_hide_timer_, &QTimer::timeout, this, [this](){unsetToolTipMessage(E_PROCESS);});
|
|
}
|
|
}
|
|
|
|
|
|
StatusWidget::~StatusWidget()
|
|
StatusWidget::~StatusWidget()
|
|
@@ -81,23 +52,54 @@ StatusWidget::~StatusWidget()
|
|
|
|
|
|
void StatusWidget::updateFontsSizes()
|
|
void StatusWidget::updateFontsSizes()
|
|
{
|
|
{
|
|
- ui->progress_label->setFont(crimson_10pt);
|
|
|
|
ui->game_button->setFont(trajan_11pt);
|
|
ui->game_button->setFont(trajan_11pt);
|
|
ui->news_label->setFont(trajan_10pt);
|
|
ui->news_label->setFont(trajan_10pt);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void StatusWidget::setToolTipMessage(QString message, StatusWidget::ToolTipState state)
|
|
|
|
+{
|
|
|
|
+ tooltip_messages_[state] = message;
|
|
|
|
+ tooltip_state_ = ToolTipState(int(tooltip_state_) | int(state));
|
|
|
|
+
|
|
|
|
+ QString message_id = message;
|
|
|
|
+ if (state == E_PROCESS) {
|
|
|
|
+ message_id = "E_PROCESS";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!tooltip_widgets_.contains(message_id)) {
|
|
|
|
+ createTooltipMessageWidget(message_id);
|
|
|
|
+ }
|
|
|
|
+ tooltip_widgets_[message_id]->setText(message);
|
|
|
|
+
|
|
|
|
+ if (tooltip_state_ < state * 2) {
|
|
|
|
+ fadeBetweenToolTips(message_id);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void StatusWidget::unsetToolTipMessage(StatusWidget::ToolTipState state)
|
|
|
|
+{
|
|
|
|
+ tooltip_state_ = ToolTipState(int(tooltip_state_) & (~int(state)));
|
|
|
|
+
|
|
|
|
+ ToolTipState showing_state = E_RANDOM;
|
|
|
|
+
|
|
|
|
+ if (tooltip_state_ & E_INFO) {
|
|
|
|
+ showing_state = E_INFO;
|
|
|
|
+ } else if (tooltip_state_ & E_ERROR) {
|
|
|
|
+ showing_state = E_ERROR;
|
|
|
|
+ } else if (tooltip_state_ & E_PROCESS) {
|
|
|
|
+ showing_state = E_PROCESS;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QString message_id = tooltip_messages_[showing_state];
|
|
|
|
+ if (showing_state == E_PROCESS) {
|
|
|
|
+ message_id = "E_PROCESS";
|
|
|
|
+ }
|
|
|
|
|
|
- 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);
|
|
|
|
|
|
+ if (!tooltip_widgets_.contains(message_id)) {
|
|
|
|
+ createTooltipMessageWidget(message_id);
|
|
|
|
+ }
|
|
|
|
+ tooltip_widgets_[message_id]->setText(tooltip_messages_[showing_state]);
|
|
|
|
+ fadeBetweenToolTips(message_id);
|
|
}
|
|
}
|
|
|
|
|
|
void StatusWidget::resizeEvent(QResizeEvent *)
|
|
void StatusWidget::resizeEvent(QResizeEvent *)
|
|
@@ -135,139 +137,59 @@ void StatusWidget::resizeEvent(QResizeEvent *)
|
|
updateFontsSizes();
|
|
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()
|
|
|
|
|
|
+void StatusWidget::generateRandomTooltipMessage()
|
|
{
|
|
{
|
|
- fadeBetweenToolTips(ui->server_status_tooltip);
|
|
|
|
|
|
+ quint32 number = QRandomGenerator::system()->generate();
|
|
|
|
+ setToolTipMessage("СЛУЧАЙНОЕ СООБЩЕНИЕ №" + QString::number(number), E_RANDOM);
|
|
}
|
|
}
|
|
|
|
|
|
-void StatusWidget::resetToolTip()
|
|
|
|
|
|
+void StatusWidget::fadeBetweenToolTips(QString tooltip_id)
|
|
{
|
|
{
|
|
- fadeBetweenToolTips(ui->patches_status);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void StatusWidget::fadeBetweenToolTips(QWidget* next_tooltip)
|
|
|
|
-{
|
|
|
|
- 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 (tooltip_id == current_tooltip_message_) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
- QPropertyAnimation* next_active_tooltip_anim = tooltip_animations[next_tooltip->objectName()];
|
|
|
|
- next_active_tooltip_anim->setDirection(QAbstractAnimation::Forward);
|
|
|
|
|
|
+ QPropertyAnimation* showing_anim = tooltip_animations_[tooltip_id];
|
|
|
|
+ showing_anim->setDirection(QAbstractAnimation::Forward);
|
|
|
|
+ if (showing_anim->state() == QAbstractAnimation::Stopped) {
|
|
|
|
+ showing_anim->start();
|
|
|
|
+ }
|
|
|
|
|
|
- if (next_active_tooltip_anim->state() == QAbstractAnimation::Stopped)
|
|
|
|
- next_active_tooltip_anim->start();
|
|
|
|
|
|
+ if (tooltip_widgets_.contains(current_tooltip_message_)) {
|
|
|
|
+ QString msg = current_tooltip_message_;
|
|
|
|
+ connect(tooltip_animations_[current_tooltip_message_], &QPropertyAnimation::finished, this, [&, msg](){
|
|
|
|
+ if (tooltip_effects_.contains(msg) && tooltip_effects_[msg]->opacity() == 0) {
|
|
|
|
+ tooltip_widgets_.take(msg)->deleteLater();
|
|
|
|
+ tooltip_effects_.take(msg)->deleteLater();
|
|
|
|
+ tooltip_animations_.take(msg)->deleteLater();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ QPropertyAnimation* hiding_anim = tooltip_animations_[current_tooltip_message_];
|
|
|
|
+ hiding_anim->setDirection(QAbstractAnimation::Backward);
|
|
|
|
+ if (hiding_anim->state() == QAbstractAnimation::Stopped) {
|
|
|
|
+ hiding_anim->start();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- active_tooltip = next_tooltip;
|
|
|
|
|
|
+ current_tooltip_message_ = tooltip_id;
|
|
}
|
|
}
|
|
|
|
|
|
void StatusWidget::onPatchTotalOperationsStarted()
|
|
void StatusWidget::onPatchTotalOperationsStarted()
|
|
{
|
|
{
|
|
all_patch_operations_finished_ = false;
|
|
all_patch_operations_finished_ = false;
|
|
ui->game_button->setEnabled(false);
|
|
ui->game_button->setEnabled(false);
|
|
|
|
+ ui->check_for_updates_button->setEnabled(false);
|
|
|
|
+ setToolTipMessage("Запуск процесса проверки и установки русификации...", E_PROCESS);
|
|
}
|
|
}
|
|
|
|
|
|
void StatusWidget::onPatchTotalOperationsFinished()
|
|
void StatusWidget::onPatchTotalOperationsFinished()
|
|
{
|
|
{
|
|
all_patch_operations_finished_ = true;
|
|
all_patch_operations_finished_ = true;
|
|
ui->game_button->setEnabled(true);
|
|
ui->game_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("");
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-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;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-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;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void StatusWidget::onPatchTotalProgressChanged(Patch::OperationProgress operation_progress)
|
|
|
|
-{
|
|
|
|
- updateStatusBar(operation_progress);
|
|
|
|
|
|
+ ui->check_for_updates_button->setEnabled(true);
|
|
|
|
+ setToolTipMessage("Все процессы установки русификации завершены. Можно играть. Mae govannen. Еще какой-то текст...", E_PROCESS);
|
|
|
|
+ process_completed_tooltip_hide_timer_.start();
|
|
}
|
|
}
|
|
|
|
|
|
void StatusWidget::on_game_button_clicked()
|
|
void StatusWidget::on_game_button_clicked()
|
|
@@ -276,39 +198,9 @@ void StatusWidget::on_game_button_clicked()
|
|
window->showChooseVersionDialog();
|
|
window->showChooseVersionDialog();
|
|
}
|
|
}
|
|
|
|
|
|
-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;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-void StatusWidget::updateStatusBar(Patch::OperationProgress progress)
|
|
|
|
|
|
+void StatusWidget::updatePatchProgressStatus(Patch::OperationProgress progress)
|
|
{
|
|
{
|
|
- if (last_statusbar_update_time_.elapsed() > 500) {
|
|
|
|
|
|
+ if (last_statusbar_update_time_.elapsed() > 400) {
|
|
QString text = "Выполнение операций...";
|
|
QString text = "Выполнение операций...";
|
|
if (progress.download_total_bytes != 0) {
|
|
if (progress.download_total_bytes != 0) {
|
|
text += "\nЗагрузка данных: " + QString::number(progress.getDownloadPercent(), 'f', 1) + "% ("
|
|
text += "\nЗагрузка данных: " + QString::number(progress.getDownloadPercent(), 'f', 1) + "% ("
|
|
@@ -323,9 +215,34 @@ void StatusWidget::updateStatusBar(Patch::OperationProgress progress)
|
|
+ "(часть " + QString::number(progress.install_finished_parts + 1) + " из " + QString::number(progress.install_total_parts);
|
|
+ "(часть " + QString::number(progress.install_finished_parts + 1) + " из " + QString::number(progress.install_total_parts);
|
|
}
|
|
}
|
|
|
|
|
|
- ui->progress_label->setText(text);
|
|
|
|
|
|
+ setToolTipMessage(text, E_PROCESS);
|
|
last_statusbar_update_time_.restart();
|
|
last_statusbar_update_time_.restart();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void StatusWidget::createTooltipMessageWidget(QString tooltip_id)
|
|
|
|
+{
|
|
|
|
+ tooltip_widgets_[tooltip_id] = new QLabel(ui->galadriel_widget);
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setGeometry(ui->galadriel_tooltip_example->geometry());
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setStyleSheet(ui->galadriel_tooltip_example->styleSheet());
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setFont(ui->galadriel_tooltip_example->font());
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setWordWrap(true);
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setAlignment(Qt::AlignCenter);
|
|
|
|
+ tooltip_widgets_[tooltip_id]->show();
|
|
|
|
+
|
|
|
|
+ tooltip_effects_[tooltip_id] = new QGraphicsOpacityEffect(tooltip_widgets_[tooltip_id]);
|
|
|
|
+ tooltip_effects_[tooltip_id]->setOpacity(0);
|
|
|
|
|
|
|
|
+ tooltip_animations_[tooltip_id] = new QPropertyAnimation(tooltip_effects_[tooltip_id], "opacity");
|
|
|
|
+ tooltip_animations_[tooltip_id]->setDuration(300);
|
|
|
|
+ tooltip_animations_[tooltip_id]->setStartValue(0);
|
|
|
|
+ tooltip_animations_[tooltip_id]->setEndValue(1);
|
|
|
|
+ tooltip_animations_[tooltip_id]->setDirection(QAbstractAnimation::Forward);
|
|
|
|
+
|
|
|
|
+ tooltip_widgets_[tooltip_id]->setGraphicsEffect(tooltip_effects_[tooltip_id]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void StatusWidget::on_check_for_updates_button_clicked()
|
|
|
|
+{
|
|
|
|
+ QMetaObject::invokeMethod(legacy_patches_, &PatchList::update, Qt::QueuedConnection);
|
|
|
|
+}
|