Browse Source

drop SQLiteCpp dependency

CPP-GTK4
yggverse 4 months ago
parent
commit
dfcc131ce2
  1. 6
      README.md
  2. 6
      src/app.cpp
  3. 2
      src/app.hpp
  4. 2
      src/app/browser.cpp
  5. 4
      src/app/browser.hpp
  6. 2
      src/app/browser/main.cpp
  7. 4
      src/app/browser/main.hpp
  8. 12
      src/app/browser/main/tab.cpp
  9. 4
      src/app/browser/main/tab.hpp

6
README.md

@ -16,8 +16,7 @@ apt install git\ @@ -16,8 +16,7 @@ apt install git\
libglibmm-2.68-dev\
libgtkmm-4.0-dev\
libpangomm-2.48-dev\
libsqlite3-dev\
libsqlitecpp-dev
libsqlite3-dev
```
* `git clone https://github.com/YGGverse/Yoda.git`
@ -68,5 +67,4 @@ pkg-config --cflags --libs gio-2.0\ @@ -68,5 +67,4 @@ pkg-config --cflags --libs gio-2.0\
* [GTK](https://gtk.org) - free and open-source cross-platform widget toolkit
* [gtkmm](https://gtkmm.org) - official C++ interface for GTK
* [SQLite](https://sqlite.org) - profile database
* [SQLiteCpp](https://github.com/SRombauts/SQLiteCpp) - SQLite3 C++ wrapper
* [SQLite](https://sqlite.org) - profile database

6
src/app.cpp

@ -6,9 +6,11 @@ int main( @@ -6,9 +6,11 @@ int main(
char * argv[]
) {
// Init database
SQLite::Database db(
sqlite3 * db;
sqlite3_open(
"database.sqlite3",
SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE
&db
);
// Init application

2
src/app.hpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
#include <glibmm/refptr.h>
#include <gtkmm/application.h>
#include <SQLiteCpp/SQLiteCpp.h>
#include <sqlite3.h>
int main(
int argc,

2
src/app/browser.cpp

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
using namespace app;
Browser::Browser(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gtk::Application> & APP
) {
// Init window actions

4
src/app/browser.hpp

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <gtkmm/application.h>
#include <gtkmm/applicationwindow.h>
#include <gtkmm/object.h>
#include <SQLiteCpp/SQLiteCpp.h>
#include <sqlite3.h>
namespace lib
{
@ -35,7 +35,7 @@ namespace app @@ -35,7 +35,7 @@ namespace app
public:
Browser(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gtk::Application> & APP
);
};

2
src/app/browser/main.cpp

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using namespace app::browser;
Main::Main(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,

4
src/app/browser/main.hpp

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
#include <gtkmm/object.h>
#include <SQLiteCpp/SQLiteCpp.h>
#include <sqlite3.h>
namespace app::browser
{
@ -27,7 +27,7 @@ namespace app::browser @@ -27,7 +27,7 @@ namespace app::browser
public:
Main(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,

12
src/app/browser/main/tab.cpp

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
using namespace app::browser::main;
Tab::Tab(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,
@ -14,7 +14,10 @@ Tab::Tab( @@ -14,7 +14,10 @@ Tab::Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_UPDATE
) {
// Init database
db.exec(
char * errmsg;
::sqlite3_exec(
db,
R"SQL(
CREATE TABLE IF NOT EXISTS `app_browser_main_tab`
(
@ -22,7 +25,10 @@ Tab::Tab( @@ -22,7 +25,10 @@ Tab::Tab(
`time` INTEGER NOT NULL,
`request` VARCHAR(1024)
)
)SQL"
)SQL",
nullptr,
nullptr,
&errmsg
);
// Init actions

4
src/app/browser/main/tab.hpp

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <gtkmm/notebook.h>
#include <SQLiteCpp/SQLiteCpp.h>
#include <sqlite3.h>
namespace app::browser::main
{
@ -42,7 +42,7 @@ namespace app::browser::main @@ -42,7 +42,7 @@ namespace app::browser::main
public:
Tab(
SQLite::Database & db,
sqlite3 * db,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__REFRESH,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE_ACTIVE,
const Glib::RefPtr<Gio::SimpleAction> & ACTION__MAIN_TAB_CLOSE_ALL,

Loading…
Cancel
Save