Browse Source

Added base button for manual check for updates

Ivan Arkhipov 4 năm trước cách đây
mục cha
commit
2159f4359f

+ 8 - 0
src/Legacy/widgets/statuswidget.cpp

@@ -1,3 +1,4 @@
+#include "ui_statuswidget.h"
 #include "statuswidget.h"
 
 #include "models/patchlist.h"
@@ -184,12 +185,14 @@ void StatusWidget::onPatchTotalOperationsStarted()
 {
     all_patch_operations_finished_ = false;
     ui->game_button->setEnabled(false);
+    ui->check_for_updates_button->setEnabled(false);
 }
 
 void StatusWidget::onPatchTotalOperationsFinished()
 {
     all_patch_operations_finished_ = true;
     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";
@@ -329,3 +332,8 @@ void StatusWidget::updateStatusBar(Patch::OperationProgress progress)
 }
 
 
+
+void StatusWidget::on_check_for_updates_button_clicked()
+{
+    QMetaObject::invokeMethod(legacy_patches_, &PatchList::update, Qt::QueuedConnection);
+}

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

@@ -8,8 +8,6 @@
 #include <QPropertyAnimation>
 #include <QGraphicsOpacityEffect>
 
-#include "ui_statuswidget.h"
-
 #include "models/patchlist.h"
 
 namespace Ui {
@@ -50,6 +48,8 @@ private slots:
 
     void on_game_button_clicked();
 
+    void on_check_for_updates_button_clicked();
+
 private:
     void updateStatusBar(Patch::OperationProgress progress);
 

+ 18 - 6
src/Legacy/widgets/statuswidget.ui

@@ -501,12 +501,29 @@ border-image: url(:/characters/galadriel_with_text.png);
      <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">
@@ -600,11 +617,6 @@ QPushButton#game_button:disabled {
    <container>1</container>
   </customwidget>
  </customwidgets>
- <resources>
-  <include location="../../../resources/backgrounds.qrc"/>
-  <include location="../../../resources/backgrounds_advanced.qrc"/>
-  <include location="../../../resources/common.qrc"/>
-  <include location="../../../resources/res.qrc"/>
- </resources>
+ <resources/>
  <connections/>
 </ui>