feat: implement AI schedule app with multi-device sync
- Qt 6 desktop client with day/month/year views, AI scheduling, and TOML settings\n- Go sync server with SQLite change stream, WebSocket notifications, and Docker deployment\n- Client outbox/LWW sync, offline retry, and dual-client integration tests\n- Linux fcitx5 setup, validation reports, and Windows MinGW preset
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
#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 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 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;
|
||||
};
|
||||
Reference in New Issue
Block a user