mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
rename tab elements namespace
This commit is contained in:
parent
4e733d8997
commit
2986a475c1
29 changed files with 181 additions and 181 deletions
20
src/app/browser/main/tab/page/navbar/base.cpp
Normal file
20
src/app/browser/main/tab/page/navbar/base.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "base.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar;
|
||||
|
||||
Base::Base()
|
||||
{
|
||||
set_action_name(
|
||||
"tab.base"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
"go-home-symbolic"
|
||||
);
|
||||
|
||||
set_tooltip_text(
|
||||
_("Base")
|
||||
);
|
||||
}
|
||||
|
||||
Base::~Base() = default;
|
||||
19
src/app/browser/main/tab/page/navbar/base.hpp
Normal file
19
src/app/browser/main/tab/page/navbar/base.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar
|
||||
{
|
||||
class Base : public Gtk::Button
|
||||
{
|
||||
public:
|
||||
|
||||
Base();
|
||||
|
||||
~Base();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BASE_HPP
|
||||
20
src/app/browser/main/tab/page/navbar/bookmark.cpp
Normal file
20
src/app/browser/main/tab/page/navbar/bookmark.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "bookmark.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar;
|
||||
|
||||
Bookmark::Bookmark()
|
||||
{
|
||||
set_action_name(
|
||||
"tab.bookmark"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
"starred-symbolic" // | non-starred-symbolic
|
||||
);
|
||||
|
||||
set_tooltip_text(
|
||||
_("Toggle bookmark")
|
||||
);
|
||||
}
|
||||
|
||||
Bookmark::~Bookmark() = default;
|
||||
19
src/app/browser/main/tab/page/navbar/bookmark.hpp
Normal file
19
src/app/browser/main/tab/page/navbar/bookmark.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar
|
||||
{
|
||||
class Bookmark : public Gtk::Button
|
||||
{
|
||||
public:
|
||||
|
||||
Bookmark();
|
||||
|
||||
~Bookmark();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_BOOKMARK_HPP
|
||||
26
src/app/browser/main/tab/page/navbar/history.cpp
Normal file
26
src/app/browser/main/tab/page/navbar/history.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "history.hpp"
|
||||
#include "history/back.hpp"
|
||||
#include "history/forward.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar;
|
||||
|
||||
History::History()
|
||||
{
|
||||
add_css_class(
|
||||
"linked" // merge children elements
|
||||
);
|
||||
|
||||
back = new history::Back();
|
||||
|
||||
append(
|
||||
* back
|
||||
);
|
||||
|
||||
forward = new history::Forward();
|
||||
|
||||
append(
|
||||
* forward
|
||||
);
|
||||
}
|
||||
|
||||
History::~History() = default;
|
||||
30
src/app/browser/main/tab/page/navbar/history.hpp
Normal file
30
src/app/browser/main/tab/page/navbar/history.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar
|
||||
{
|
||||
namespace history
|
||||
{
|
||||
class Back;
|
||||
class Forward;
|
||||
}
|
||||
|
||||
class History : public Gtk::Box
|
||||
{
|
||||
private:
|
||||
|
||||
history::Back * back;
|
||||
history::Forward * forward;
|
||||
|
||||
public:
|
||||
|
||||
History();
|
||||
|
||||
~History();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_HPP
|
||||
20
src/app/browser/main/tab/page/navbar/history/back.cpp
Normal file
20
src/app/browser/main/tab/page/navbar/history/back.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "back.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar::history;
|
||||
|
||||
Back::Back()
|
||||
{
|
||||
set_action_name(
|
||||
"tab.back"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
"go-previous-symbolic"
|
||||
);
|
||||
|
||||
set_tooltip_text(
|
||||
_("Back")
|
||||
);
|
||||
}
|
||||
|
||||
Back::~Back() = default;
|
||||
19
src/app/browser/main/tab/page/navbar/history/back.hpp
Normal file
19
src/app/browser/main/tab/page/navbar/history/back.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar::history
|
||||
{
|
||||
class Back : public Gtk::Button
|
||||
{
|
||||
public:
|
||||
|
||||
Back();
|
||||
|
||||
~Back();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_BACK_HPP
|
||||
20
src/app/browser/main/tab/page/navbar/history/forward.cpp
Normal file
20
src/app/browser/main/tab/page/navbar/history/forward.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "forward.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar::history;
|
||||
|
||||
Forward::Forward()
|
||||
{
|
||||
set_action_name(
|
||||
"tab.forward"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
"go-next-symbolic"
|
||||
);
|
||||
|
||||
set_tooltip_text(
|
||||
_("Forward")
|
||||
);
|
||||
}
|
||||
|
||||
Forward::~Forward() = default;
|
||||
19
src/app/browser/main/tab/page/navbar/history/forward.hpp
Normal file
19
src/app/browser/main/tab/page/navbar/history/forward.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar::history
|
||||
{
|
||||
class Forward : public Gtk::Button
|
||||
{
|
||||
public:
|
||||
|
||||
Forward();
|
||||
|
||||
~Forward();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HISTORY_FORWARD_HPP
|
||||
94
src/app/browser/main/tab/page/navbar/request.cpp
Normal file
94
src/app/browser/main/tab/page/navbar/request.cpp
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#include "request.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar;
|
||||
using namespace std;
|
||||
|
||||
// Construct
|
||||
Request::Request()
|
||||
{
|
||||
// Init entry
|
||||
set_placeholder_text(
|
||||
_("URL or search term...")
|
||||
);
|
||||
|
||||
set_hexpand(
|
||||
true
|
||||
);
|
||||
|
||||
// Connect events
|
||||
signal_changed().connect(
|
||||
[this]
|
||||
{
|
||||
parse();
|
||||
|
||||
activate_action(
|
||||
"navbar.refresh"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
signal_activate().connect(
|
||||
[this]
|
||||
{
|
||||
parse();
|
||||
|
||||
activate_action(
|
||||
"page.update"
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Request::~Request() = default;
|
||||
|
||||
// Getters
|
||||
string Request::get_scheme()
|
||||
{
|
||||
return scheme;
|
||||
}
|
||||
|
||||
string Request::get_host()
|
||||
{
|
||||
return host;
|
||||
}
|
||||
|
||||
string Request::get_path()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
string Request::get_query()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
int Request::get_port()
|
||||
{
|
||||
return stoi(
|
||||
port
|
||||
);
|
||||
}
|
||||
|
||||
// Private helpers
|
||||
void Request::parse()
|
||||
{
|
||||
string subject = get_text();
|
||||
|
||||
smatch results;
|
||||
|
||||
static const regex pattern( // @TODO user:password@#fragment?
|
||||
R"regex(^((\w+)?:\/\/)?([^:\/]+)?(:(\d+)?)?([^\?$]+)?(\?(.*)?)?)regex"
|
||||
);
|
||||
|
||||
regex_search(
|
||||
subject,
|
||||
results,
|
||||
pattern
|
||||
);
|
||||
|
||||
scheme = results[2];
|
||||
host = results[3];
|
||||
port = results[5];
|
||||
path = results[6];
|
||||
query = results[8];
|
||||
}
|
||||
39
src/app/browser/main/tab/page/navbar/request.hpp
Normal file
39
src/app/browser/main/tab/page/navbar/request.hpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_REQUEST_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_REQUEST_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/entry.h>
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar
|
||||
{
|
||||
class Request : public Gtk::Entry
|
||||
{
|
||||
private:
|
||||
|
||||
std::string scheme,
|
||||
host,
|
||||
port,
|
||||
path,
|
||||
query;
|
||||
|
||||
void parse();
|
||||
|
||||
public:
|
||||
|
||||
Request();
|
||||
|
||||
~Request();
|
||||
|
||||
std::string get_scheme();
|
||||
std::string get_host();
|
||||
std::string get_path();
|
||||
std::string get_query();
|
||||
|
||||
int get_port();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_REQUEST_HPP
|
||||
20
src/app/browser/main/tab/page/navbar/update.cpp
Normal file
20
src/app/browser/main/tab/page/navbar/update.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "update.hpp"
|
||||
|
||||
using namespace app::browser::main::tab::page::navbar;
|
||||
|
||||
Update::Update()
|
||||
{
|
||||
set_action_name(
|
||||
"page.update"
|
||||
);
|
||||
|
||||
set_icon_name(
|
||||
"view-refresh-symbolic"
|
||||
);
|
||||
|
||||
set_tooltip_text(
|
||||
_("Update")
|
||||
);
|
||||
}
|
||||
|
||||
Update::~Update() = default;
|
||||
19
src/app/browser/main/tab/page/navbar/update.hpp
Normal file
19
src/app/browser/main/tab/page/navbar/update.hpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP
|
||||
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
namespace app::browser::main::tab::page::navbar
|
||||
{
|
||||
class Update : public Gtk::Button
|
||||
{
|
||||
public:
|
||||
|
||||
Update();
|
||||
|
||||
~Update();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_UPDATE_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue