bfab0579a7
- Add completed timeblock queries and completed project aggregation\n- Add desktop completed summary dialog with range filters, stats, and streak\n- Add medal entry point in the today panel\n- Add Android completed summary menu with local statistics\n- Rebuild AppImage and update validation docs/screenshots
138 lines
3.6 KiB
C++
138 lines
3.6 KiB
C++
#pragma once
|
|
|
|
#include <QDate>
|
|
#include <QDateTime>
|
|
#include <QVector>
|
|
|
|
#include "ElaWindow.h"
|
|
#include "core/ScheduleItem.h"
|
|
#include "ui/theme/ThemeTokens.h"
|
|
|
|
class AppSettings;
|
|
class ElaComboBox;
|
|
class ElaLineEdit;
|
|
class ElaPivot;
|
|
class ElaPushButton;
|
|
class ElaText;
|
|
class ElaToolButton;
|
|
class MonthView;
|
|
class NotificationService;
|
|
class ScheduleGridView;
|
|
class ScheduleService;
|
|
class SyncService;
|
|
class ThemeManager;
|
|
class TodayPanel;
|
|
class YearView;
|
|
class QCloseEvent;
|
|
class QFrame;
|
|
class QPaintEvent;
|
|
class QLabel;
|
|
class QShowEvent;
|
|
class QSplitter;
|
|
class QStackedWidget;
|
|
|
|
/*
|
|
* 类名: MainWindow
|
|
* 功能: 详细日程窗口;日/月/年视图、当日任务与设置入口
|
|
* 线程安全: 否;UI 线程
|
|
*/
|
|
class MainWindow : public ElaWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum class View
|
|
{
|
|
Day = 0,
|
|
Month = 1,
|
|
Year = 2,
|
|
};
|
|
Q_ENUM(View)
|
|
|
|
MainWindow(ScheduleService& scheduleService,
|
|
NotificationService& notificationService,
|
|
ThemeManager& themeManager,
|
|
AppSettings& settings,
|
|
SyncService* syncService = nullptr,
|
|
QWidget* parent = nullptr);
|
|
~MainWindow() override;
|
|
|
|
void setView(View view);
|
|
View view() const;
|
|
QDate currentDate() const;
|
|
|
|
void showAndRaise();
|
|
void openNewBlock();
|
|
void openSearch();
|
|
void focusBlock(const QDate& date, const QString& blockId);
|
|
|
|
signals:
|
|
void closeRequested();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent* event) override;
|
|
void showEvent(QShowEvent* event) override;
|
|
void paintEvent(QPaintEvent* event) override;
|
|
|
|
private:
|
|
void buildUi();
|
|
void connectSignals();
|
|
void restoreWindowState();
|
|
void saveWindowState();
|
|
void applyTheme(const ThemeTokens& tokens);
|
|
|
|
void reloadCurrentView();
|
|
void navigateToDate(const QDate& date);
|
|
void stepDate(int direction);
|
|
void updateDateLabel();
|
|
void updateHint();
|
|
void openCreateDialog(const QDateTime& start, const QDateTime& end);
|
|
void openCreateDialogForNew();
|
|
void openEditDialog(const QString& blockId);
|
|
void openSettings();
|
|
void openDailyReview();
|
|
void openCompletedSummary();
|
|
void openNewProject();
|
|
void openEditProject(const QString& projectId);
|
|
void updateOverdueBanner(const QVector<ScheduleItem>& items);
|
|
void showError(const QString& title, const QString& message);
|
|
void updateSyncStatus(const QString& status);
|
|
QDateTime defaultNewStart() const;
|
|
|
|
ScheduleService& m_scheduleService;
|
|
NotificationService& m_notificationService;
|
|
ThemeManager& m_themeManager;
|
|
AppSettings& m_settings;
|
|
SyncService* m_syncService = nullptr;
|
|
ThemeTokens m_tokens;
|
|
|
|
QDate m_currentDate;
|
|
View m_currentView = View::Day;
|
|
bool m_firstShowHandled = false;
|
|
|
|
QFrame* m_toolbar = nullptr;
|
|
ElaToolButton* m_compactButton = nullptr;
|
|
ElaPushButton* m_todayButton = nullptr;
|
|
ElaToolButton* m_prevButton = nullptr;
|
|
ElaToolButton* m_nextButton = nullptr;
|
|
ElaText* m_dateLabel = nullptr;
|
|
ElaPivot* m_viewPivot = nullptr;
|
|
ElaPushButton* m_newButton = nullptr;
|
|
ElaLineEdit* m_searchEdit = nullptr;
|
|
ElaComboBox* m_snapCombo = nullptr;
|
|
ElaToolButton* m_themeButton = nullptr;
|
|
ElaToolButton* m_settingsButton = nullptr;
|
|
QLabel* m_syncLabel = nullptr;
|
|
|
|
QFrame* m_overdueBanner = nullptr;
|
|
QLabel* m_overdueLabel = nullptr;
|
|
QSplitter* m_mainSplitter = nullptr;
|
|
QFrame* m_rightDock = nullptr;
|
|
QStackedWidget* m_viewStack = nullptr;
|
|
ScheduleGridView* m_grid = nullptr;
|
|
MonthView* m_monthView = nullptr;
|
|
YearView* m_yearView = nullptr;
|
|
TodayPanel* m_todayPanel = nullptr;
|
|
ElaText* m_hintLabel = nullptr;
|
|
};
|