diff --git a/src/Entity/Browser.php b/src/Entity/Browser.php index b352a7e6..52ada2ad 100644 --- a/src/Entity/Browser.php +++ b/src/Entity/Browser.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity; +use \GtkWindow; + use \Yggverse\Yoda\Entity\Browser\Header; use \Yggverse\Yoda\Entity\Browser\Container; @@ -11,7 +13,8 @@ use \Yggverse\Yoda\Model\Database; class Browser { - public \GtkWindow $gtk; + // GTK + public GtkWindow $gtk; // Dependencies public Database $database; @@ -32,7 +35,7 @@ class Browser $this->database = $database; // Init window - $this->gtk = new \GtkWindow; + $this->gtk = new GtkWindow; $this->gtk->set_size_request( $this::WIDTH, @@ -69,8 +72,8 @@ class Browser $this->gtk->connect( 'configure-event', function( - \GtkWindow $window, - // \GdkEvent $event + GtkWindow $window, + // GdkEvent $event ) { // @TODO render data wordwrap by $window->get_size() } diff --git a/src/Entity/Browser/Container.php b/src/Entity/Browser/Container.php index c057cdb9..dce8fbc0 100644 --- a/src/Entity/Browser/Container.php +++ b/src/Entity/Browser/Container.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser; class Container { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public Browser $browser; @@ -23,8 +27,8 @@ class Container $this->browser = $browser; // Init container - $this->gtk = new \GtkBox( - \GtkOrientation::VERTICAL + $this->gtk = new GtkBox( + GtkOrientation::VERTICAL ); // Init tab diff --git a/src/Entity/Browser/Header.php b/src/Entity/Browser/Header.php index 80272a52..8115bea6 100644 --- a/src/Entity/Browser/Header.php +++ b/src/Entity/Browser/Header.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; +use \GtkHeaderBar; + use \Yggverse\Yoda\Entity\Browser; class Header { - public \GtkHeaderBar $gtk; + // GTK + public GtkHeaderBar $gtk; // Dependencies public Browser $browser; @@ -28,7 +31,7 @@ class Header $this->browser = $browser; // Init header - $this->gtk = new \GtkHeaderBar; + $this->gtk = new GtkHeaderBar; $this->gtk->set_show_close_button( $this::ACTIONS diff --git a/src/Entity/Browser/History.php b/src/Entity/Browser/History.php index d65c66b7..c1ba2e46 100644 --- a/src/Entity/Browser/History.php +++ b/src/Entity/Browser/History.php @@ -4,10 +4,13 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; +use \GtkWindow; + use \Yggverse\Yoda\Entity\Browser; class History { + // GTK public \GtkWindow $gtk; // Dependencies @@ -29,7 +32,7 @@ class History $this->browser = $browser; // Init window - $this->gtk = new \GtkWindow; + $this->gtk = new GtkWindow; $this->gtk->set_size_request( $this::WIDTH, diff --git a/src/Entity/Browser/History/Container.php b/src/Entity/Browser/History/Container.php index 80a15083..8f679d08 100644 --- a/src/Entity/Browser/History/Container.php +++ b/src/Entity/Browser/History/Container.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\History; class Container { - public \GtkBox $gtk; + // GTK + public GtkBox $gtk; // Dependencies public History $history; @@ -24,8 +28,8 @@ class Container $this->history = $history; // Init container - $this->gtk = new \GtkBox( - \GtkOrientation::VERTICAL + $this->gtk = new GtkBox( + GtkOrientation::VERTICAL ); // Init navbar diff --git a/src/Entity/Browser/History/Container/Content.php b/src/Entity/Browser/History/Container/Content.php index 7876d9b0..12b68d28 100644 --- a/src/Entity/Browser/History/Container/Content.php +++ b/src/Entity/Browser/History/Container/Content.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container; +use \GtkScrolledWindow; + use \Yggverse\Yoda\Entity\Browser\History\Container; class Content { - public \GtkScrolledWindow $gtk; + // GTK + public GtkScrolledWindow $gtk; // Dependencies public Container $container; @@ -27,7 +30,7 @@ class Content $this->container = $container; // Init container - $this->gtk = new \GtkScrolledWindow; + $this->gtk = new GtkScrolledWindow; $this->gtk->set_margin_start( $this::MARGIN diff --git a/src/Entity/Browser/History/Container/Content/Table.php b/src/Entity/Browser/History/Container/Content/Table.php index ead6a378..e71a113c 100644 --- a/src/Entity/Browser/History/Container/Content/Table.php +++ b/src/Entity/Browser/History/Container/Content/Table.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Content; +use \GtkCellRendererText; +use \GtkTreeView; +use \GtkTreeViewColumn; + use \Yggverse\Yoda\Entity\Browser\History\Container\Content; class Table { - public \GtkTreeView $gtk; + public GtkTreeView $gtk; // Dependencies public Content $content; @@ -28,30 +32,30 @@ class Table $this->content = $content; // Init tree view - $this->gtk = new \GtkTreeView; + $this->gtk = new GtkTreeView; $this->gtk->append_column( - new \GtkTreeViewColumn( + new GtkTreeViewColumn( $this::TIME, - new \GtkCellRendererText(), + new GtkCellRendererText(), 'text', 1 ) ); $this->gtk->append_column( - new \GtkTreeViewColumn( + new GtkTreeViewColumn( $this::URL, - new \GtkCellRendererText(), + new GtkCellRendererText(), 'text', 2 ) ); $this->gtk->append_column( - new \GtkTreeViewColumn( + new GtkTreeViewColumn( $this::TITLE, - new \GtkCellRendererText(), + new GtkCellRendererText(), 'text', 3 ) diff --git a/src/Entity/Browser/History/Container/Content/Table/Data.php b/src/Entity/Browser/History/Container/Content/Table/Data.php index b33a327a..6ef918cc 100644 --- a/src/Entity/Browser/History/Container/Content/Table/Data.php +++ b/src/Entity/Browser/History/Container/Content/Table/Data.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Content\Table; +use \GObject; +use \GtkListStore; + use \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table; class Data { - public \GtkListStore $gtk; + public GtkListStore $gtk; // Dependencies public Table $table; @@ -23,11 +26,11 @@ class Data $this->table = $table; // Init tree view - $this->gtk = new \GtkListStore( - \GObject::TYPE_INT, - \GObject::TYPE_STRING, - \GObject::TYPE_STRING, - \GObject::TYPE_STRING + $this->gtk = new GtkListStore( + GObject::TYPE_INT, + GObject::TYPE_STRING, + GObject::TYPE_STRING, + GObject::TYPE_STRING ); } diff --git a/src/Entity/Browser/History/Container/Content/Viewport.php b/src/Entity/Browser/History/Container/Content/Viewport.php index 34a43b6e..42b5d0c6 100644 --- a/src/Entity/Browser/History/Container/Content/Viewport.php +++ b/src/Entity/Browser/History/Container/Content/Viewport.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Content; +use \GtkViewport; + use \Yggverse\Yoda\Entity\Browser\History\Container\Content; class Viewport { - public \GtkViewport $gtk; + // GTK + public GtkViewport $gtk; // Dependencies public Content $content; @@ -20,7 +23,7 @@ class Viewport $this->content = $content; // Init viewport - $this->gtk = new \GtkViewport; + $this->gtk = new GtkViewport; // Render $this->gtk->show(); diff --git a/src/Entity/Browser/History/Container/Navbar.php b/src/Entity/Browser/History/Container/Navbar.php index 4abf95c8..b2c410e9 100644 --- a/src/Entity/Browser/History/Container/Navbar.php +++ b/src/Entity/Browser/History/Container/Navbar.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container; +use \GtkBox; +use \GtkOrientation; + use \Yggverse\Yoda\Entity\Browser\History\Container; class Navbar { - public \GtkBox $gtk; + public GtkBox $gtk; // Dependencies public Container $container; @@ -30,8 +33,8 @@ class Navbar $this->container = $container; // Init container - $this->gtk = new \GtkBox( - \GtkOrientation::HORIZONTAL + $this->gtk = new GtkBox( + GtkOrientation::HORIZONTAL ); $this->gtk->set_margin_top( diff --git a/src/Entity/Browser/History/Container/Navbar/Delete.php b/src/Entity/Browser/History/Container/Navbar/Delete.php index 367b3401..d51b0dc5 100644 --- a/src/Entity/Browser/History/Container/Navbar/Delete.php +++ b/src/Entity/Browser/History/Container/Navbar/Delete.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Navbar; +use \GtkButton; + use \Yggverse\Yoda\Abstract\Entity\Browser\History\Container\Navbar\Button; class Delete extends Button @@ -13,7 +15,7 @@ class Delete extends Button public const TOOLTIP = 'Delete'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { if ($id = $this->navbar->container->content->table->getSelectedId()) diff --git a/src/Entity/Browser/History/Container/Navbar/Filter.php b/src/Entity/Browser/History/Container/Navbar/Filter.php index 05a598e8..ae6a4c24 100644 --- a/src/Entity/Browser/History/Container/Navbar/Filter.php +++ b/src/Entity/Browser/History/Container/Navbar/Filter.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Navbar; +use \GdkEvent; +use \GtkEntry; + use \Yggverse\Yoda\Abstract\Entity\Browser\History\Container\Navbar\Entry; class Filter extends Entry @@ -11,7 +14,7 @@ class Filter extends Entry public const PLACEHOLDER = 'Search in history...'; protected function _onActivate( - \GtkEntry $entry + GtkEntry $entry ): void { $this->navbar->container->content->search( @@ -20,8 +23,8 @@ class Filter extends Entry } protected function _onKeyRelease( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void { $this->navbar->container->content->search( @@ -30,13 +33,13 @@ class Filter extends Entry } protected function _onChanged( - \GtkEntry $entry + GtkEntry $entry ): void {} protected function _onFocusOut( - \GtkEntry $entry, - \GdkEvent $event + GtkEntry $entry, + GdkEvent $event ): void {} } \ No newline at end of file diff --git a/src/Entity/Browser/History/Container/Navbar/Open.php b/src/Entity/Browser/History/Container/Navbar/Open.php index 23fdb39b..d701c2f1 100644 --- a/src/Entity/Browser/History/Container/Navbar/Open.php +++ b/src/Entity/Browser/History/Container/Navbar/Open.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History\Container\Navbar; +use \GtkButton; + use \Yggverse\Yoda\Abstract\Entity\Browser\History\Container\Navbar\Button; class Open extends Button @@ -13,7 +15,7 @@ class Open extends Button public const TOOLTIP = 'Open'; protected function _onCLick( - \GtkButton $entity + GtkButton $entity ): void { $this->navbar->container->history->browser->container->tab->append( diff --git a/src/Entity/Browser/History/Header.php b/src/Entity/Browser/History/Header.php index edf7c0b8..9538fc8a 100644 --- a/src/Entity/Browser/History/Header.php +++ b/src/Entity/Browser/History/Header.php @@ -4,9 +4,11 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\History; +use \GtkHeaderBar; + class Header { - public \GtkHeaderBar $gtk; + public GtkHeaderBar $gtk; public const ACTIONS = true; public const TITLE = 'History - Yoda'; @@ -14,7 +16,7 @@ class Header public function __construct() { - $this->gtk = new \GtkHeaderBar; + $this->gtk = new GtkHeaderBar; $this->gtk->set_show_close_button( $this::ACTIONS diff --git a/src/Entity/Browser/Menu.php b/src/Entity/Browser/Menu.php index 8c192a52..fb729aa1 100644 --- a/src/Entity/Browser/Menu.php +++ b/src/Entity/Browser/Menu.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; +use \GtkMenu; +use \GtkSeparatorMenuItem; + use \Yggverse\Yoda\Entity\Browser; class Menu { - public \GtkMenu $gtk; + public GtkMenu $gtk; // Dependencies public Browser $browser; @@ -26,7 +29,7 @@ class Menu $this->browser = $browser; // Init menu - $this->gtk = new \GtkMenu; + $this->gtk = new GtkMenu; // Init file menu item $this->file = new Menu\File( @@ -57,7 +60,7 @@ class Menu // Add separator $this->gtk->append( - new \GtkSeparatorMenuItem + new GtkSeparatorMenuItem ); // Init quit menu item diff --git a/src/Entity/Browser/Menu/File.php b/src/Entity/Browser/Menu/File.php index fe77eb8b..22c81ef9 100644 --- a/src/Entity/Browser/Menu/File.php +++ b/src/Entity/Browser/Menu/File.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu; +use \GtkMenu; +use \GtkMenuItem; + use \Yggverse\Yoda\Entity\Browser\Menu; class File { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public Menu $menu; @@ -23,12 +27,12 @@ class File $this->menu = $menu; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); // Init submenu container - $file = new \GtkMenu; + $file = new GtkMenu; // Init tab menu items $open = new File\Open( diff --git a/src/Entity/Browser/Menu/File/Open.php b/src/Entity/Browser/Menu/File/Open.php index 21e10dc5..0116d330 100644 --- a/src/Entity/Browser/Menu/File/Open.php +++ b/src/Entity/Browser/Menu/File/Open.php @@ -4,11 +4,18 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu\File; +use \GtkFileChooserAction; +use \GtkFileChooserDialog; +use \GtkFileFilter; +use \GtkMenuItem; +use \GtkResponseType; + use \Yggverse\Yoda\Entity\Browser\Menu\File; class Open { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public File $file; @@ -29,7 +36,7 @@ class Open $this->file = $file; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); @@ -41,15 +48,15 @@ class Open 'activate', function() { - $dialog = new \GtkFileChooserDialog( + $dialog = new GtkFileChooserDialog( 'Open file', $this->file->menu->browser->gtk, - \GtkFileChooserAction::OPEN, + GtkFileChooserAction::OPEN, [ 'Cancel', - \GtkResponseType::CANCEL, + GtkResponseType::CANCEL, 'Open', - \GtkResponseType::OK + GtkResponseType::OK ] ); @@ -66,7 +73,7 @@ class Open foreach ($this::PATTERN as $pattern => $name) { - $filter = new \GtkFileFilter; + $filter = new GtkFileFilter; $filter->set_name( $name ? $name : $pattern @@ -81,7 +88,7 @@ class Open ); } - if (\GtkResponseType::OK == $dialog->run()) + if (GtkResponseType::OK == $dialog->run()) { foreach ($dialog->get_filenames() as $filename) { diff --git a/src/Entity/Browser/Menu/File/Save.php b/src/Entity/Browser/Menu/File/Save.php index 9203adeb..e9bf360e 100644 --- a/src/Entity/Browser/Menu/File/Save.php +++ b/src/Entity/Browser/Menu/File/Save.php @@ -4,11 +4,17 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu\File; +use \GtkMenuItem; +use \GtkFileChooserDialog; +use \GtkFileChooserAction; +use \GtkResponseType; + use \Yggverse\Yoda\Entity\Browser\Menu\File; class Save { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public File $file; @@ -23,7 +29,7 @@ class Save $this->file = $file; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); @@ -35,15 +41,15 @@ class Save 'activate', function() { - $dialog = new \GtkFileChooserDialog( + $dialog = new GtkFileChooserDialog( 'Save to file', $this->file->menu->browser->gtk, - \GtkFileChooserAction::SAVE, + GtkFileChooserAction::SAVE, [ 'Cancel', - \GtkResponseType::CANCEL, + GtkResponseType::CANCEL, 'Save', - \GtkResponseType::APPLY + GtkResponseType::APPLY ] ); @@ -58,7 +64,7 @@ class Save true ); - if (\GtkResponseType::APPLY == $dialog->run()) + if (GtkResponseType::APPLY == $dialog->run()) { if ($page = $this->file->menu->browser->container->tab->get()) { diff --git a/src/Entity/Browser/Menu/History.php b/src/Entity/Browser/Menu/History.php index a4cd662f..956ce396 100644 --- a/src/Entity/Browser/Menu/History.php +++ b/src/Entity/Browser/Menu/History.php @@ -4,11 +4,16 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu; +use \GtkMenuItem; + use \Yggverse\Yoda\Entity\Browser\Menu; +use \Yggverse\Yoda\Entity\Browser\History as Window; + class History { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public Menu $menu; @@ -23,7 +28,7 @@ class History $this->menu = $menu; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); @@ -35,7 +40,7 @@ class History 'activate', function() { - $history = new \Yggverse\Yoda\Entity\Browser\History( + $history = new Window( $this->menu->browser ); } diff --git a/src/Entity/Browser/Menu/Quit.php b/src/Entity/Browser/Menu/Quit.php index df2f733f..509c81f9 100644 --- a/src/Entity/Browser/Menu/Quit.php +++ b/src/Entity/Browser/Menu/Quit.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu; +use \Gtk; +use \GtkMenuItem; + use \Yggverse\Yoda\Entity\Browser\Menu; class Quit { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public Menu $menu; @@ -23,7 +27,7 @@ class Quit $this->menu = $menu; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); @@ -35,7 +39,7 @@ class Quit 'activate', function() { - \Gtk::main_quit(); + Gtk::main_quit(); } ); } diff --git a/src/Entity/Browser/Menu/Tab.php b/src/Entity/Browser/Menu/Tab.php index 47436ea5..e1b7d0dd 100644 --- a/src/Entity/Browser/Menu/Tab.php +++ b/src/Entity/Browser/Menu/Tab.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu; +use \GtkMenu; +use \GtkMenuItem; + use \Yggverse\Yoda\Entity\Browser\Menu; class Tab { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public Menu $menu; @@ -27,12 +31,12 @@ class Tab $this->menu = $menu; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( $this::LABEL ); // Init submenu container - $tab = new \GtkMenu; + $tab = new GtkMenu; // Init new tab menu item $this->add = new Tab\Add( diff --git a/src/Entity/Browser/Menu/Tab/Add.php b/src/Entity/Browser/Menu/Tab/Add.php index cd1624a4..042ef0f0 100644 --- a/src/Entity/Browser/Menu/Tab/Add.php +++ b/src/Entity/Browser/Menu/Tab/Add.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser\Menu\Tab; +use \GtkMenuItem; + use \Yggverse\Yoda\Entity\Browser\Menu\Tab; class Add { - public \GtkMenuItem $gtk; + // GTK + public GtkMenuItem $gtk; // Dependencies public Tab $tab; @@ -24,7 +27,7 @@ class Add $this->tab = $tab; // Init menu item - $this->gtk = \GtkMenuItem::new_with_label( + $this->gtk = GtkMenuItem::new_with_label( _($this::LABEL) );