From 7546effb7e62a8e6e5b91353c50587bdf4d2d76c Mon Sep 17 00:00:00 2001 From: khumnath Date: Mon, 23 Sep 2024 21:27:56 +0900 Subject: [PATCH 01/18] reduce cpu usage by delay timer and scale down image for color detection of background --- mainwindow.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a0ec334..41ed110 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget *parent) : updateTimer = new QTimer(this); connect(updateTimer, &QTimer::timeout, this, &MainWindow::adjustTextColorBasedOnBackground); - updateTimer->start(1000); + updateTimer->start(10000); // 10 seconds to reduce cpu load. text changes on widget move so this is not neccesery to change every second. setWindowFlags(Qt::Tool | Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::WindowDoesNotAcceptFocus); setMouseTracking(true); @@ -169,7 +169,7 @@ int MainWindow::cnvToNepali(int mm, int dd, int yy) { ui->dateButton->setToolTipDuration(3000); QFont tooltipFont("Noto Sans Devanagari", 12); // Replace "Noto Sans Devnagari" with the name of your desired font QToolTip::setFont(tooltipFont); - ui->dateButton->setToolTip(nepalitooltip); + ui->dateButton->setToolTip(nepalitooltip); adjustTextColorBasedOnBackground(); @@ -227,12 +227,20 @@ double contrastRatio(double lum1, double lum2) { // Main function to adjust the text color based on the background color void MainWindow::adjustTextColorBasedOnBackground() { // Capture the screen behind the window. + QPoint globalPos = ui->dateButton->mapToGlobal(QPoint(0, 0)); + + // Capture the screen behind the button. QScreen *screen = QGuiApplication::primaryScreen(); - QPixmap pixmap = screen->grabWindow(0, x(), y(), width(), height()); + + // Grab only area behind the button with button's dimensions + QPixmap pixmap = screen->grabWindow(0, globalPos.x(), globalPos.y(), ui->dateButton->width(), ui->dateButton->height()); QImage image = pixmap.toImage(); - // Calculate the average color of the background image. - QColor averageColor = getAverageColor(image); + // Scale down the image to reduce processing time.(this is optional). + QImage scaledImage = image.scaled(10, 10, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + + // Calculate the average color of the background behind the date button. + QColor averageColor = getAverageColor(scaledImage); // Calculate the luminance of the background color. double bgLuminance = luminance(averageColor); From 79a5e2f1d41e33801732bec048cd8a44408a8620 Mon Sep 17 00:00:00 2001 From: khumnath Date: Tue, 24 Sep 2024 12:42:32 +0900 Subject: [PATCH 02/18] spelling correction --- calendarwindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calendarwindow.h b/calendarwindow.h index 41dc272..55407db 100644 --- a/calendarwindow.h +++ b/calendarwindow.h @@ -24,7 +24,7 @@ class CalendarWindow : public QMainWindow ~CalendarWindow(); QString getBikramMonthName(int month) { QStringList bikramMonths = {"बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", - "अश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", + "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुन", "चैत"}; if (month >= 1 && month <= 12) { return bikramMonths[month - 1]; From 640cf996af60c2b3c4020ff7640a3617996dee7d Mon Sep 17 00:00:00 2001 From: khumnath Date: Mon, 30 Sep 2024 07:15:45 +0900 Subject: [PATCH 03/18] applicatoion update code refactor/ added month navigation button/ bumped app version to 2.0.0/ --- CMakeLists.txt | 2 +- calendarwindow.cpp | 116 ++++++++++++++++++++++++------- calendarwindow.h | 63 +++++------------ calendarwindow.ui | 168 +++++++++++++++++++++++++++++++-------------- 4 files changed, 226 insertions(+), 123 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eae479..6dfd0a8 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.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/calendarwindow.cpp b/calendarwindow.cpp index ffbd885..99d733b 100755 --- a/calendarwindow.cpp +++ b/calendarwindow.cpp @@ -102,23 +102,13 @@ CalendarWindow::CalendarWindow(QWidget *parent) : // Initialize current date to today's date QDate currentDate = QDate::currentDate(); - - // Month names for Gregorian and Bikram Sambat calendars - QStringList gregorianMonths = {"जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", - "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"}; - - QStringList bikramMonths = {"बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", - "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", - "फाल्गुन", "चैत"}; - - // Populate AD combo boxes for (int year = 1900; year <= 2100; ++year) { ui->yearselectAD->addItem(QString::number(year)); ui->yearselectAD->setEditable(true); } - for (const QString &month : gregorianMonths) { - ui->monthselectAD->addItem(month); + for (int month = 1; month <= 12; ++month) { + ui->monthselectAD->addItem(getEnglishMonthName(month)); } for (int day = 1; day <= 31; ++day) { ui->dayselectAD->addItem(QString::number(day)); @@ -129,9 +119,13 @@ CalendarWindow::CalendarWindow(QWidget *parent) : ui->yearselectBS->addItem(QString::number(year)); ui->yearselectBS->setEditable(true); } - for (const QString &month : bikramMonths) { - ui->monthselectBS->addItem(month); + for (int month = 1; month <= 12; ++month) { + ui->monthselectBS->addItem(getBikramMonthName(month)); } + int year = ui->yearselectBS->currentText().toInt(); + int month = ui->monthselectBS->currentIndex() + 1; + populateBsDays(year, month); + // Set current date in AD combo boxes ui->yearselectAD->setCurrentText(QString::number(currentDate.year())); @@ -171,6 +165,11 @@ 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->previousMonthButton_2, &QPushButton::clicked, this, &CalendarWindow::onpreviousMonthButtonclicked); + connect(ui->nextMonthButton, &QPushButton::clicked, this, &CalendarWindow::onnextMonthButtonclicked); + + + connect(ui->todayButton, &QPushButton::clicked, this, &CalendarWindow::ontodayButtonclicked); @@ -189,6 +188,42 @@ bool CalendarWindow::eventFilter(QObject *object, QEvent *event) { return QMainWindow::eventFilter(object, event); } +const QStringList CalendarWindow::bikramMonths = { + "वैशाख", "जेठ", "असार", "श्रावण", "भाद्र", + "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", + "फाल्गुन", "चैत्र" +}; +const QStringList CalendarWindow::gregorianMonths = {"जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", + "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"}; + +QString CalendarWindow::getBikramMonthName(int month) { + if (month < 1 || month > 12) { + return ""; // Return an empty string for invalid month + } + return bikramMonths.at(month - 1); // Assuming 1-based month input +} +QString CalendarWindow::getEnglishMonthName(int month) { + if (month < 1 || month > 12) { + return ""; // Return an empty string for invalid month + } + return gregorianMonths.at(month - 1); // Assuming 1-based month input +} + +QString CalendarWindow::convertToNepaliNumerals(int number) { + QString nepaliNumerals = QString::number(number); + nepaliNumerals.replace("0", "०"); + nepaliNumerals.replace("1", "१"); + nepaliNumerals.replace("2", "२"); + nepaliNumerals.replace("3", "३"); + nepaliNumerals.replace("4", "४"); + nepaliNumerals.replace("5", "५"); + nepaliNumerals.replace("6", "६"); + nepaliNumerals.replace("7", "७"); + nepaliNumerals.replace("8", "८"); + nepaliNumerals.replace("9", "९"); + return nepaliNumerals; +} + void CalendarWindow::ontodayButtonclicked() { // Get today's date QDate today = QDate::currentDate(); @@ -224,7 +259,33 @@ void CalendarWindow::ontodayButtonclicked() { // Update the calendar updateCalendar(bsYear, bsMonth); } +// Slot for Previous Month button +void CalendarWindow::onpreviousMonthButtonclicked() { + int currentIndex = ui->monthselectBS->currentIndex(); + + if (currentIndex > 0) { + ui->monthselectBS->setCurrentIndex(currentIndex - 1); + } else { + // Wrap around to December + ui->monthselectBS->setCurrentIndex(11); // December (0-based index) + } + + // The change will automatically trigger the connected slot for month selection +} + +// Slot for Next Month button +void CalendarWindow::onnextMonthButtonclicked() { + int currentIndex = ui->monthselectBS->currentIndex(); + if (currentIndex < 11) { // 11 is December + ui->monthselectBS->setCurrentIndex(currentIndex + 1); + } else { + // Wrap around to January + ui->monthselectBS->setCurrentIndex(0); // January (0-based index) + } + + // The change will automatically trigger the connected slot for month selection +} void CalendarWindow::resizeEvent(QResizeEvent* event) { QMainWindow::resizeEvent(event); @@ -293,7 +354,7 @@ void CalendarWindow::showAbout() {

