Skip to content

Commit

Permalink
Merge pull request #33 from Nighty3098/main
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
Nighty3098 authored Apr 19, 2024
2 parents d24ec8b + 7d7eec7 commit 094e062
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 75 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Build project
on: [push, pull_request, fork]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: building
run: bash CodeKeeper/build.sh
23 changes: 23 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run clang-format Linter
on: [push, pull_request, fork]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: '.'
exclude: './src/CodeKeeper/3rdParty'
extensions: 'h,cpp,c'
clangFormatVersion: 16
inplace: True
- uses: EndBug/add-and-commit@v9
with:
author_name: Nighty3098
author_email: night3098game@gmail.com
message: 'Committing clang-format changes'
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
1 change: 1 addition & 0 deletions src/CodeKeeper/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# ----------------------------------------------------------------------------

*~
*.db
*.autosave
*.a
*.core
Expand Down
12 changes: 7 additions & 5 deletions src/CodeKeeper/keeperFunc/projectsFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void MainWindow::openProject(QListWidget *listWidget, QListWidgetItem *item)
QDialog dialog(this);
dialog.setFixedSize(400, 460);
dialog.setWindowTitle(tr("Edit project"));
dialog.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
dialog->setWindowFlags(windowFlags() | Qt::FramelessWindowHint);

QString data = item->text();
QStringList splitData = data.split("\n");
Expand All @@ -83,7 +83,9 @@ 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] << " " << projectData[5];
qDebug() << "Open project: " << projectData[0] << " " << projectData[1] << " "
<< projectData[2] << " " << projectData[3] << " " << projectData[4] << " "
<< projectData[5];

QGridLayout mainLayout(&dialog);

Expand Down Expand Up @@ -160,16 +162,16 @@ void MainWindow::openProject(QListWidget *listWidget, QListWidgetItem *item)
item->setText(itemText);
qDebug() << itemText;

updateProjectData(&projectTitle, &projectLink, &projectDocumentation, &noteT, &projectCreatedTime, &PCreatedTime, &PGit);
updateProjectData(&projectTitle, &projectLink, &projectDocumentation, &noteT,
&projectCreatedTime, &PCreatedTime, &PGit);

dialog.close();
});

QObject::connect(cancelBtn, &QPushButton::clicked, [&]() { dialog.close(); });

dialog.exec();
}
else {
} else {
qDebug() << "Error";
}
}
Expand Down
86 changes: 38 additions & 48 deletions src/CodeKeeper/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,31 @@
#include "settingswindow.h"
#include "syncwindow.h"

