From ebd6c6fa9817cfd6acc0b90e4e7ff93259f78258 Mon Sep 17 00:00:00 2001 From: Nighty3098 <154594695+Nighty3098@users.noreply.github.com> Date: Sat, 20 Jul 2024 21:55:03 +0700 Subject: [PATCH 1/2] Delete cmake.check_cache --- src/CodeKeeper/CMakeFiles/cmake.check_cache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/CodeKeeper/CMakeFiles/cmake.check_cache diff --git a/src/CodeKeeper/CMakeFiles/cmake.check_cache b/src/CodeKeeper/CMakeFiles/cmake.check_cache deleted file mode 100644 index 3dccd731..00000000 --- a/src/CodeKeeper/CMakeFiles/cmake.check_cache +++ /dev/null @@ -1 +0,0 @@ -# This file is generated by cmake for dependency checking of the CMakeCache.txt file From 04b46c0e47d9a3a6e8e0cdebb7fd99da67d5f7ae Mon Sep 17 00:00:00 2001 From: Nighty3098 <154594695+Nighty3098@users.noreply.github.com> Date: Sun, 21 Jul 2024 13:31:24 +0700 Subject: [PATCH 2/2] The project window has been changed. Added project description --- src/CodeKeeper/accountFunc/functional.cpp | 8 +++--- src/CodeKeeper/keeperFunc/getProjectInfo.cpp | 8 ++++-- src/CodeKeeper/keeperFunc/projectsFunc.cpp | 28 ++++++++++++++------ src/CodeKeeper/mainwindow.h | 2 +- src/CodeKeeper/syncwindow.cpp | 3 ++- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/CodeKeeper/accountFunc/functional.cpp b/src/CodeKeeper/accountFunc/functional.cpp index d4fe19eb..0b8ef337 100644 --- a/src/CodeKeeper/accountFunc/functional.cpp +++ b/src/CodeKeeper/accountFunc/functional.cpp @@ -174,7 +174,7 @@ int AccountWindow::getStarsCount(const QString& username, const QString& token) return totalStars; } -void AccountWindow::setUserData(const QString& username, QLabel *label) +void AccountWindow::setUserData(const QString& username, QLabel* label) { QNetworkAccessManager* manager = new QNetworkAccessManager(this); QUrl url("https://api.github.com/users/" + git_user); @@ -214,9 +214,9 @@ void AccountWindow::setUserData(const QString& username, QLabel *label) qDebug() << "Company:" << obj["company"].toString(); qDebug() << "Login:" << obj["login"].toString(); - label->setText("\n\n" + obj["bio"].toString() + "\nPublic repos: " + QString::number(obj["public_repos"].toInt()) + "\n\nFollowing: " - + QString::number(obj["following"].toInt()) + "\n\nFollowers: " + QString::number(obj["followers"].toInt()) - + "\n\nStars: " + QString::number(getStarsCount(git_user, git_token)) + "\n"); + label->setText("\n\n" + obj["bio"].toString() + "\nPublic repos: " + QString::number(obj["public_repos"].toInt()) + + "\n\nFollowing: " + QString::number(obj["following"].toInt()) + "\n\nFollowers: " + QString::number(obj["followers"].toInt()) + + "\n\nStars: " + QString::number(getStarsCount(git_user, git_token)) + "\n"); reply->deleteLater(); }); diff --git a/src/CodeKeeper/keeperFunc/getProjectInfo.cpp b/src/CodeKeeper/keeperFunc/getProjectInfo.cpp index 1d0f8ff4..8cc85637 100644 --- a/src/CodeKeeper/keeperFunc/getProjectInfo.cpp +++ b/src/CodeKeeper/keeperFunc/getProjectInfo.cpp @@ -91,13 +91,13 @@ void MainWindow::createGitBadges(QString git_url, QWebEngineView* page) page->setHtml(html); } -QString MainWindow::getRepositoryData(QString git_url, QTableWidget* table) +QString MainWindow::getRepositoryData(QString git_url, QTableWidget* table, QLabel* label) { QString prefix = "https://github.com/"; QString repo = git_url.replace(prefix, ""); QString repoData; - QString name, createdAt, openIssues, forks, lang, stars, repoSize, license, totalDownloads, release, releaseDate, lastCommitS; + QString name, description, createdAt, openIssues, forks, lang, stars, repoSize, license, totalDownloads, release, releaseDate, lastCommitS; QNetworkAccessManager* manager = new QNetworkAccessManager(this); @@ -130,6 +130,8 @@ QString MainWindow::getRepositoryData(QString git_url, QTableWidget* table) name = obj["name"].toString(); + description = obj["description"].toString(); + createdAt = obj["created_at"].toString(); QDateTime createdDate = QDateTime::fromString(createdAt, Qt::ISODate); createdAt = createdDate.toString("dd MMM yyyy hh:mm"); @@ -343,6 +345,8 @@ QString MainWindow::getRepositoryData(QString git_url, QTableWidget* table) textList << "Release at"; } + label->setText(name + " - " + description); + for (int i = 0; i < dataList.count(); i++) { table->setItem(i, 0, new QTableWidgetItem(textList[i])); table->setItem(i, 1, new QTableWidgetItem(dataList[i])); diff --git a/src/CodeKeeper/keeperFunc/projectsFunc.cpp b/src/CodeKeeper/keeperFunc/projectsFunc.cpp index 77e22481..2d81e500 100644 --- a/src/CodeKeeper/keeperFunc/projectsFunc.cpp +++ b/src/CodeKeeper/keeperFunc/projectsFunc.cpp @@ -119,6 +119,7 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) dialog.setMinimumHeight(500); dialog.setWindowTitle(tr("Project")); dialog.setWindowFlags(windowFlags() | Qt::FramelessWindowHint); + dialog.setStyleSheet("QWidget { background-color: #222126; } QPushButton {background-color: #0a070d; } QLineEdit {background-color: #0a070d;}"); QPushButton* saveDataBtn = new QPushButton(); saveDataBtn->setText("Save"); @@ -158,6 +159,7 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) QTabWidget* tabs = new QTabWidget(); tabs->setMovable(true); tabs->setTabPosition(QTabWidget::South); + tabs->setStyleSheet(" QTabBar::tab { height: 15px; width: 100px; background: #222126; } QTabBar::tab:selected { height: 15px; width: 100px; color: #fff; background: #0a070d; }"); QWidget* projectTab = new QWidget(); QGridLayout mainLayout(projectTab); @@ -208,6 +210,14 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) git_stats->setContentsMargins(0, 0, 0, 0); git_stats->setAlternatingRowColors(true); + git_stats->setStyleSheet("QTableWidget { background-color: transparent; alternate-background-color: #0a070d; } QTableWidget::item {border-radius: 5px;}"); + + QLabel* descriptionL = new QLabel(); + descriptionL->setFixedHeight(30); + descriptionL->setAlignment(Qt::AlignCenter); + descriptionL->setFont(selectedFont); + descriptionL->setStyleSheet("font-size: " + font_size + "pt;"); + QHBoxLayout* statsLayout = new QHBoxLayout(); QSpacerItem* leftSpacer = new QSpacerItem(0, 10, QSizePolicy::Expanding, QSizePolicy::Minimum); @@ -233,10 +243,11 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) loadDocumentations(dir, *documentation); documentation->setCurrentText(projectData[2]); - mainLayout.addWidget(title, 2, 0, 1, 2); - mainLayout.addWidget(linkToGit, 3, 0, 1, 2); - mainLayout.addWidget(documentation, 4, 0); - mainLayout.addWidget(openButton, 4, 1); + mainLayout.addWidget(title, 0, 0, 1, 2); + mainLayout.addWidget(linkToGit, 1, 0, 1, 2); + // mainLayout.addWidget(documentation, 2, 0); + // mainLayout.addWidget(openButton, 2, 1); + // mainLayout.addWidget(descriptionL, 3, 0, 1, 2); mainLayout.addLayout(statsLayout, 5, 0, 5, 2); mainLayout.addWidget(lastMod, 10, 0, 1, 2, Qt::AlignCenter); @@ -255,11 +266,12 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) tabs->addTab(projectTab, "Project"); tabs->addTab(issuesTab, "Issues"); + centralLayout->addWidget(descriptionL); centralLayout->addWidget(tabs); QThread* thread = new QThread; - QObject::connect(thread, &QThread::started, this, [this, projectData, git_stats, issuesLabel]() { - getRepositoryData(projectData[1], git_stats); + QObject::connect(thread, &QThread::started, this, [this, projectData, git_stats, issuesLabel, descriptionL]() { + getRepositoryData(projectData[1], git_stats, descriptionL); issuesLabel->setHtml(getProjectIssues(projectData[1])); }); thread->start(); @@ -291,8 +303,8 @@ void MainWindow::openProject(QListWidget* listWidget, QListWidgetItem* item) QString repo = projectLink.replace(prefix, ""); QThread* thread = new QThread; - QObject::connect(thread, &QThread::started, this, [this, projectData, repo, git_stats, issuesLabel]() { - getRepositoryData(repo, git_stats); + QObject::connect(thread, &QThread::started, this, [this, projectData, repo, git_stats, issuesLabel, descriptionL]() { + getRepositoryData(repo, git_stats, descriptionL); issuesLabel->setHtml(getProjectIssues(repo)); }); thread->start(); diff --git a/src/CodeKeeper/mainwindow.h b/src/CodeKeeper/mainwindow.h index 9e868c40..668b85bb 100644 --- a/src/CodeKeeper/mainwindow.h +++ b/src/CodeKeeper/mainwindow.h @@ -157,7 +157,7 @@ class MainWindow : public QMainWindow bool isRepoSize; private slots: - QString getRepositoryData(QString git_url, QTableWidget *table); + QString getRepositoryData(QString git_url, QTableWidget *table, QLabel *label); QString getProjectIssues(QString git_url); void openSettingsWindow(); diff --git a/src/CodeKeeper/syncwindow.cpp b/src/CodeKeeper/syncwindow.cpp index 67b8a34f..1cae0997 100644 --- a/src/CodeKeeper/syncwindow.cpp +++ b/src/CodeKeeper/syncwindow.cpp @@ -14,7 +14,8 @@ SyncWindow::SyncWindow(QWidget* parent) : QMainWindow(parent) centralWidget = new QWidget(this); setCentralWidget(centralWidget); - this->setStyleSheet(" QWidget { background-color: #222126; } QPushButton {background-color: #0a070d; } QProgressBar {background-color: #0a070d; }"); + this->setStyleSheet( + " QWidget { background-color: #222126; } QPushButton {background-color: #0a070d; } QProgressBar {background-color: #0a070d; }"); this->setWindowFlags(windowFlags() | Qt::FramelessWindowHint); this->setFixedSize(300, 500);