About

nepali calendar

Author: khumnath

-

Version: 1.0.0

+

Version: 2.0.0

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

)"; @@ -375,11 +436,12 @@ void CalendarWindow::onBsYearChanged(int /*index*/) { int year = ui->yearselectBS->currentText().toInt(); int month = ui->monthselectBS->currentIndex() + 1; - int day = ui->dayselectBS->currentText().toInt(); // Update BS day combo box based on current month and year populateBsDays(year, month); + // Now, use the current day selection to update AD date + int day = ui->dayselectBS->currentText().toInt(); updateAdDateFromBs(year, month, day); // Update the calendar @@ -388,6 +450,7 @@ void CalendarWindow::onBsYearChanged(int /*index*/) { blockSignals = false; } + void CalendarWindow::onBsMonthChanged(int /*index*/) { if (blockSignals) return; blockSignals = true; @@ -395,8 +458,6 @@ void CalendarWindow::onBsMonthChanged(int /*index*/) { int year = ui->yearselectBS->currentText().toInt(); int month = ui->monthselectBS->currentIndex() + 1; int day = ui->dayselectBS->currentText().toInt(); - populateBsDays(year, month); - // Update BS day combo box based on current month and year updateAdDateFromBs(year, month, day); // Update the calendar @@ -405,6 +466,7 @@ void CalendarWindow::onBsMonthChanged(int /*index*/) { blockSignals = false; } + void CalendarWindow::onBsDayChanged(int /*index*/) { if (blockSignals) return; blockSignals = true; @@ -414,8 +476,6 @@ void CalendarWindow::onBsDayChanged(int /*index*/) { int day = ui->dayselectBS->currentText().toInt(); updateAdDateFromBs(year, month, day); - populateBsDays(year, month); - blockSignals = false; } @@ -461,15 +521,24 @@ void CalendarWindow::updateAdDateFromBs(int year, int month, int day) { ui->monthselectAD->setCurrentIndex(gMonth - 1); ui->dayselectAD->setCurrentText(QString::number(gDay)); + int bsDaysInMonth = converter.daysInMonth(year, month); QString bsMonthName = getBikramMonthName(month); - QString adMonthName = getEnglishMonthName(gMonth); - ui->output->setText(QString("अङ्ग्रेजी मिति मा परिवर्तन गरियो: %1 %2 %3 \n %4 %5 मा जम्मा दिन सङ्ख्या: %6") - .arg(convertToNepaliNumerals(gYear)).arg(adMonthName).arg(convertToNepaliNumerals(gDay)).arg(bsMonthName).arg(convertToNepaliNumerals(year)).arg(convertToNepaliNumerals(bsDaysInMonth))); + double julianDate = gregorianToJulian(gYear, gMonth, gDay); + Panchang panchang(julianDate); + QString tithiName = QString::fromStdString(tithi[(int)panchang.tithi_index]); + QString paksha = QString::fromStdString(panchang.paksha); + QString tithipaksha = QString("%1 %2").arg(paksha).arg(tithiName); + ui->output->setText(QString("ईसवी सन मा परिवर्तन गरियो: %1 %2 %3 गते %5 \n%2 %1 मा जम्मा दिन सङ्ख्या: %4") + .arg(convertToNepaliNumerals(gYear)).arg(bsMonthName).arg(convertToNepaliNumerals(gDay)).arg(convertToNepaliNumerals(bsDaysInMonth)).arg(tithipaksha)); + // Update the calendar + updateCalendar(year, month); + // Populate BS day combo box based on current month and year populateBsDays(year, month); } + void CalendarWindow::updateCalendar(int year, int month) { int daysInMonth = converter.daysInMonth(year, month); @@ -632,3 +701,4 @@ void CalendarWindow::populateBsDays(int year, int month) { // Set the current day ui->dayselectBS->setCurrentText(QString::number(currentDay)); } + diff --git a/calendarwindow.h b/calendarwindow.h index 55407db..2ca5648 100644 --- a/calendarwindow.h +++ b/calendarwindow.h @@ -1,14 +1,14 @@ #ifndef CALENDARWINDOW_H #define CALENDARWINDOW_H -#include +#include #include "bikram.h" +#include "qdatetime.h" #include #include #include #include - namespace Ui { class CalendarWindow; } @@ -18,54 +18,19 @@ class CalendarWindow : public QMainWindow Q_OBJECT public: - - int gYear, gMonth, gDay; explicit CalendarWindow(QWidget *parent = nullptr); - ~CalendarWindow(); - QString getBikramMonthName(int month) { - QStringList bikramMonths = {"बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", - "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", - "फाल्गुन", "चैत"}; - if (month >= 1 && month <= 12) { - return bikramMonths[month - 1]; - } else { - return QString("Invalid Month"); - } - } - QString getEnglishMonthName(int month) { - QStringList englishMonths = {"जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", - "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"}; + ~CalendarWindow(); - // Adjust month to use as an index (0-based in QStringList) - int index = month - 1; + // Static constant month names for Gregorian and Bikram Sambat calendars + static const QStringList gregorianMonths; + static const QStringList bikramMonths; - if (index >= 0 && index < englishMonths.size()) { - return englishMonths.at(index); - } - - return ""; // Return empty string if index is out of range - } + // Methods to get month names + QString getBikramMonthName(int month); + QString getEnglishMonthName(int month); // Function to convert number to Nepali numeral string - QString convertToNepaliNumerals(int number) { - QString nepaliNumbers[] = {"०", "१", "२", "३", "४", "५", "६", "७", "८", "९"}; - QString result; - QString numStr = QString::number(number); - - for (QChar ch : numStr) { - if (ch.isDigit()) { - int digit = ch.digitValue(); - result += nepaliNumbers[digit]; - } else { - result += ch; - } - } - - return result; - } - - - + QString convertToNepaliNumerals(int number); private slots: void onAdYearChanged(int index); @@ -75,6 +40,8 @@ private slots: void onBsMonthChanged(int index); void onBsDayChanged(int index); void ontodayButtonclicked(); + void onnextMonthButtonclicked(); + void onpreviousMonthButtonclicked(); void showMenu(); void showAbout(); void openSourceCode(); @@ -87,6 +54,10 @@ private slots: Ui::CalendarWindow *ui; bikram converter; bool blockSignals; + int gYear, gMonth, gDay; // Moved to private section for encapsulation + QDate currentBikramDate; + + // Private helper methods void centerOnScreen(); void updateBsDateFromAd(int year, int month, int day); void updateAdDateFromBs(int year, int month, int day); @@ -97,6 +68,4 @@ private slots: void populateBsDays(int year, int month); }; - - #endif // CALENDARWINDOW_H diff --git a/calendarwindow.ui b/calendarwindow.ui index 3bff540..3f85a63 100644 --- a/calendarwindow.ui +++ b/calendarwindow.ui @@ -47,6 +47,16 @@ + + + + color: #00ac98; + + + अङ्ग्रेजी मिति + + + @@ -75,14 +85,17 @@ - - - - 12 + + + + color: #00ac98; + + + बिक्रम संवत् मिति - + Qt::ClickFocus @@ -95,7 +108,7 @@ - + Qt::WheelFocus @@ -114,13 +127,31 @@ - - - - color: #00ac98; + + + + 12 - - अङ्ग्रेजी मिति + + + + + + 31 + + + + + + + 32 + + + + + + + 12 @@ -166,13 +197,6 @@ - - - - 31 - - - @@ -371,20 +395,42 @@ - - - - color: #00ac98; - - - बिक्रम संवत् मिति - - - - - - - QPushButton#todayButton { + + + + + + QPushButton#previousMonthButton_2 { + color: white; + background: #3EACBA; /* Light blue background */ + border: 1px solid #379AA4; /* Blue border */ + background-image: linear-gradient(to top, #48C6D4, #3EACBA); /* Blue gradient */ + + border-radius: 5px; /* Rounded corners */ +} + +QPushButton#previousMonthButton_2:hover { + background: #48C6D4; + background-image: linear-gradient(to top, #3EACBA, #48C6D4); +} + +QPushButton#previousMonthButton_2:pressed { + background: qradialgradient(cx: 0.4, cy: -0.1, + fx: 0.4, fy: -0.1, + radius: 1.35, stop: 0 #fff, stop: 1 #ddd); + /* Background color on press */ +} + + + + अघिल्लो महिना + + + + + + + QPushButton#todayButton { color: white; background: #3EACBA; /* Light blue background */ border: 1px solid #379AA4; /* Blue border */ @@ -405,25 +451,43 @@ QPushButton#todayButton:pressed { /* Background color on press */ } - - - आज - - - - - - - 31 - - - - - - - 12 - - + + + आज + + + + + + + QPushButton#nextMonthButton { + color: white; + background: #3EACBA; /* Light blue background */ + border: 1px solid #379AA4; /* Blue border */ + background-image: linear-gradient(to top, #48C6D4, #3EACBA); /* Blue gradient */ + + border-radius: 5px; /* Rounded corners */ +} + +QPushButton#nextMonthButton:hover { + background: #48C6D4; + background-image: linear-gradient(to top, #3EACBA, #48C6D4); +} + +QPushButton#nextMonthButton:pressed { + background: qradialgradient(cx: 0.4, cy: -0.1, + fx: 0.4, fy: -0.1, + radius: 1.35, stop: 0 #fff, stop: 1 #ddd); + /* Background color on press */ +} + + + + अर्को महिना + + + + From c546fe1a353e7b7f177c7ffcf7eda67d3ea18425 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:01:03 +0900 Subject: [PATCH 04/18] changed screenshot --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43f24a1..c74b593 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Nepdate and calendar relies on the following Qt libraries: 6. The floating Nepali date widget will appear on your desktop, with automatic text color adjustment based on the background color. ## Screenshots -nepdate in action ![nepdate](https://github.com/khumnath/nepdate/assets/50103558/8f17f73b-3dfd-4679-a2f9-2461d9b34cf9) +nepdate (v2.0.0) in action ![Screenshot_select-area_20240930185731](https://github.com/user-attachments/assets/93a88b55-4a24-47ce-beee-1c8334ccba3c) ## License From adf3873bdad24df4fcf1d9e9ecc42b1a0d0d7a20 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:24:23 +0900 Subject: [PATCH 05/18] Create c-cpp.yml test --- .github/workflows/c-cpp.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..966e99a --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,41 @@ +name: Qt CMake Build + +on: + push: + branches: + - workflow-test + pull_request: + branches: + - workflow-test + +jobs: + build: + runs-on: ubuntu-latest # You can change this to windows-latest or macos-latest if needed + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y qt6-default qt6-qmake qt6-base-dev qt6-tools-dev + sudo apt-get install -y build-essential cmake + + - name: Configure CMake + run: | + mkdir build + cd build + cmake .. -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt6 + + - name: Build + run: | + cd build + cmake --build . --config Release + + - name: Run Executables + run: | + cd build + ./nepdate-widget # Replace with the name of your Qt executable + ./nepdate-calendar # Replace with the name of your Qt executable + From beea1d24a205dbf0f28b75952d1a37579923387d Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:30:22 +0900 Subject: [PATCH 06/18] Update c-cpp.yml test --- .github/workflows/c-cpp.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 966e99a..4284267 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -3,15 +3,14 @@ name: Qt CMake Build on: push: branches: - - workflow-test + - main pull_request: branches: - - workflow-test + - main jobs: build: - runs-on: ubuntu-latest # You can change this to windows-latest or macos-latest if needed - + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 From aa24f1a2b3b56f470e5447f3e43d17c7c47e116f Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:35:16 +0900 Subject: [PATCH 07/18] Update c-cpp.yml test2 --- .github/workflows/c-cpp.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 4284267..5d6b4f5 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -17,6 +17,8 @@ jobs: - name: Install Dependencies run: | + sudo add-apt-repository ppa:beineri/opt-qt-6.2.0 -y + sudo apt-get update sudo apt-get update sudo apt-get install -y qt6-default qt6-qmake qt6-base-dev qt6-tools-dev sudo apt-get install -y build-essential cmake From fef2a9ae95ba0bab86506c16f68d9213b875e07d Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:43:39 +0900 Subject: [PATCH 08/18] Update c-cpp.yml test3 --- .github/workflows/c-cpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 5d6b4f5..3b569e1 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,12 +14,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - + - name: Enable Universe Repository + run: | + sudo add-apt-repository universe -y + sudo apt-get update - name: Install Dependencies run: | - sudo add-apt-repository ppa:beineri/opt-qt-6.2.0 -y - sudo apt-get update - sudo apt-get update sudo apt-get install -y qt6-default qt6-qmake qt6-base-dev qt6-tools-dev sudo apt-get install -y build-essential cmake From b304639e77c5ea8cfecf8aa3c9eaa76e739af17d Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:50:16 +0900 Subject: [PATCH 09/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 48 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 3b569e1..35088a3 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -1,42 +1,26 @@ -name: Qt CMake Build +name: CI -on: - push: - branches: - - main - pull_request: - branches: - - main +on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest + steps: - - name: Checkout code + - name: Checkout repository uses: actions/checkout@v2 - - name: Enable Universe Repository - run: | - sudo add-apt-repository universe -y - sudo apt-get update - - name: Install Dependencies - run: | - sudo apt-get install -y qt6-default qt6-qmake qt6-base-dev qt6-tools-dev - sudo apt-get install -y build-essential cmake - - name: Configure CMake - run: | - mkdir build - cd build - cmake .. -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt6 + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: '6.2.*' + host: 'linux' + target: 'desktop' + modules: 'qtbase qttools' # Add any additional modules you need - - name: Build - run: | - cd build - cmake --build . --config Release - - - name: Run Executables + - name: Build Project run: | + mkdir build cd build - ./nepdate-widget # Replace with the name of your Qt executable - ./nepdate-calendar # Replace with the name of your Qt executable - + qmake ../nepdate.pro + make From 09c7528865ba3272ab2064278f7e70b862c7d499 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:55:21 +0900 Subject: [PATCH 10/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 35088a3..6d5197a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -10,13 +10,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Install Qt - uses: jurplel/install-qt-action@v4 + - name: Set up Python + uses: actions/setup-python@v2 with: - version: '6.2.*' - host: 'linux' - target: 'desktop' - modules: 'qtbase qttools' # Add any additional modules you need + python-version: '3.11' + + - name: Install aqt + run: | + python -m pip install --upgrade pip + pip install aqtinstall + + - name: List Qt modules + run: | + aqt list-qt linux desktop --modules 6.2.4 + + - name: Install Qt + run: | + aqt install-qt linux desktop 6.2.4 gcc_64 -m qtbase qttools - name: Build Project run: | From 96f5835259b6c9672d0150eb695e116c2395696c Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:57:01 +0900 Subject: [PATCH 11/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 6d5197a..53a11ab 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.11' + python-version: '3.11' # Ensure the correct Python version - name: Install aqt run: | @@ -22,7 +22,7 @@ jobs: - name: List Qt modules run: | - aqt list-qt linux desktop --modules 6.2.4 + aqt list-qt linux desktop 6.2.4 - name: Install Qt run: | From 88f9c4fc518a3ef5495a689293db8a81c4777789 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:58:58 +0900 Subject: [PATCH 12/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 53a11ab..209e761 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -20,9 +20,9 @@ jobs: python -m pip install --upgrade pip pip install aqtinstall - - name: List Qt modules + - name: List Qt versions run: | - aqt list-qt linux desktop 6.2.4 + aqt list-qt linux desktop - name: Install Qt run: | From 7405744a746e0fc299b9545d75226bb8b748b553 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:02:03 +0900 Subject: [PATCH 13/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 209e761..eb48a19 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -13,20 +13,20 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.11' # Ensure the correct Python version + python-version: '3.11' - name: Install aqt run: | python -m pip install --upgrade pip pip install aqtinstall - - name: List Qt versions + - name: List Qt modules run: | - aqt list-qt linux desktop + aqt list-qt linux desktop --modules 6.5.0 gcc_64 - name: Install Qt run: | - aqt install-qt linux desktop 6.2.4 gcc_64 -m qtbase qttools + aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools - name: Build Project run: | From 4be4658298eca97edcf81abcbd0a313ec05daed7 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:08:39 +0900 Subject: [PATCH 14/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 55 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index eb48a19..be7b001 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,30 +7,31 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - - name: Install aqt - run: | - python -m pip install --upgrade pip - pip install aqtinstall - - - name: List Qt modules - run: | - aqt list-qt linux desktop --modules 6.5.0 gcc_64 - - - name: Install Qt - run: | - aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools - - - name: Build Project - run: | - mkdir build - cd build - qmake ../nepdate.pro - make + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install aqt + run: | + python -m pip install --upgrade pip + pip install aqtinstall + + - name: List Qt modules (Optional) + # This step is optional and can be removed if not needed + run: | + aqt list-qt linux desktop --modules 6.5.0 gcc_64 + + - name: Install Qt + run: | + aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools || pip install --upgrade aqt + + - name: Build Project + run: | + mkdir build + cd build + qmake ../nepdate.pro + make From e9a02bc5515ab64c245b43c32feb5a178f981f61 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:19:22 +0900 Subject: [PATCH 15/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index be7b001..817a8fd 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -19,7 +19,8 @@ jobs: run: | python -m pip install --upgrade pip pip install aqtinstall - + pip install --upgrade aqt + - name: List Qt modules (Optional) # This step is optional and can be removed if not needed run: | @@ -27,8 +28,7 @@ jobs: - name: Install Qt run: | - aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools || pip install --upgrade aqt - + aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools - name: Build Project run: | mkdir build From e9bff08ace3840adde4f91738b9796818a5e9ded Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:20:55 +0900 Subject: [PATCH 16/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 817a8fd..6f7a14d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -21,11 +21,6 @@ jobs: pip install aqtinstall pip install --upgrade aqt - - name: List Qt modules (Optional) - # This step is optional and can be removed if not needed - run: | - aqt list-qt linux desktop --modules 6.5.0 gcc_64 - - name: Install Qt run: | aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools From 246afabfc836f416330494c22291f37d15d2ac08 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:42:50 +0900 Subject: [PATCH 17/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 6f7a14d..6c96c8d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,23 +7,17 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - - name: Install aqt - run: | - python -m pip install --upgrade pip - pip install aqtinstall - pip install --upgrade aqt - name: Install Qt - run: | - aqt install-qt linux desktop 6.5.0 gcc_64 -m qtbase qttools + uses: jurplel/install-qt-action@v3 + with: + aqtversion: '==3.1.*' + version: '6.2.0' + host: 'linux' + target: 'desktop' + arch: 'gcc_64' + tools: 'tools_cmake' + archives: 'qttools qtsvg qtdeclarative qtbase icu' - name: Build Project run: | mkdir build From c49a741e3edce63d0918accf7512f2af5e1efb05 Mon Sep 17 00:00:00 2001 From: khumnath <50103558+khumnath@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:46:51 +0900 Subject: [PATCH 18/18] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 6c96c8d..396bdc0 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,10 +7,17 @@ jobs: runs-on: ubuntu-latest steps: - - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: aqtversion: '==3.1.*' version: '6.2.0' host: 'linux' @@ -18,9 +25,10 @@ jobs: arch: 'gcc_64' tools: 'tools_cmake' archives: 'qttools qtsvg qtdeclarative qtbase icu' - - name: Build Project - run: | - mkdir build - cd build - qmake ../nepdate.pro - make + + - name: Build Project + run: | + mkdir build + cd build + qmake ../nepdate.pro + make