From 284d9a052367d514925d92594f1f813306db7c59 Mon Sep 17 00:00:00 2001 From: khumnath Date: Wed, 30 Oct 2024 20:46:31 +0900 Subject: [PATCH] implement changes from devlopment branch and version increment --- CMakeLists.txt | 2 +- bikram.h | 2 +- calendarwindow.cpp | 23 +++++++++++++++-------- resources.qrc | 1 + resources/VERSION.txt | 1 + 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 resources/VERSION.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eae479..5a4109c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(nepdate VERSION 1.0.0 LANGUAGES CXX) +project(nepdate VERSION 2.0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/bikram.h b/bikram.h index 2b20d36..daadb82 100644 --- a/bikram.h +++ b/bikram.h @@ -128,7 +128,7 @@ inline int bikram::getYear() const { } inline int bikram::getMonth() const { - return Month + 1; // Return month as 1-indexed + return Month + 1; } inline int bikram::getDay() const { diff --git a/calendarwindow.cpp b/calendarwindow.cpp index 6e6a030..2719e09 100755 --- a/calendarwindow.cpp +++ b/calendarwindow.cpp @@ -103,7 +103,6 @@ CalendarWindow::CalendarWindow(QWidget *parent) : connect(ui->yearselectBS, QOverload::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsYearChanged); connect(ui->monthselectBS, QOverload::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsMonthChanged); connect(ui->dayselectBS, QOverload::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsDayChanged); - connect(ui->todayButton, &QPushButton::clicked, this, &CalendarWindow::ontodayButtonclicked); // Initialize the calendar @@ -216,16 +215,28 @@ void CalendarWindow::showMenu() { } void CalendarWindow::showAbout() { - QString aboutText = R"( + QString version; + QFile versionFile(":/resources/VERSION.txt"); // Use the resource path + + if (versionFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&versionFile); + version = in.readLine(); // Read the first line + versionFile.close(); + } else { + qDebug() << "Could not open version file from resources."; + version = "unknown"; // Fallback in case the file cannot be read + } + + QString aboutText = QString(R"(

About

Nepali Calendar

Author: khumnath

-

Version: 1.0.0

+

Version: %1

This application is written in C++ and Qt framework. For more information, visit my GitHub page.

-
)"; + )").arg(version); QMessageBox msgBox(QMessageBox::Information, "About", aboutText, QMessageBox::Ok, this); msgBox.exec(); @@ -525,15 +536,11 @@ void CalendarWindow::updateCalendar(int year, int month) { // Hide the numbers in the first column ui->calendarTable->verticalHeader()->setVisible(false); } - - void CalendarWindow::adjustCellSizes() { int tableWidth = ui->calendarTable->viewport()->width(); int tableHeight = ui->calendarTable->viewport()->height(); - int numColumns = ui->calendarTable->columnCount(); int numRows = ui->calendarTable->rowCount(); - if (numColumns > 0 && numRows > 0) { int columnWidth = tableWidth / numColumns; int rowHeight = tableHeight / numRows; diff --git a/resources.qrc b/resources.qrc index f317ea4..2e05c39 100755 --- a/resources.qrc +++ b/resources.qrc @@ -7,5 +7,6 @@ resources/amawasya.png resources/purnima.png resources/style.qss + resources/VERSION.txt diff --git a/resources/VERSION.txt b/resources/VERSION.txt new file mode 100644 index 0000000..38f77a6 --- /dev/null +++ b/resources/VERSION.txt @@ -0,0 +1 @@ +2.0.1