-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendarwindow.h
71 lines (59 loc) · 1.86 KB
/
calendarwindow.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
#ifndef CALENDARWINDOW_H
#define CALENDARWINDOW_H
#include <QMainWindow>
#include "bikram.h"
#include "qdatetime.h"
#include <QMessageBox>
#include <QMenu>
#include <QDesktopServices>
#include <QUrl>
namespace Ui {
class CalendarWindow;
}
class CalendarWindow : public QMainWindow
{
Q_OBJECT
public:
explicit CalendarWindow(QWidget *parent = nullptr);
~CalendarWindow();
// Static constant month names for Gregorian and Bikram Sambat calendars
static const QStringList gregorianMonths;
static const QStringList bikramMonths;
// Methods to get month names
QString getBikramMonthName(int month);
QString getEnglishMonthName(int month);
// Function to convert number to Nepali numeral string
QString convertToNepaliNumerals(int number);
private slots:
void onAdYearChanged(int index);
void onAdMonthChanged(int index);
void onAdDayChanged(int index);
void onBsYearChanged(int index);
void onBsMonthChanged(int index);
void onBsDayChanged(int index);
void ontodayButtonclicked();
void onnextMonthButtonclicked();
void onpreviousMonthButtonclicked();
void showMenu();
void showAbout();
void openSourceCode();
protected:
void resizeEvent(QResizeEvent* event) override;
bool eventFilter(QObject *object, QEvent *event) override;
private:
Ui::CalendarWindow *ui;
bikram converter;
bool blockSignals;
int gYear, gMonth, gDay; // Moved to private section for encapsulation
QDate currentBikramDate;
// Private helper methods
void centerOnScreen();
void updateBsDateFromAd(int year, int month, int day);
void updateAdDateFromBs(int year, int month, int day);
void updateCalendar(int year, int month);
void adjustCellSizes();
void centerWidgets();
void adjustCalendarTableSize();
void populateBsDays(int year, int month);
};
#endif // CALENDARWINDOW_H