Browse Source

add namespace to session methods

CPP-GTK4
yggverse 3 months ago
parent
commit
d8cf3c6d1f
  1. 20
      src/app/browser.cpp
  2. 8
      src/app/browser.hpp
  3. 8
      src/app/browser/main.cpp
  4. 4
      src/app/browser/main.hpp
  5. 12
      src/app/browser/main/tab.cpp
  6. 4
      src/app/browser/main/tab.hpp
  7. 4
      src/app/browser/main/tab/label.cpp
  8. 4
      src/app/browser/main/tab/label.hpp
  9. 8
      src/app/browser/main/tab/page.cpp
  10. 4
      src/app/browser/main/tab/page.hpp
  11. 12
      src/app/browser/main/tab/page/navigation.cpp
  12. 4
      src/app/browser/main/tab/page/navigation.hpp
  13. 4
      src/app/browser/main/tab/page/navigation/history.cpp
  14. 4
      src/app/browser/main/tab/page/navigation/history.hpp
  15. 4
      src/app/browser/main/tab/page/navigation/request.cpp
  16. 4
      src/app/browser/main/tab/page/navigation/request.hpp

20
src/app/browser.cpp

@ -30,7 +30,7 @@ Browser::Browser(
"session_clean", "session_clean",
[this] [this]
{ {
clean(); session_clean();
} }
); );
@ -38,7 +38,7 @@ Browser::Browser(
"session_restore", "session_restore",
[this] [this]
{ {
restore(); session_restore();
} }
); );
@ -46,7 +46,7 @@ Browser::Browser(
"session_save", "session_save",
[this] [this]
{ {
save(); session_save();
} }
); );
@ -243,14 +243,14 @@ Browser::Browser(
"<Primary>q" "<Primary>q"
); );
restore(); // last session from DB session_restore(); // last session from DB
} }
); );
signal_close_request().connect( signal_close_request().connect(
[this] [this]
{ {
save(); session_save();
// @TODO sqlite3_close(db); // @TODO sqlite3_close(db);
@ -261,7 +261,7 @@ Browser::Browser(
} }
// Actions // Actions
int Browser::restore() int Browser::session_restore()
{ {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -298,7 +298,7 @@ int Browser::restore()
) ? fullscreen() : unfullscreen(); ) ? fullscreen() : unfullscreen();
// Restore children components // Restore children components
browserMain->restore( browserMain->session_restore(
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -312,7 +312,7 @@ int Browser::restore()
); );
} }
void Browser::clean() void Browser::session_clean()
{ {
DB::SESSION::clean( DB::SESSION::clean(
db db
@ -321,7 +321,7 @@ void Browser::clean()
browserMain->tab_close_all(); browserMain->tab_close_all();
} }
void Browser::save() void Browser::session_save()
{ {
char * error; // @TODO char * error; // @TODO
@ -339,7 +339,7 @@ void Browser::save()
); );
// Delegate save actions to children components // Delegate save actions to children components
browserMain->save( browserMain->session_save(
APP_BROWSER__SESSION__ID APP_BROWSER__SESSION__ID
); );
} }

8
src/app/browser.hpp

@ -85,11 +85,9 @@ namespace app
); );
// Actions // Actions
int restore(); // return sqlite3_finalize status code int session_restore(); // return sqlite3_finalize status code
void session_clean();
void clean(); void session_save();
void save();
}; };
} }

8
src/app/browser/main.cpp

