Browse Source

Fixed bug with status widget tooltop

Ivan Arkhipov 3 years ago
parent
commit
f30bc0a733
2 changed files with 14 additions and 9 deletions
  1. 10 5
      src/Legacy/widgets/statuswidget.cpp
  2. 4 4
      src/Legacy/widgets/statuswidget.h

+ 10 - 5
src/Legacy/widgets/statuswidget.cpp

@@ -66,17 +66,19 @@ void StatusWidget::setToolTipMessage(QString message, StatusWidget::ToolTipState
     tooltip_messages_[state] = message;
     tooltip_state_ = ToolTipState(int(tooltip_state_) | int(state));
 
+    qDebug() << "Setting tooltip message " << message << " with state " << int(state) << ", new state = " << tooltip_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) {
+        qDebug() << "FADING TOOLTIP to " << message_id;
+
+        if (!tooltip_widgets_.contains(message_id)) {
+            createTooltipMessageWidget(message_id);
+        }
+        tooltip_widgets_[message_id]->setText(message);
         fadeBetweenToolTips(message_id);
     }
 }
@@ -104,6 +106,7 @@ void StatusWidget::unsetToolTipMessage(StatusWidget::ToolTipState state)
         createTooltipMessageWidget(message_id);
     }
     tooltip_widgets_[message_id]->setText(tooltip_messages_[showing_state]);
+    qDebug() << "UNSETTING TOOLTIP to " << message_id << ", deleting state " << state << ", showing state " << showing_state;
     fadeBetweenToolTips(message_id);
 }
 
@@ -238,6 +241,7 @@ void StatusWidget::fadeBetweenToolTips(QString tooltip_id)
 }
 
 void StatusWidget::onPatchDownloaderStarted() {
+    process_completed_tooltip_hide_timer_.stop();
     all_patch_operations_finished_ = false;
     ui->game_button->setEnabled(false);
     ui->check_for_updates_button->setEnabled(false);
@@ -266,6 +270,7 @@ void StatusWidget::onPatchDownloaderProgressChanged(Downloader::Status status) {
 }
 
 void StatusWidget::onPatchInstallerStarted() {
+    process_completed_tooltip_hide_timer_.stop();
     all_patch_operations_finished_ = false;
     ui->game_button->setEnabled(false);
     ui->check_for_updates_button->setEnabled(false);

+ 4 - 4
src/Legacy/widgets/statuswidget.h

@@ -24,10 +24,10 @@ class StatusWidget : public QWidget
 public:
     // States. Higher state value means higher priority on visualisation
     enum ToolTipState : int {
-        E_INFO = 8,
-        E_ERROR = 4,
-        E_PROCESS = 2,
-        E_RANDOM = 1
+        E_INFO =    0b1000,
+        E_ERROR =   0b0100,
+        E_PROCESS = 0b0010,
+        E_RANDOM =  0b0001
     };
 
     explicit StatusWidget(QWidget *parent = 0);