Skip to content

Commit

Permalink
Merge pull request #90 from DXS-SQUAD/InDev
Browse files Browse the repository at this point in the history
Edited
  • Loading branch information
Nighty3098 authored Jun 7, 2024
2 parents 6834ff3 + 8e782e6 commit 54954c8
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 89 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Nighty3098

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions src/CodeKeeper/accountFunc/functional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void AccountWindow::setImageFromUrl(const QString &url, QLabel *label)
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url)));
QObject::connect(reply, &QNetworkReply::finished, [=]() {
if (reply->error()) {
qDebug() << "Error:" << reply->errorString();
qWarning() << "\033[0m\033[33mError:" << reply->errorString();
reply->deleteLater();
return;
}
Expand Down Expand Up @@ -94,7 +94,7 @@ void AccountWindow::setUserData(const QString &username, QLabel *label)
QNetworkReply *reply = manager->get(request);
QObject::connect(reply, &QNetworkReply::finished, [=]() {
if (reply->error()) {
qDebug() << "Error:" << reply->errorString();
qWarning() << "\033[0m\033[33mError:" << reply->errorString();
reply->deleteLater();
return;
}
Expand All @@ -116,7 +116,7 @@ void AccountWindow::setUserData(const QString &username, QLabel *label)
qDebug() << "Company:" << obj["company"].toString();
qDebug() << "Login:" << obj["login"].toString();

qDebug() << doc;
qDebug() << "\033[0m\033[32m" << doc;

profileInfo->setText("Public repos: " + QString::number(obj["public_repos"].toInt())
+ "\n\nFollowing: " + QString::number(obj["following"].toInt())
Expand Down
4 changes: 2 additions & 2 deletions src/CodeKeeper/accountwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ AccountWindow::AccountWindow(QWidget *parent) : QMainWindow{ parent }
QObject::connect(styleThread, &QThread::started, this, [this]() {
setFontStyle();

qDebug() << "🟢 styleThread started";
qDebug() << "\033[0m\033[32mstyleThread started";
});
styleThread->start();

QThread *setUserDataThread = new QThread;
QObject::connect(setUserDataThread, &QThread::started, this, [this]() {
setUserData(git_user, profilePicture);

qDebug() << "🟢 setUserDataThread started";
qDebug() << "\033[0m\033[32msetUserDataThread started";
});
setUserDataThread->start();

Expand Down
18 changes: 9 additions & 9 deletions src/CodeKeeper/keeperFunc/functional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ QString MainWindow::getKeeperStats()

bool MainWindow::createConnection(QString path)
{
qDebug() << "🔸DB path: " << (path) + QStringLiteral("/data.db");
qDebug() << "\033[0m\033[32mDB path: " << (path) + QStringLiteral("/data.db");

QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName((path) + QStringLiteral("/data.db"));
Expand All @@ -41,7 +41,7 @@ bool MainWindow::createConnection(QString path)
db.setPassword("password");

if (!db.open()) {
qCritical() << "🔴 " << db.lastError();
qCritical() << "\033[0m\033[31m" << db.lastError();
return false;
}

Expand Down Expand Up @@ -87,7 +87,7 @@ void MainWindow::getSettingsData()
isForks = globalSettings->value("isForks").value<bool>();
isRepoSize = globalSettings->value("isRepoSize").value<bool>();

qDebug() << "🔸 " << dir << selectedFont << font_size << theme << isCustomTitlebar
qDebug() << "\033[0m\033[32m " << dir << selectedFont << font_size << theme << isCustomTitlebar
<< sortNotesRole << isAutoSyncing << isVisibleNotesList << isVisibleFolders
<< isVisiblePreview << isViewMode << git_repo << git_user << git_token << isAutoSyncB;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ void MainWindow::fOpenAccountWindow()

accountWindow->move(new_x, new_y);

qDebug() << "🟢 accountWindowThread started";
qDebug() << "\033[0m\033[32maccountWindowThread started";
});
accountWindowThread->start();
}
Expand Down Expand Up @@ -241,7 +241,7 @@ void MainWindow::openSettingsWindow()

settingsWindow->move(new_x, new_y);

qDebug() << "🟢 settingsWindowThread started";
qDebug() << "\033[0m\033[32msettingsWindowThread started";
});
settingsWindowThread->start();
}
Expand All @@ -263,7 +263,7 @@ bool MainWindow::checkConnection()
// qDebug() << "You are connected to the internet :)";
return true;
} else {
qWarning() << "🔴 You have an net error:" << reply->errorString();
qWarning() << "\033[0m\033[31mYou have an net error:" << reply->errorString();
return false;
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ void MainWindow::openSyncWindow()
syncWindow->show();
syncWindow->move(new_x, new_y);

qDebug() << "🟢 syncWindowThread started";
qDebug() << "\033[0m\033[32msyncWindowThread started";
});
syncWindowThread->start();
}
Expand All @@ -303,7 +303,7 @@ void MainWindow::openFolder()
QString str = QFileDialog::getExistingDirectory(0, "Select a directory");
if (!str.isEmpty()) {
globalSettings->setValue("path", str);
qDebug() << "🟢 " << str;
qDebug() << "\033[0m\033[32m" << str;
}
}

