77 throw std::bad_alloc();
80 QMenu* pViewMenu = menuBar()->addMenu(tr(
"View"));
81 QAction* pAction = pViewMenu->addAction(tr(
"Lunar"),
82 this, SLOT(slotActionLunar(
bool)));
83 pAction->setCheckable(
true);
84 pAction->setChecked(
true);
86 pAction = pViewMenu->addAction(tr(
"Solar"),
87 this, SLOT(slotActionSolar(
bool)));
88 pAction->setCheckable(
true);
89 pAction->setChecked(
true);
90 pViewMenu->addSeparator();
92 QActionGroup* pViewTypeGroup =
new QActionGroup(
this);
93 QAction* pViewMonth = pViewMenu->addAction(tr(
"Month"),
94 this, SLOT(slotViewMonth()));
95 pViewMonth->setCheckable(
true);
96 pViewMonth->setChecked(
true);
97 pViewTypeGroup->addAction(pViewMonth);
98 QAction* pViewWeek = pViewMenu->addAction(tr(
"Week"),
99 this, SLOT(slotViewWeek()));
100 pViewWeek->setCheckable(
true);
101 pViewTypeGroup->addAction(pViewWeek);
102 pViewMenu->addSeparator();
105 pAction = pViewMenu->addAction(tr(
"Show Head"),
106 m_pLunarCalendar, SLOT(ShowHead(
bool)));
107 pAction->setCheckable(
true);
108 pAction->setChecked(
true);
109 pAction = pViewMenu->addAction(tr(
"Show Tools"),
110 m_pLunarCalendar, SLOT(ShowTools(
bool)));
111 pAction->setCheckable(
true);
112 pAction->setChecked(
true);
113 pAction = pViewMenu->addAction(tr(
"Show today"),
114 m_pLunarCalendar, SLOT(ShowToday(
bool)));
115 pAction->setCheckable(
true);
116 pAction->setChecked(
true);
117 pAction = pViewMenu->addAction(tr(
"Show date"),
118 m_pLunarCalendar, SLOT(ShowDate(
bool)));
119 pAction->setCheckable(
true);
120 pAction->setChecked(
true);
121 pAction = pViewMenu->addAction(tr(
"Show time"),
122 m_pLunarCalendar, SLOT(ShowTime(
bool)));
123 pAction->setCheckable(
true);
124 pAction->setChecked(
true);
125 pAction = pViewMenu->addAction(tr(
"Show week head"),
126 m_pLunarCalendar, SLOT(ShowWeekHead(
bool)));
127 pAction->setCheckable(
true);
128 pAction->setChecked(
true);
129 pAction = pViewMenu->addAction(tr(
"Show weeks"),
130 m_pLunarCalendar, SLOT(ShowWeeks(
bool)));
131 pAction->setCheckable(
true);
132 pAction->setChecked(
true);
133 pAction = pViewMenu->addAction(tr(
"Show grid"),
134 m_pLunarCalendar, SLOT(ShowGrid(
bool)));
135 pAction->setCheckable(
true);
136 pAction->setChecked(
false);
137 pAction = pViewMenu->addAction(tr(
"Show tooltip"),
138 m_pLunarCalendar, SLOT(EnableToolTip(
bool)));
139 pAction->setCheckable(
true);
140 pAction->setChecked(
true);
141 pAction = pViewMenu->addAction(tr(
"Use backgroup image"),
142 m_pLunarCalendar, SLOT(ShowBackgroupImage(
bool)));
143 pAction->setCheckable(
true);
144 pAction->setChecked(
false);
147 QActionGroup* pViewHeadposition =
new QActionGroup(
this);
148 QMenu* pViewHeadpositionMenu = pViewMenu->addMenu(tr(
"Head position"));
149 QAction* pHeadNot = pViewHeadpositionMenu->addAction(tr(
"Not"),
150 this, SLOT(slotHeadpositionNot()));
151 pHeadNot->setCheckable(
true);
152 QAction* pHeadTop = pViewHeadpositionMenu->addAction(tr(
"Top"),
153 this, SLOT(slotHeadpositionTop()));
154 pHeadTop->setCheckable(
true);
155 pHeadTop->setChecked(
true);
156 QAction* pHeadDown = pViewHeadpositionMenu->addAction(tr(
"Down"),
157 this, SLOT(slotHeadpositionDown()));
158 pHeadDown->setCheckable(
true);
159 QAction* pHeadLeft = pViewHeadpositionMenu->addAction(tr(
"Left"),
160 this, SLOT(slotHeadpositionLeft()));
161 pHeadLeft->setCheckable(
true);
162 QAction* pHeadRight = pViewHeadpositionMenu->addAction(tr(
"Right"),
163 this, SLOT(slotHeadpositionRight()));
164 pHeadRight->setCheckable(
true);
165 pViewHeadposition->addAction(pHeadNot);
166 pViewHeadposition->addAction(pHeadTop);
167 pViewHeadposition->addAction(pHeadDown);
168 pViewHeadposition->addAction(pHeadLeft);
169 pViewHeadposition->addAction(pHeadRight);
173 pViewMenu->addAction(tr(
"Clear holidays"), m_pLunarCalendar, SLOT(ClearHolidays()));
174 pAction = pViewMenu->addAction(tr(
"Enable holidays"), m_pLunarCalendar, SLOT(EnableHolidays(
bool)));
175 pAction->setChecked(
true);
176 pAction->setCheckable(
true);
177 pAction = pViewMenu->addAction(tr(
"Enable solar term"), m_pLunarCalendar, SLOT(EnableSolarTerm(
bool)));
178 pAction->setChecked(
true);
179 pAction->setCheckable(
true);
182 pViewMenu->addSeparator();
183 pViewMenu->addAction(RabbitCommon::CTools::Instance()->AddStyleMenu(pViewMenu));
184 pViewMenu->addAction(tr(
"Genetate cache table"),
this, SLOT(slotGenerateCalendarTable()));
187 QMenu* pHelp = menuBar()->addMenu(tr(
"Help"));
189 pHelp->addAction(updater.windowIcon(), tr(
"Update"),
190 this, SLOT(slotUpdate()));
191 pHelp->addAction(windowIcon(), tr(
"About"),
this, SLOT(slotAbout()));
192 pHelp->addMenu(RabbitCommon::CTools::Instance()->GetLogMenu(
this));
199 m_Hnadler = QSharedPointer<CHandler>(
new CHandler());
207 QStringList& tasks)->uint {
214 if(d.month() == 10 && d.day() == 26)
221 if(9 == lunarMonth && 9 == lunarDay)
223 tasks <<
"老人节" <<
"老年节" <<
"登高节" <<
"踏秋";
228 if(d.day() == 10 && d.month() == 10)
236 if(8 == lunarMonth && 23 == lunarDay)
250 if(Qt::Monday == d.dayOfWeek())
258 if(d.day() == 12 && d.month() == 10 && d.year() == 2015)
266 m_pLunarCalendar->
Update();
271 m_pLunarCalendar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
272 this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
273 setCentralWidget(m_pLunarCalendar);
275 QFont font = m_pLunarCalendar->font();
276 font.setItalic(
true);
277 font.setStrikeOut(
true);
279 font.setPointSize(nFontSize);
283 bool check = connect(m_pLunarCalendar, SIGNAL(sigSelectionChanged()),
284 this, SLOT(slotUpdateCalendar()));
MainWindow(QWidget *parent=nullptr)
[Implement the onHandle function]