Browse Source

drop SQLiteCpp dependency

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

6
src/app.cpp

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

2
src/app.hpp

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

2
src/app/browser.cpp

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

4
src/app/browser.hpp

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

2
src/app/browser/main.cpp

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

4
src/app/browser/main.hpp

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

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

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

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

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

Loading…
Cancel
Save