Expand All @@ -325,7 +325,7 @@ void MainWindow::on_listWidget_itemClicked(QListWidgetItem *item)

void MainWindow::setFontPr1(QFont *selectedFont, int *font_size_int)
{
qDebug() << "🟢 Applying preferences";
qDebug() << "\033[0m\033[32mApplying preferences";

QString font_size = QString::number(*font_size_int);

Expand Down
23 changes: 12 additions & 11 deletions src/CodeKeeper/keeperFunc/notesFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ bool createFile(const QString &path)
QTextStream stream(&file);
stream << "Just start typing...";
file.close();
qDebug() << "🟢 File created successfully at" << path;
qDebug() << "\033[0m\033[32mFile created successfully at" << path;
return true;
} else {
qWarning() << "🔴 Failed to create file at" << path << ": " << file.errorString();
qWarning() << "\033[0m\033[33mFailed to create file at" << path << ": "
<< file.errorString();
return false;
}
}
Expand All @@ -39,7 +40,7 @@ void MainWindow::exportNoteToPdf()
QModelIndex selectedIndex = notesList->currentIndex();
QFileSystemModel *fileSystemModel = static_cast<QFileSystemModel *>(notesList->model());
QString filePath = fileSystemModel->filePath(selectedIndex);
qDebug() << "🟢 File Path: " << filePath;
qDebug() << "\033[0m\033[32mFile Path: " << filePath;

QString str = QFileDialog::getSaveFileName(0, "Enter filename");
QString pdf_file = str + ".pdf";
Expand All @@ -64,7 +65,7 @@ void MainWindow::exportNoteToHtml()
QModelIndex selectedIndex = notesList->currentIndex();
QFileSystemModel *fileSystemModel = static_cast<QFileSystemModel *>(notesList->model());
QString filePath = fileSystemModel->filePath(selectedIndex);
qDebug() << "🟢 File Path: " << filePath;
qDebug() << "\033[0m\033[32mFile Path: " << filePath;

QString str = QFileDialog::getSaveFileName(0, "Enter filename");
QString html_file = str + ".html";
Expand All @@ -86,9 +87,9 @@ void MainWindow::exportNoteToHtml()
QTextStream stream(&file);
stream << html;
file.close();
qDebug() << "🟢 File saved successfully at" << filePath;
qDebug() << "\033[0m\033[32mFile saved successfully at" << filePath;
} else {
qWarning() << "🔴 Error, Failed to open file for writing.";
qWarning() << "\033[0m\033[33mError, Failed to open file for writing.";
}
}

Expand Down Expand Up @@ -140,10 +141,10 @@ void MainWindow::saveNote()
file.close();
// qDebug() << "Success", "Text written to file successfully.";
} else {
qWarning() << "🔴 Error", "Failed to open file for writing.";
qWarning() << "\033[0m\033[33mError", "Failed to open file for writing.";
}
} else {
qWarning() << "🔴 Error", "Please select a valid file.";
qWarning() << "\033[0m\033[33mError", "Please select a valid file.";
}
}

