-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
81 lines (68 loc) · 1.64 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QPushButton>
#include <QMainWindow>
#include <QStyledItemDelegate>
#include <QCalendarWidget>
#include <QPainter>
#include <QDate>
#include <QMouseEvent>
#include <QPushButton>
#include <QVBoxLayout>
#include <QImage>
#include <QTimer>
#include <QScreen>
#include <QClipboard>
#include <QLocale>
#include "calendarwindow.h"
struct NepaliDateStruct { // Renamed the structure to avoid conflict
int yy;
int mm;
int dd;
int day;
char wmonth[20];
char wday[20];
};
struct DateStruct2 {
int yy;
int mm;
int dd;
int day;
};
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
void setAutostart(bool enabled);
~MainWindow();
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
void exitAll();
bool eventFilter(QObject *watched, QEvent *event) override;
public slots:
void openCalendarWindow();
private slots:
void copyButtonText();
void updateDateButton();
void on_dateButton_clicked();
private:
void setupDefaultDate();
int cnvToNepali(int mm, int dd, int yy);
std::string getWeekdayName(int year, int month, int day);
QString getnepalimonth(int m);
void setWindowPosition();
void adjustTextColorBasedOnBackground();
QColor getAverageColor(const QImage &image);
QDate lastUpdatedDate;
Ui::MainWindow *ui;
QTimer *updateTimer;
CalendarWindow *calendarWindow;
bool isDragging;
bool dragStarted;
QPoint dragStartPosition;
QTimer *dragDelayTimer;
};
#endif // MAINWINDOW_H