mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-08-03 12:46:29 -04:00
Merge pull request #1138 from kiwix/feature/home-button
Added home button
This commit is contained in:
commit
3a7c9c5d0d
17
resources/icons/home-button.svg
Normal file
17
resources/icons/home-button.svg
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<svg fill="#444444" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="800px" height="800px" viewBox="0 0 448.512 448.512"
|
||||
xml:space="preserve">
|
||||
<title>icon / home-button</title>
|
||||
<g>
|
||||
<path d="M444.277,215.253L242.72,52.441l-11.186-9.289c-4.22-3.506-10.34-3.506-14.559,0l-58.162,48.301V71.031
|
||||
c0-6.294-5.104-11.397-11.396-11.397h-43.449c-6.293,0-11.396,5.104-11.396,11.397v75.233L4.191,218.371
|
||||
c-4.875,3.979-5.605,11.157-1.625,16.035c2.254,2.764,5.531,4.193,8.836,4.193c2.533,0,5.082-0.841,7.203-2.565l34.477-28.126
|
||||
v188.684c0,6.294,5.102,11.397,11.396,11.397h121.789c6.295,0,11.398-5.104,11.398-11.397v-88.426h53.18v88.426
|
||||
c0,6.294,5.104,11.397,11.398,11.397h121.789c6.295,0,11.397-5.104,11.397-11.397V205.101l34.521,27.884
|
||||
c2.108,1.702,4.643,2.532,7.158,2.532c3.321,0,6.622-1.447,8.87-4.235C449.937,226.384,449.173,219.208,444.277,215.253z
|
||||
M115.366,82.428h20.652v27.164l-20.652,16.716V82.428z M372.636,189.958v195.235h-98.994v-88.427
|
||||
c0-6.294-5.104-11.396-11.397-11.396h-75.977c-6.295,0-11.396,5.104-11.396,11.396v88.427H75.877V189.958l44.309-36.798
|
||||
c0,0,103.748-85.009,104.41-86.141L372.636,189.958z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
@ -1 +1,9 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>icon / random</title><g fill="none" fill-rule="evenodd"><path d="M8.824 9.386l-.957 1.207L5.61 7.75H3a.75.75 0 0 1 0-1.5h2.973a.75.75 0 0 1 .587.284l2.264 2.852zm3.192 4.021l2.256 2.843H18a.75.75 0 1 1 0 1.5h-4.09a.75.75 0 0 1-.587-.284l-2.264-2.852.957-1.207z" fill="#000" fill-rule="nonzero"/><path stroke="#000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M3 17h2.973L13.91 7H18"/><path fill="#000" d="M22 17l-5 3v-6zM22 7l-5 3V4z"/></g></svg>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<title>icon / random</title>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path d="M8.824 9.386l-.957 1.207L5.61 7.75H3a.75.75 0 0 1 0-1.5h2.973a.75.75 0 0 1 .587.284l2.264 2.852zm3.192 4.021l2.256 2.843H18a.75.75 0 1 1 0 1.5h-4.09a.75.75 0 0 1-.587-.284l-2.264-2.852.957-1.207z" fill="#444444" fill-rule="nonzero"/>
|
||||
<path stroke="#444444" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" d="M3 17h2.973L13.91 7H18"/>
|
||||
<path fill="#444444" d="M22 17l-5 3v-6zM22 7l-5 3V4z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 587 B |
@ -63,5 +63,6 @@
|
||||
<file>icons/kiwix-logo.svg</file>
|
||||
<file>icons/check-solid.svg</file>
|
||||
<file>icons/xmark-solid.svg</file>
|
||||
<file>icons/home-button.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -388,7 +388,7 @@ void KiwixApp::createActions()
|
||||
connect(mpa_actions[RandomArticleAction], &QAction::triggered,
|
||||
this, [=]() { this->openRandomUrl(false); });
|
||||
|
||||
CREATE_ACTION_SHORTCUT(OpenHomePageAction, gt("home-page"), QKeySequence(Qt::ALT | Qt::Key_Home));
|
||||
CREATE_ACTION_ICON_SHORTCUT(OpenHomePageAction, "home-button", gt("home-page"), QKeySequence(Qt::ALT | Qt::Key_Home));
|
||||
|
||||
if (QGuiApplication::isLeftToRight()) {
|
||||
CREATE_ACTION_ICON_SHORTCUT(HistoryBackAction, "history-left", gt("back"), QKeySequence(Qt::ALT | Qt::Key_Left));
|
||||
@ -504,17 +504,19 @@ void KiwixApp::handleItemsState(TabType tabType)
|
||||
{
|
||||
auto libraryOrSettingsTab = (tabType == TabType::LibraryTab || tabType == TabType::SettingsTab);
|
||||
auto notBookmarkableTab = libraryOrSettingsTab || getTabWidget()->currentArticleUrl().isEmpty();
|
||||
KiwixApp::instance()->getAction(KiwixApp::ToggleReadingListAction)->setDisabled(libraryOrSettingsTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::ToggleAddBookmarkAction)->setDisabled(notBookmarkableTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::FindInPageAction)->setDisabled(libraryOrSettingsTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::ZoomInAction)->setDisabled(libraryOrSettingsTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::ZoomOutAction)->setDisabled(libraryOrSettingsTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::ZoomResetAction)->setDisabled(libraryOrSettingsTab);
|
||||
KiwixApp::instance()->getAction(KiwixApp::RandomArticleAction)->setDisabled(libraryOrSettingsTab);
|
||||
auto app = KiwixApp::instance();
|
||||
app->getAction(KiwixApp::ToggleReadingListAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::ToggleAddBookmarkAction)->setDisabled(notBookmarkableTab);
|
||||
app->getAction(KiwixApp::FindInPageAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::ZoomInAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::ZoomOutAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::ZoomResetAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::RandomArticleAction)->setDisabled(libraryOrSettingsTab);
|
||||
app->getAction(KiwixApp::OpenHomePageAction)->setDisabled(libraryOrSettingsTab);
|
||||
|
||||
/* Non-Zim tabs are not bookmarkable therefore never in reading list. */
|
||||
if (notBookmarkableTab)
|
||||
KiwixApp::instance()->getAction(KiwixApp::ToggleAddBookmarkAction)->setChecked(false);
|
||||
app->getAction(KiwixApp::ToggleAddBookmarkAction)->setChecked(false);
|
||||
}
|
||||
|
||||
void KiwixApp::updateNameMapper()
|
||||
|
@ -41,11 +41,7 @@ TabBar::TabBar(QWidget *parent) :
|
||||
this->closeTab(currentIndex());
|
||||
});
|
||||
connect(getAction(KiwixApp::OpenHomePageAction), &QAction::triggered,
|
||||
this, [=]() {
|
||||
auto current = this->currentWebView();
|
||||
QUITIFNULL(current);
|
||||
current->setUrl("zim://" + current->zimId() + ".zim/");
|
||||
});
|
||||
this, &TabBar::openHomePage);
|
||||
connect(getAction(KiwixApp::SettingAction), &QAction::triggered,
|
||||
this, &TabBar::openOrSwitchToSettingsTab);
|
||||
|
||||
@ -66,6 +62,12 @@ TabBar::TabBar(QWidget *parent) :
|
||||
this, SLOT(onTabMoved(int,int)), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
void TabBar::openHomePage() {
|
||||
auto current = this->currentWebView();
|
||||
QUITIFNULL(current);
|
||||
current->setUrl("zim://" + current->zimId() + ".zim/");
|
||||
}
|
||||
|
||||
void TabBar::openOrSwitchToSettingsTab()
|
||||
{
|
||||
SettingsView* view = KiwixApp::instance()->getSettingsManager()->getView();
|
||||
|
@ -62,6 +62,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void closeTab(int index);
|
||||
void openHomePage();
|
||||
void openOrSwitchToSettingsTab();
|
||||
void fullScreenRequested(QWebEngineFullScreenRequest request);
|
||||
void on_webview_titleChanged(const QString& title);
|
||||
|
@ -16,14 +16,14 @@ TopWidget::TopWidget(QWidget *parent) :
|
||||
auto app = KiwixApp::instance();
|
||||
|
||||
QAction *back = app->getAction(KiwixApp::HistoryBackAction);
|
||||
connect(back, &QAction::triggered, [](){
|
||||
KiwixApp::instance()->getTabWidget()->triggerWebPageAction(QWebEnginePage::Back);
|
||||
connect(back, &QAction::triggered, [app](){
|
||||
app->getTabWidget()->triggerWebPageAction(QWebEnginePage::Back);
|
||||
});
|
||||
addAction(back);
|
||||
|
||||
QAction *forward = app->getAction(KiwixApp::HistoryForwardAction);
|
||||
connect(forward, &QAction::triggered, [](){
|
||||
KiwixApp::instance()->getTabWidget()->triggerWebPageAction(QWebEnginePage::Forward);
|
||||
connect(forward, &QAction::triggered, [app](){
|
||||
app->getTabWidget()->triggerWebPageAction(QWebEnginePage::Forward);
|
||||
});
|
||||
addAction(forward);
|
||||
|
||||
@ -41,12 +41,15 @@ TopWidget::TopWidget(QWidget *parent) :
|
||||
|
||||
addSeparator();
|
||||
|
||||
addAction(app->getAction(KiwixApp::OpenHomePageAction));
|
||||
|
||||
addWidget(&m_searchEntry);
|
||||
addAction(KiwixApp::instance()->getAction(KiwixApp::ToggleReadingListAction));
|
||||
|
||||
addAction(app->getAction(KiwixApp::ToggleReadingListAction));
|
||||
|
||||
addSeparator();
|
||||
|
||||
addAction(KiwixApp::instance()->getAction(KiwixApp::OpenFileAction));
|
||||
addAction(app->getAction(KiwixApp::OpenFileAction));
|
||||
|
||||
QMenu* menu = new MainMenu();
|
||||
QToolButton *toolButton = new QToolButton(menu);
|
||||
@ -61,8 +64,8 @@ TopWidget::TopWidget(QWidget *parent) :
|
||||
#if !SYSTEMTITLEBAR
|
||||
addAction(QIcon(":/icons/minimize.svg"), "minimize", parent, SLOT(showMinimized()));
|
||||
#endif
|
||||
addAction(KiwixApp::instance()->getAction(KiwixApp::ToggleFullscreenAction));
|
||||
widgetForAction(KiwixApp::instance()->getAction(KiwixApp::ToggleFullscreenAction))->setObjectName("fullScreenButton");
|
||||
addAction(app->getAction(KiwixApp::ToggleFullscreenAction));
|
||||
widgetForAction(app->getAction(KiwixApp::ToggleFullscreenAction))->setObjectName("fullScreenButton");
|
||||
#if !SYSTEMTITLEBAR
|
||||
addAction(QIcon(":/icons/close.svg"), "close", parent, SLOT(close()));
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user