@@ -32,6 +32,12 @@ CalendarWindow::CalendarWindow(QWidget *parent) :
3232        qApp->setStyleSheet (styleSheet);
3333        file.close ();
3434    }
35+ 
36+     int  fontId = QFontDatabase::addApplicationFont (" :/resources/Laila-Medium.ttf" 
37+     QString fontFamily = QFontDatabase::applicationFontFamilies (fontId).at (0 );
38+     QFont appFont (fontFamily);
39+     CalendarWindow::setFont (appFont);
40+ 
3541    //  Initialize current date to today's date
3642    QDate currentDate = QDate::currentDate ();
3743    //  Populate AD combo boxes
@@ -75,8 +81,7 @@ CalendarWindow::CalendarWindow(QWidget *parent) :
7581    QString bsMonthName = getBikramMonthName (bsMonth);
7682    QString tithiName = QString::fromStdString (tithi[(int )panchang.tithi_index ]);
7783    QString paksha = QString::fromStdString (panchang.paksha );
78-     QString tithipaksha = QString (" %1 %2" arg (paksha).arg (tithiName);
79- 
84+      QString tithipaksha = QString (" %1 %2" arg (paksha).arg (tithiName);
8085
8186    //  Set current date in BS combo boxes
8287    ui->yearselectBS ->setCurrentText (QString::number (bsYear));
@@ -290,17 +295,17 @@ void CalendarWindow::showAbout() {
290295    }
291296
292297    QString aboutText = QString (R"( 
293-     <center> 
294-         <h2 class='about.h2'>About</h2> 
295-         <p class='about.p'>Nepali Calendar</p> 
296-         <p><b>Author:</b> <span class='about'>khumnath</span></p> 
297-         <p><b>Version:</b> %1</p> 
298-         <p>This application is written in C++ and Qt framework. For more information, visit my 
299-            <a href="https://github.com/khumnath/nepdate" class="about">GitHub page</a>. 
298+     <center style="background-color: white; padding: 20px;"> 
299+         <h2 style="font-size: 24px; font-weight: bold; color: black;">Nepali Calendar</h2> 
300+         <p style="color: black;"><b>Author:</b> <span style="font-weight: normal;">khumnath</span></p> 
301+         <p style="color: black;"><b>Version:</b> <span style="color: green; font-weight: bold;">%1</span></p> 
302+         <p style="color: black;">This application is written in C++ and the Qt framework. For more information, visit my 
303+            <a href="https://github.com/khumnath/nepdate" style="color: blue; text-decoration: underline;">GitHub page</a>. 
300304        </p> 
301305    </center>)"  ).arg (version);
302306
303307    QMessageBox msgBox (QMessageBox::Information, " About" this );
308+     msgBox.setTextFormat (Qt::RichText);
304309    msgBox.exec ();
305310}
306311
@@ -443,10 +448,35 @@ void CalendarWindow::updateBsDateFromAd(int year, int month, int day) {
443448
444449    //  Populate BS day combo box based on current month and year
445450    populateBsDays (bsYear, bsMonth);
446- 
451+      // QDate currentDate = QDate::currentDate(); 
447452    int  bsDaysInMonth = converter.daysInMonth (bsYear, bsMonth);
448-     ui->output ->setText (QString (" विक्रम सम्वत मा परिवर्तन गरियो: %1 %2 %3 गते %5 \n %2 %1 मा जम्मा दिन सङ्ख्या: %4" 
449-                             .arg (convertToNepaliNumerals (bsYear)).arg (bsMonthName).arg (convertToNepaliNumerals (bsDay)).arg (convertToNepaliNumerals (bsDaysInMonth)).arg (tithipaksha));
453+     QDate bsDate (bsYear, bsMonth, bsDay);
454+     //  Get the current AD (Gregorian) system date
455+     QDate systemDate = QDate::currentDate ();
456+ 
457+     //  Retrieve the selected AD date from combo boxes
458+     int  selectedAdYear = ui->yearselectAD ->currentText ().toInt ();
459+     int  selectedAdMonth = ui->monthselectAD ->currentIndex () + 1 ; //  Adjust index
460+     int  selectedAdDay = ui->dayselectAD ->currentText ().toInt ();
461+     QDate selectedAdDate (selectedAdYear, selectedAdMonth, selectedAdDay);
462+ 
463+     //  Check if the selected AD date matches the current system date
464+     if  (selectedAdDate == systemDate) {
465+         ui->output ->setText (QString (" आज: बिक्रम सम्वत: %1 %2 %3 गते %5\n  %2 %1 मा जम्मा दिन सङ्ख्या: %4" 
466+                                 .arg (convertToNepaliNumerals (bsYear))
467+                                 .arg (bsMonthName)
468+                                 .arg (convertToNepaliNumerals (bsDay))
469+                                 .arg (convertToNepaliNumerals (bsDaysInMonth))
470+                                 .arg (tithipaksha));
471+     } else  {
472+         ui->output ->setText (QString (" विक्रम सम्वत मा परिवर्तन गरियो: %1 %2 %3 गते %5\n  %2 %1 मा जम्मा दिन सङ्ख्या: %4" 
473+                                 .arg (convertToNepaliNumerals (bsYear))
474+                                 .arg (bsMonthName)
475+                                 .arg (convertToNepaliNumerals (bsDay))
476+                                 .arg (convertToNepaliNumerals (bsDaysInMonth))
477+                                 .arg (tithipaksha));
478+     }
479+ 
450480
451481
452482
0 commit comments