Skip to content

Commit

Permalink
implement changes from devlopment branch and version increment
Browse files Browse the repository at this point in the history
  • Loading branch information
khumnath committed Oct 30, 2024
1 parent a2d8413 commit 284d9a0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bikram.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
23 changes: 15 additions & 8 deletions calendarwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ CalendarWindow::CalendarWindow(QWidget *parent) :
connect(ui->yearselectBS, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsYearChanged);
connect(ui->monthselectBS, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsMonthChanged);
connect(ui->dayselectBS, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CalendarWindow::onBsDayChanged);

connect(ui->todayButton, &QPushButton::clicked, this, &CalendarWindow::ontodayButtonclicked);

// Initialize the calendar
Expand Down Expand Up @@ -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"(
<center>
<h2 class='about.h2'>About</h2>
<p class='about.p'>Nepali Calendar</p>
<p><b>Author:</b> <span class='about'>khumnath</span></p>
<p><b>Version:</b> 1.0.0</p>
<p><b>Version:</b> %1</p>
<p>This application is written in C++ and Qt framework. For more information, visit my
<a href="https://github.com/khumnath/nepdate" class="about">GitHub page</a>.
</p>
</center>)";
</center>)").arg(version);

QMessageBox msgBox(QMessageBox::Information, "About", aboutText, QMessageBox::Ok, this);
msgBox.exec();
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<file>resources/amawasya.png</file>
<file>resources/purnima.png</file>
<file>resources/style.qss</file>
<file>resources/VERSION.txt</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions resources/VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.1

0 comments on commit 284d9a0

Please sign in to comment.