@ -45,7 +45,7 @@ Main::Main(
// Actions // Actions
/// Session /// Session
int Main::restore( int Main::session_restore(
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -69,7 +69,7 @@ int Main::restore(
{ {
while (sqlite3_step(statement) == SQLITE_ROW) while (sqlite3_step(statement) == SQLITE_ROW)
{ {
mainTab->restore( mainTab->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -83,7 +83,7 @@ int Main::restore(
); );
}; };
void Main::save( void Main::session_save(
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
) { ) {
char * error; // @TODO char * error; // @TODO
@ -101,7 +101,7 @@ void Main::save(
); );
// Delegate save actions to children components // Delegate save actions to children components
mainTab->save( mainTab->session_save(
APP_BROWSER_MAIN__SESSION__ID APP_BROWSER_MAIN__SESSION__ID
); );
}; };

4
src/app/browser/main.hpp

@ -95,11 +95,11 @@ namespace app::browser
void tab_page_navigation_history_back(); void tab_page_navigation_history_back();
void tab_page_navigation_history_forward(); void tab_page_navigation_history_forward();
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
void save( void session_save(
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
); );

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

@ -40,7 +40,7 @@ Tab::Tab(
); );
} }
int Tab::restore( int Tab::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -76,7 +76,7 @@ int Tab::restore(
// Restore children components // Restore children components
get_tabLabel( get_tabLabel(
PAGE_NUMBER PAGE_NUMBER
)->restore( )->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -85,7 +85,7 @@ int Tab::restore(
get_tabPage( get_tabPage(
PAGE_NUMBER PAGE_NUMBER
)->restore( )->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -99,7 +99,7 @@ int Tab::restore(
); );
} }
void Tab::save( void Tab::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
) { ) {
char * error; // @TODO char * error; // @TODO
@ -124,13 +124,13 @@ void Tab::save(
// Delegate save actions to children components // Delegate save actions to children components
get_tabLabel( get_tabLabel(
page_number page_number
)->save( )->session_save(
APP_BROWSER_MAIN_TAB__SESSION__ID APP_BROWSER_MAIN_TAB__SESSION__ID
); );
get_tabPage( get_tabPage(
page_number page_number
)->save( )->session_save(
APP_BROWSER_MAIN_TAB__SESSION__ID APP_BROWSER_MAIN_TAB__SESSION__ID
); );
} }

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

@ -123,11 +123,11 @@ namespace app::browser::main
const int & PAGE_NUMBER const int & PAGE_NUMBER
); );
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
void save( void session_save(
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
); );

4
src/app/browser/main/tab/label.cpp

@ -44,7 +44,7 @@ Label::Label(
} }
// Actions // Actions
int Label::restore( int Label::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
sqlite3_stmt * statement; sqlite3_stmt * statement;
@ -89,7 +89,7 @@ int Label::restore(
); );
} }
int Label::save( int Label::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
// Delegate save action to child components (on available) // Delegate save action to child components (on available)

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

@ -72,11 +72,11 @@ namespace app::browser::main::tab
); );
// Actions // Actions
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
int save( int session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
}; };

8
src/app/browser/main/tab/page.cpp

@ -90,7 +90,7 @@ Page::Page(
} }
// Actions // Actions
int Page::restore( int Page::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -145,7 +145,7 @@ int Page::restore(
); );
// Restore children components // Restore children components
pageNavigation->restore( pageNavigation->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -159,11 +159,11 @@ int Page::restore(
); );
} }
void Page::save( void Page::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
// Delegate save action to child components // Delegate save action to child components
pageNavigation->save( pageNavigation->session_save(
DB::SESSION::add( DB::SESSION::add(
db, db,
APP_BROWSER_MAIN_TAB__SESSION__ID, APP_BROWSER_MAIN_TAB__SESSION__ID,

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

@ -121,11 +121,11 @@ namespace app::browser::main::tab
); );
// Actions // Actions
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
void save( void session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
); );

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

@ -109,7 +109,7 @@ void Navigation::update(
); );
} }
int Navigation::restore( int Navigation::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -136,14 +136,14 @@ int Navigation::restore(
while (sqlite3_step(statement) == SQLITE_ROW) while (sqlite3_step(statement) == SQLITE_ROW)
{ {
// Restore children components // Restore children components
navigationHistory->restore( navigationHistory->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
) )
); );
navigationRequest->restore( navigationRequest->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID DB::SESSION::ID
@ -157,7 +157,7 @@ int Navigation::restore(
); );
} }
void Navigation::save( void Navigation::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {
// Delete previous session // Delete previous session
@ -173,11 +173,11 @@ void Navigation::save(
); );
// Delegate save action to children components // Delegate save action to children components
navigationHistory->save( navigationHistory->session_save(
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
navigationRequest->save( navigationRequest->session_save(
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
} }

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

@ -94,11 +94,11 @@ namespace app::browser::main::tab::page
const double & PROGRESS_FRACTION const double & PROGRESS_FRACTION
); );
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
void save( void session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
); );

4
src/app/browser/main/tab/page/navigation/history.cpp

@ -56,7 +56,7 @@ void History::add(
} }
} }
int History::restore( int History::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -124,7 +124,7 @@ int History::restore(
); );
} }
void History::save( void History::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
// Delete previous records for session // Delete previous records for session

4
src/app/browser/main/tab/page/navigation/history.hpp

@ -102,11 +102,11 @@ namespace app::browser::main::tab::page::navigation
const bool & UPDATE_MEMORY_INDEX const bool & UPDATE_MEMORY_INDEX
); );
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
void save( void session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );

4
src/app/browser/main/tab/page/navigation/request.cpp

@ -89,7 +89,7 @@ void Request::update(
); );
} }
int Request::restore( int Request::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the DB model namespace
@ -134,7 +134,7 @@ int Request::restore(
); );
} }
int Request::save( int Request::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
// Delete previous records // Delete previous records

4
src/app/browser/main/tab/page/navigation/request.hpp

@ -89,11 +89,11 @@ namespace app::browser::main::tab::page::navigation
const double & PROGRESS_FRACTION const double & PROGRESS_FRACTION
); );
int restore( int session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); // return sqlite3_finalize status code ); // return sqlite3_finalize status code
int save( int session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
}; };

Loading…
Cancel
Save