123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef STATUSWIDGET_H
- #define STATUSWIDGET_H
- #include <QWidget>
- #include <QSettings>
- #include <QTime>
- #include <QElapsedTimer>
- #include <QMap>
- #include <QPropertyAnimation>
- #include <QGraphicsOpacityEffect>
- #include <QLabel>
- #include "legacyapplication.h"
- #include "models/downloader.h"
- #include "models/patchinstaller.h"
- namespace Ui {
- class StatusWidget;
- }
- class StatusWidget : public QWidget
- {
- Q_OBJECT
- public:
- // States. Higher state value means higher priority on visualisation
- enum ToolTipState : int {
- E_HINT = 0b1000,
- E_PROCESS = 0b0100,
- E_INFO = 0b0010,
- E_RANDOM = 0b0001
- };
- explicit StatusWidget(QWidget *parent = 0);
- ~StatusWidget();
- public slots:
- void updateFontsSizes();
- void setToolTipMessage(QString message, ToolTipState state);
- void unsetToolTipMessage(ToolTipState state);
- void show();
- void hide();
- protected:
- void resizeEvent(QResizeEvent *event) override;
- private slots:
- void onErrorStatusChanged(AppErrorStatus status);
- void generateRandomTooltipMessage();
- void fadeBetweenToolTips(QString tooltip_id);
- void onPatchDownloaderStarted();
- void onPatchDownloaderFinished();
- void onPatchDownloaderProgressChanged(Downloader::Status status);
- void onPatchInstallerStarted();
- void onPatchInstallerFinished();
- void onPatchInstallerProgressChanged(PatchInstaller::Status status);
- void onPatchInstallerVideoProgressChanged(int finished_videos, int total_videos, Downloader::Status status);
- void on_game_button_clicked();
- void showComponentsStatus();
- void hideComponentsStatus();
- void onTranslationComponentsNeedToPatch();
- void onTranslationComponentsNoNeedToPatch();
- private:
- void createTooltipMessageWidget(QString tooltip_id);
- void updateButtonStatus();
- private:
- Ui::StatusWidget *ui;
- bool all_patch_operations_finished_ = false;
- QMap<QString, QLabel*> tooltip_widgets_;
- QMap<QString, QGraphicsOpacityEffect*> tooltip_effects_;
- QMap<QString, QPropertyAnimation*> tooltip_animations_;
- QString current_tooltip_message_;
- QElapsedTimer last_statusbar_update_time_;
- ToolTipState tooltip_state_ = E_RANDOM;
- QMap<ToolTipState, QString> tooltip_messages_;
- QGraphicsOpacityEffect* _components_status_opacity_effect;
- QPropertyAnimation* _components_status_opacity_animation;
- bool _need_to_install_patches = false;
- bool _need_to_update = false;
- bool _need_to_repair_game_files = false;
- bool _need_to_forcely_patch = false;
- };
- #endif // STATUSWIDGET_H
|