#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDateTime>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
init();
year=QDate::currentDate().year();
month=QDate::currentDate().month();
day=QDate::currentDate().day();
current_year=year;
current_month=month;
current_day=day;
set_days_list(year,month);
set_days_text();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::init()
{
ui->label1->clear();
ui->label2->clear();
ui->label3->clear();
ui->label4->clear();
ui->label5->clear();
ui->label6->clear();
ui->label7->clear();
ui->label8->clear();
ui->label9->clear();
ui->label10->clear();
ui->label11->clear();
ui->label12->clear();
ui->label13->clear();
ui->label14->clear();
ui->label15->clear();
ui->label16->clear();
ui->label17->clear();
ui->label18->clear();
ui->label19->clear();
ui->label20->clear();
ui->label21->clear();
ui->label22->clear();
ui->label23->clear();
ui->label24->clear();
ui->label25->clear();
ui->label26->clear();
ui->label27->clear();
ui->label28->clear();
ui->label29->clear();
ui->label30->clear();
ui->label31->clear();
ui->label32->clear();
ui->label33->clear();
ui->label34->clear();
ui->label35->clear();
ui->label36->clear();
ui->label37->clear();
ui->label38->clear();
ui->label39->clear();
ui->label40->clear();
ui->label41->clear();
ui->label42->clear();
ui->label1->setStyleSheet("color:black;background-color:transparent;");
ui->label2->setStyleSheet("color:black;background-color:transparent;");
ui->label3->setStyleSheet("color:black;background-color:transparent;");
ui->label4->setStyleSheet("color:black;background-color:transparent;");
ui->label5->setStyleSheet("color:black;background-color:transparent;");
ui->label6->setStyleSheet("color:black;background-color:transparent;");
ui->label7->setStyleSheet("color:black;background-color:transparent;");
ui->label8->setStyleSheet("color:black;background-color:transparent;");
ui->label9->setStyleSheet("color:black;background-color:transparent;");
ui->label10->setStyleSheet("color:black;background-color:transparent;");
ui->label11->setStyleSheet("color:black;background-color:transparent;");
ui->label12->setStyleSheet("color:black;background-color:transparent;");
ui->label13->setStyleSheet("color:black;background-color:transparent;");
ui->label14->setStyleSheet("color:black;background-color:transparent;");
ui->label15->setStyleSheet("color:black;background-color:transparent;");
ui->label16->setStyleSheet("color:black;background-color:transparent;");
ui->label17->setStyleSheet("color:black;background-color:transparent;");
ui->label18->setStyleSheet("color:black;background-color:transparent;");
ui->label19->setStyleSheet("color:black;background-color:transparent;");
ui->label20->setStyleSheet("color:black;background-color:transparent;");
ui->label21->setStyleSheet("color:black;background-color:transparent;");
ui->label22->setStyleSheet("color:black;background-color:transparent;");
ui->label23->setStyleSheet("color:black;background-color:transparent;");
ui->label24->setStyleSheet("color:black;background-color:transparent;");
ui->label25->setStyleSheet("color:black;background-color:transparent;");
ui->label26->setStyleSheet("color:black;background-color:transparent;");
ui->label27->setStyleSheet("color:black;background-color:transparent;");
ui->label28->setStyleSheet("color:black;background-color:transparent;");
ui->label29->setStyleSheet("color:black;background-color:transparent;");
ui->label30->setStyleSheet("color:black;background-color:transparent;");
ui->label31->setStyleSheet("color:black;background-color:transparent;");
ui->label32->setStyleSheet("color:black;background-color:transparent;");
ui->label33->setStyleSheet("color:black;background-color:transparent;");
ui->label34->setStyleSheet("color:black;background-color:transparent;");
ui->label35->setStyleSheet("color:black;background-color:transparent;");
ui->label36->setStyleSheet("color:black;background-color:transparent;");
ui->label37->setStyleSheet("color:black;background-color:transparent;");
ui->label38->setStyleSheet("color:black;background-color:transparent;");
ui->label39->setStyleSheet("color:black;background-color:transparent;");
ui->label40->setStyleSheet("color:black;background-color:transparent;");
ui->label41->setStyleSheet("color:black;background-color:transparent;");
ui->label42->setStyleSheet("color:black;background-color:transparent;");
}
void MainWindow::set_days_text()
{
for(int i=0;i<days_list.length();i++){
int index=i+1;
switch (index) {
case 1:ui->label1->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 2:ui->label2->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 3:ui->label3->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 4:ui->label4->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 5:ui->label5->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 6:ui->label6->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 7:ui->label7->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 8:ui->label8->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 9:ui->label9->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 10:ui->label10->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 11:ui->label11->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 12:ui->label12->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 13:ui->label13->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 14:ui->label14->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 15:ui->label15->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 16:ui->label16->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 17:ui->label17->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 18:ui->label18->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 19:ui->label19->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 20:ui->label20->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 21:ui->label21->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 22:ui->label22->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 23:ui->label23->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 24:ui->label24->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 25:ui->label25->setText(days_list[i]);set_label_style(index,year,month,days_list[i].toInt());break;
case 26:ui->label26->setText(days_list[i]);set_label_style(index