Skip to content

Commit

Permalink
Merge pull request #45 from Nighty3098/main
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
Nighty3098 committed Apr 20, 2024
2 parents 0a8c0a5 + 481a4bd commit f162238
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

src/CodeKeeper/CodeKeeper
src/CodeKeeper/data.db
src/CodeKeeper/data.db
*.db
src/CodeKeeper/moc_predefs.h
src/CodeKeeper/qmake_qmake_immediate.qrc
*.db
1 change: 0 additions & 1 deletion src/CodeKeeper/CodeKeeper.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ SOURCES += \
keeperFunc/tasksFunc.cpp \
keeperFunc/projectsFunc.cpp \
keeperFunc/notesFunc.cpp \
sql_db/connectionDB.cpp \
sql_db/projectsDB.cpp \
sql_db/tasksDB.cpp

Expand Down
Binary file removed src/CodeKeeper/data.db
Binary file not shown.
7 changes: 0 additions & 7 deletions src/CodeKeeper/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <QSplashScreen>

#include "mainwindow.h"
#include "sql_db/connectionDB.cpp"

int main(int argc, char *argv[])
{
Expand All @@ -12,12 +11,6 @@ int main(int argc, char *argv[])

QApplication a(argc, argv);

if (createConnection() == false) {
return -1;
} else {
qDebug() << "Connected";
}

MainWindow w;

a.setStyleSheet(file.readAll());
Expand Down
2 changes: 2 additions & 0 deletions src/CodeKeeper/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
}
});

createConnection(&dir);

create_tasks_connection();
create_projects_connection();

Expand Down
1 change: 1 addition & 0 deletions src/CodeKeeper/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private slots:


protected:
bool createConnection(QString *path);
void mousePressEvent(QMouseEvent *event) override
{
if (event->button() == Qt::LeftButton) {
Expand Down
17 changes: 17 additions & 0 deletions src/CodeKeeper/settingsFunc/functional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ void SettingsWindow::QuitW()
this->close();
}

bool MainWindow::createConnection(QString *path)
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(*path + "/data.db");

db.setUserName("admin");
db.setHostName("localhost");
db.setPassword("password");

if (!db.open()) {
qDebug() << db.lastError();
return false;
}

return true;
}

void SettingsWindow::closeEvent(QCloseEvent *event)
{
MainWindow *mainWindow = static_cast<MainWindow *>(parent());
Expand Down
19 changes: 0 additions & 19 deletions src/CodeKeeper/sql_db/connectionDB.cpp

This file was deleted.

0 comments on commit f162238

Please sign in to comment.