class CustomIconProvider : public QFileIconProvider {
public:
QIcon icon(IconType type) const override {
class CustomIconProvider : public QFileIconProvider
{
public:
QIcon icon(IconType type) const override
{
switch (type) {
case QFileIconProvider::IconType::Computer:
return QIcon(":/home_dir.png");
case QFileIconProvider::IconType::Trashcan:
return QIcon(":/trash.png");
case QFileIconProvider::IconType::File:
return QIcon(":/document.png");
case QFileIconProvider::IconType::Folder:
return QIcon(":/folder.png");
default:
return QFileIconProvider::icon(type);
case QFileIconProvider::IconType::Computer:
return QIcon(":/home_dir.png");
case QFileIconProvider::IconType::Trashcan:
return QIcon(":/trash.png");
case QFileIconProvider::IconType::File:
return QIcon(":/document.png");
case QFileIconProvider::IconType::Folder:
return QIcon(":/folder.png");
default:
return QFileIconProvider::icon(type);
}
}
};

class MainWindow : public QMainWindow {
class MainWindow : public QMainWindow
{
Q_OBJECT

public:
public:
QSettings *globalSettings;
bool isVisibleNotesList;

Expand All @@ -48,7 +51,7 @@ class MainWindow : public QMainWindow {
MainWindow(QWidget *parent = nullptr);
~MainWindow();

private slots:
private slots:
void openSettingsWindow();
void openFolder();

Expand All @@ -69,23 +72,18 @@ class MainWindow : public QMainWindow {
void removeTask();

void on_listWidget_itemClicked(QListWidgetItem *item);
void renameItemOnDoubleClick(QListWidget *listWidget,
QListWidgetItem *item);
void renameItemOnDoubleClick(QListWidget *listWidget, QListWidgetItem *item);
void onNoteDoubleClicked();
void updateTasksProgress(QTabWidget *tasksTab, QListWidget *incompleteTasks,
QListWidget *inprocessTasks,
QListWidget *completeTasks,
QListWidget *inprocessTasks, QListWidget *completeTasks,
QProgressBar *tasksProgress);

void getTotalTasks(QTabWidget *tasksTab, QListWidget *incompleteTasks,
QListWidget *inprocessTasks,
QListWidget *completeTasks);
QListWidget *inprocessTasks, QListWidget *completeTasks);

void getTotalProjects(QTabWidget *tasksTab,
QListWidget *notStartedProjects,
QListWidget *startedProjects,
QListWidget *finishedProjects,
QListWidget *finishlineProjects);
void getTotalProjects(QTabWidget *tasksTab, QListWidget *notStartedProjects,
QListWidget *startedProjects, QListWidget *finishedProjects,
QListWidget *finishlineProjects);

void loadDocumentations(QDir path, QComboBox &comboBox);
void openProject(QListWidget *listWidget, QListWidgetItem *item);
Expand Down Expand Up @@ -124,49 +122,42 @@ class MainWindow : public QMainWindow {
void updateProjectStatus(QString *status, QString *createdTime, QString *oldTime);
void removeProjectFromDB(QString *git_url, QString *status, QString *createdTime);
void saveProjectToDB(QString *title, QString *git_url, QString *status, QString *createdTime);
void updateProjectData(QString *title, QString *git_url, QString *doc, QString *note, QString *createdTime, QString *oldTime, QString *oldGit);
void updateProjectData(QString *title, QString *git_url, QString *doc, QString *note,
QString *createdTime, QString *oldTime, QString *oldGit);
void onMovingProjectFrom(QListWidgetItem *item, QListWidget *list);
void onMovingProjectTo(QListWidgetItem *item, QListWidget *list);


protected:
protected:
void mousePressEvent(QMouseEvent *event) override
{
if (event->button() == Qt::LeftButton)
{
if (event->button() == Qt::LeftButton) {
m_dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
}
else
{
} else {
QMainWindow::mousePressEvent(event);
}
}

void mouseMoveEvent(QMouseEvent *event) override
{
if (event->buttons() & Qt::LeftButton)
{
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - m_dragPosition);
event->accept();
}
else
{
} else {
QMainWindow::mouseMoveEvent(event);
}
}

private:
private:
QWidget *centralWidget;
QGridLayout *mainLayout;
QTabWidget *tabs;
QHBoxLayout *winControlL;

QSizeGrip* sizeGrip;
QSizeGrip* sizeGrip2;
QSizeGrip* sizeGrip3;
QSizeGrip* sizeGrip4;

QSizeGrip *sizeGrip;
QSizeGrip *sizeGrip2;
QSizeGrip *sizeGrip3;
QSizeGrip *sizeGrip4;

QPushButton *maximizeBtn;
QPushButton *closeBtn;
Expand All @@ -175,7 +166,6 @@ class MainWindow : public QMainWindow {
bool isFullScreen;
QPoint m_dragPosition;


// ========================================================
// main tab
QLabel *mainTitle;
Expand Down Expand Up @@ -262,4 +252,4 @@ class MainWindow : public QMainWindow {
SettingsWindow *settingsWindow;
};

#endif // MAINWINDOW_H
#endif // MAINWINDOW_H
14 changes: 7 additions & 7 deletions src/CodeKeeper/moc_predefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define __UINT_LEAST8_TYPE__ unsigned char
#define __SIZEOF_FLOAT80__ 16
#define __BFLT16_DENORM_MIN__ 9.18354961579912115600575419704879436e-41BF16
#define __INTMAX_C(c) c ## L
#define __INTMAX_C(c) c##L
#define __CHAR_BIT__ 8
#define __UINT8_MAX__ 0xff
#define __SCHAR_WIDTH__ 8
Expand Down Expand Up @@ -81,7 +81,7 @@
#define __SCHAR_MAX__ 0x7f
#define __FLT128_MANT_DIG__ 113
#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
#define __INT64_C(c) c ## L
#define __INT64_C(c) c##L
#define __SSP_STRONG__ 3
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
#define __ATOMIC_SEQ_CST 5
Expand Down Expand Up @@ -202,7 +202,7 @@
#define __FLT16_MIN_10_EXP__ (-4)
#define __FLT64X_DECIMAL_DIG__ 21
#define __DEC128_MIN__ 1E-6143DL
#define __REGISTER_PREFIX__
#define __REGISTER_PREFIX__
#define __UINT16_MAX__ 0xffff
#define __FLT128_HAS_INFINITY__ 1
#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
Expand All @@ -212,7 +212,7 @@
#define __FLT_MANT_DIG__ 24
#define __LDBL_DECIMAL_DIG__ 21
#define __VERSION__ "13.2.1 20230801"
#define __UINT64_C(c) c ## UL
#define __UINT64_C(c) c##UL
#define __cpp_unicode_characters 201411L
#define _STDC_PREDEF_H 1
#define __INT_LEAST32_MAX__ 0x7fffffff
Expand Down Expand Up @@ -251,14 +251,14 @@
#define __FLT_RADIX__ 2
#define __INT_LEAST16_TYPE__ short int
#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
#define __UINTMAX_C(c) c ## UL
#define __UINTMAX_C(c) c##UL
#define __FLT16_DIG__ 3
#define __k8 1
#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
#define __SIG_ATOMIC_MAX__ 0x7fffffff
#define __cpp_constexpr 201603L
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define __USER_LABEL_PREFIX__
#define __USER_LABEL_PREFIX__
#define __STDC_IEC_60559_BFP__ 201404L
#define __SIZEOF_PTRDIFF_T__ 8
#define __FLT64X_HAS_INFINITY__ 1
Expand Down Expand Up @@ -400,7 +400,7 @@
#define __cpp_runtime_arrays 198712L
#define __FLT32_DIG__ 6
#define __UINT64_TYPE__ long unsigned int
#define __UINT32_C(c) c ## U
#define __UINT32_C(c) c##U
#define __cpp_alias_templates 200704L
#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
#define __FLT128_IS_IEC_60559__ 1
Expand Down
12 changes: 6 additions & 6 deletions src/CodeKeeper/settingswindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <QtWidgets>
#include <QSettings>

class SettingsWindow : public QMainWindow {
class SettingsWindow : public QMainWindow
{
Q_OBJECT
public:
public:
explicit SettingsWindow(QWidget *parent = nullptr);
~SettingsWindow();
QSettings *globalSettings;
Expand All @@ -25,7 +26,7 @@ class SettingsWindow : public QMainWindow {
bool isHostB;
bool isAutoSyncB;

private slots:
private slots:
void closeEvent(QCloseEvent *event);
void QuitW();
void checkUpdates();
Expand All @@ -34,8 +35,7 @@ class SettingsWindow : public QMainWindow {

void setFontPr2();


private:
private:
QWidget *centralWidget;
QVBoxLayout *mainLayout;
QTabWidget *tabs;
Expand Down Expand Up @@ -85,4 +85,4 @@ class SettingsWindow : public QMainWindow {
QPushButton *openFolder;
};

#endif // SETTINGSWINDOW_H
#endif // SETTINGSWINDOW_H
11 changes: 7 additions & 4 deletions src/CodeKeeper/sql_db/projectsDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ QStringList MainWindow::GetProjectData(QString *title, QString *status, QString
QStringList projectData;
QSqlQuery query;

if (query.exec("SELECT * FROM projects WHERE status = '" + *status + "' AND title = '" + *title + "' AND git_url = '" + *git_url + "'")) {
if (query.exec("SELECT * FROM projects WHERE status = '" + *status + "' AND title = '" + *title
+ "' AND git_url = '" + *git_url + "'")) {
if (query.next()) {
projectData << query.value("title").toString();
projectData << query.value("git_url").toString();
Expand All @@ -39,8 +40,7 @@ QStringList MainWindow::GetProjectData(QString *title, QString *status, QString
projectData << query.value("createdTime").toString();
qDebug() << "Load project: " << projectData;
}
}
else {
} else {
qDebug() << "Error querying projects database:" << query.lastError();
}
return projectData;
Expand All @@ -51,7 +51,10 @@ void MainWindow::updateProjectData(QString *title, QString *git_url, QString *do
{
QSqlQuery query;

if (!query.exec("UPDATE projects SET title = '" + *title + "', git_url = '" + *git_url + "', projectDoc = '" + *doc + "', note = '" + *note + "', createdTime = '" + *createdTime + "' WHERE createdTime = '" + *oldTime + "' AND git_url = '" + oldGit + "'")) {
if (!query.exec("UPDATE projects SET title = '" + *title + "', git_url = '" + *git_url
+ "', projectDoc = '" + *doc + "', note = '" + *note + "', createdTime = '"
+ *createdTime + "' WHERE createdTime = '" + *oldTime + "' AND git_url = '"
+ oldGit + "'")) {
qDebug() << query.lastError();
} else {
qDebug() << "Sucsessfull updated";
Expand Down
Loading

0 comments on commit 094e062

Please sign in to comment.