Expand All @@ -165,7 +166,7 @@ void MainWindow::onNoteDoubleClicked()
}
} else {
noteEdit->setPlainText("### File format not supported.");
qWarning() << "🔴 File format not supported";
qWarning() << "\033[0m\033[33mFile format not supported";
}
}
}
Expand Down Expand Up @@ -254,10 +255,10 @@ void MainWindow::removeNote()
QModelIndex index = notesList->currentIndex();
if (index.isValid()) {
if (notesDirModel->fileInfo(index).isDir()) {
qDebug() << "🟢 Folder deleted successfully";
qDebug() << "\033[0m\033[32mFolder deleted successfully";
notesDirModel->rmdir(index);
} else {
qDebug() << "🟢 Note deleted successfully";
qDebug() << "\033[0m\033[32mNote deleted successfully";
notesDirModel->remove(index);
}
}
Expand Down
27 changes: 16 additions & 11 deletions src/CodeKeeper/keeperFunc/projectsFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

void MainWindow::onMovingProjectFrom(QListWidgetItem *item, QListWidget *list)
{
qDebug() << "🟢 Moving project: " << item->text() << " from: " << list->objectName();
qDebug() << "\033[0m\033[32mMoving project: " << item->text()
<< " from: " << list->objectName();
}

void MainWindow::onMovingProjectTo(QListWidgetItem *item, QListWidget *list)
{
qDebug() << "🟢 Moved project: " << item->text() << " to: " << list->objectName();
qDebug() << "\033[0m\033[32mMoved project: " << item->text() << " to: " << list->objectName();
QStringList data = item->text().split("\n");
QString status = list->objectName();
QString date = getCurrentDateTimeString();
Expand Down Expand Up @@ -52,7 +53,7 @@ void MainWindow::createProject()
QString git = "https://github.com/";
QString newProjectTeamplate = title + "\n" + git + "\n" + date;

qDebug() << "🟢 New project: " << newProjectTeamplate;
qDebug() << "\033[0m\033[32mNew project: " << newProjectTeamplate;

notStartedProjects->addItem(newProjectTeamplate);

Expand All @@ -74,7 +75,7 @@ void MainWindow::removeProject()

removeProjectFromDB(&data[1], &status, &data[2]);

qDebug() << "🟢 Removed project: " << item->text();
qDebug() << "\033[0m\033[32mRemoved project: " << item->text();
delete item;
break;
}
Expand Down Expand Up @@ -163,6 +164,7 @@ QString MainWindow::getRepositoryData(QString git_url)

QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());
QJsonObject obj = doc.object();
// qDebug() << doc;

repoData = "Name: " + obj["name"].toString();

Expand Down Expand Up @@ -214,13 +216,14 @@ QString MainWindow::getRepositoryData(QString git_url)
loop.exec();

if (commitReply->error()) {
qWarning() << "Error:" << commitReply->errorString();
qWarning() << "\033[0m\033[31mError:" << commitReply->errorString();
commitReply->deleteLater();
}

QJsonDocument commitDoc = QJsonDocument::fromJson(commitReply->readAll());
QJsonObject commitObj = commitDoc.object();
QJsonArray commits = commitDoc.array();
// qDebug() << commitDoc;

if (commits.isEmpty()) {
if (isLastCommit) {
Expand All @@ -244,12 +247,13 @@ QString MainWindow::getRepositoryData(QString git_url)
loop.exec();

if (releaseReply->error()) {
qWarning() << "Error:" << releaseReply->errorString();
qWarning() << "\033[0m\033[31mError:" << releaseReply->errorString();
releaseReply->deleteLater();
}

QJsonDocument releaseDoc = QJsonDocument::fromJson(releaseReply->readAll());
QJsonArray releases = releaseDoc.array();
// qDebug() << releaseDoc;

int totalDownloads = 0;
for (const QJsonValue &release : releases) {
Expand All @@ -276,6 +280,7 @@ QString MainWindow::getRepositoryData(QString git_url)

QJsonDocument releasesDoc = QJsonDocument::fromJson(releasesReply->readAll());
QJsonObject releasesObj = releasesDoc.object();
// qDebug() << releasesDoc;

if (isRelease) {
repoData += QString(" \n Release: ") + " ";
Expand All @@ -292,7 +297,7 @@ QString MainWindow::getRepositoryData(QString git_url)
releasesReply->deleteLater();
reply->deleteLater();

qDebug() << repoData;
qDebug() << "\033[0m\033[32m" << repoData;
return repoData;
}

Expand Down Expand Up @@ -393,8 +398,8 @@ void MainWindow::openProject(QListWidget *listWidget, QListWidgetItem *item)
QString PStatus = listWidget->objectName();

QStringList projectData = GetProjectData(&PTitle, &PStatus, &PGit);
qDebug() << "Open project: " << projectData[0] << " " << projectData[1] << " "
<< projectData[2] << " " << projectData[3] << " " << projectData[4];
qDebug() << "\033[0m\033[32mOpen project: " << projectData[0] << " " << projectData[1]
<< " " << projectData[2] << " " << projectData[3] << " " << projectData[4];

QGridLayout mainLayout(&dialog);

Expand All @@ -413,7 +418,7 @@ void MainWindow::openProject(QListWidget *listWidget, QListWidgetItem *item)
linkToGit->setFont(selectedFont);

QComboBox *documentation = new QComboBox();
documentation->setFixedSize(190, 25);
documentation->setFixedSize(190, 20);
documentation->setFont(selectedFont);

QLabel *lastMod = new QLabel();
Expand Down Expand Up @@ -520,6 +525,6 @@ void MainWindow::openProject(QListWidget *listWidget, QListWidgetItem *item)

dialog.exec();
} else {
qWarning() << "🔴 Error";
qWarning() << "\033[0m\033[33mError";
}
}
10 changes: 5 additions & 5 deletions src/CodeKeeper/keeperFunc/tasksFunc.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
void MainWindow::onMovingTaskFrom(QListWidgetItem *item, QListWidget *list)
{
qDebug() << "🟢 Moving task: " << item->text() << " from: " << list->objectName();
qDebug() << "\033[0m\033[32mMoving task: " << item->text() << " from: " << list->objectName();

QString task = item->text();
QString status = list->objectName();
}

void MainWindow::onMovingTaskTo(QListWidgetItem *item, QListWidget *list)
{
qDebug() << "🟢 Moved task: " << item->text() << " to: " << list->objectName();
qDebug() << "\033[0m\033[32mMoved task: " << item->text() << " to: " << list->objectName();

QString task = item->text();
QString status = list->objectName();
Expand All @@ -24,12 +24,12 @@ void MainWindow::addNewTask()
if (!text.isEmpty()) {
taskText->clear();
QString task = text + "\n" + getCurrentDateTimeString();
qDebug() << "🟢 Added new task: " << task;
qDebug() << "\033[0m\033[32mAdded new task: " << task;
incompleteTasks->addItem(task);
QString status = incompleteTasks->objectName();
saveTaskToDB(&task, &status);
} else {
qWarning() << "🟠 Task is empty";
qWarning() << "\033[0m\033[33mTask is empty";
}
}

Expand All @@ -41,7 +41,7 @@ void MainWindow::removeTask()
QListWidgetItem *item = listWidget->currentItem();
if (item) {
listWidget->takeItem(listWidget->row(item));
qDebug() << "🔴 Removed task: " << item->text();
qDebug() << "\033[0m\033[31mRemoved task: " << item->text();

QString task = item->text();
QString status = listWidget->objectName();
Expand Down
4 changes: 2 additions & 2 deletions src/CodeKeeper/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ bool loadApp(QSplashScreen *psplash)
if (!reply->isFinished()) {
loop.exec();
if (reply->error() == QNetworkReply::NoError) {
qDebug() << "Connected";
qDebug() << "\033[0m\033[32mConnected";
return true;
} else {
qDebug() << "Error: " << reply->errorString();
qDebug() << "\033[0m\033[31mError: " << reply->errorString();
return false;
}
}
Expand Down
Loading

0 comments on commit 54954c8

Please sign in to comment.