Commit d4a9825c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for fullscreen

parent 2e074c8d
Pipeline #154104 passed with stage
in 3 minutes and 9 seconds
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="akregator_part" version="431" translationDomain="akregator">
<gui name="akregator_part" version="432" translationDomain="akregator">
<MenuBar>
<Menu name="file">
<Action name="file_import"/>
......@@ -28,6 +28,8 @@
<Action name="feed_hide_read"/>
<Action name="feed_lock_in_place"/>
<Action name="auto_expand_folders"/>
<Separator/>
<Action name="fullscreen"/>
</Menu>
<Menu name="go">
......
......@@ -15,6 +15,9 @@
<Menu noMerge="1" name="view">
<text>&amp;View</text>
<Merge/>
<Separator/>
<Action name="fullscreen"/>
</Menu>
<Menu noMerge="1" name="go">
......
......@@ -25,11 +25,15 @@
#include <KShortcutsDialog>
#include <KSqueezedTextLabel>
#include <KStandardAction>
#include <KToggleFullScreenAction>
#include <KToolBar>
#include <KXMLGUIFactory>
#include <QApplication>
#include <QFontDatabase>
#include <QMenuBar>
#include <QStatusBar>
#include <QToolBar>
#include <QToolButton>
using namespace Akregator;
......@@ -74,6 +78,10 @@ MainWindow::MainWindow(QWidget *parent)
});
}
mShowFullScreenAction = KStandardAction::fullScreen(nullptr, nullptr, this, actionCollection());
actionCollection()->setDefaultShortcut(mShowFullScreenAction, Qt::Key_F11);
connect(mShowFullScreenAction, &QAction::toggled, this, &MainWindow::slotFullScreen);
setStandardToolBarMenuEnabled(true);
createStandardStatusBarAction();
......@@ -82,6 +90,26 @@ MainWindow::MainWindow(QWidget *parent)
connect(qApp, &QCoreApplication::aboutToQuit, this, &MainWindow::slotOnShutdown);
}
void MainWindow::slotFullScreen(bool t)
{
KToggleFullScreenAction::setFullScreen(this, t);
QMenuBar *mb = menuBar();
if (t) {
auto b = new QToolButton(mb);
b->setDefaultAction(mShowFullScreenAction);
b->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
b->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
mb->setCornerWidget(b, Qt::TopRightCorner);
b->setVisible(true);
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
} else {
QWidget *w = mb->cornerWidget(Qt::TopRightCorner);
if (w) {
w->deleteLater();
}
}
}
void MainWindow::slotToggleMenubar(bool dontShowWarning)
{
if (menuBar()) {
......
......@@ -16,6 +16,7 @@
class KSqueezedTextLabel;
class KHamburgerMenu;
class KToggleAction;
class KToggleFullScreenAction;
namespace Akregator
{
class Part;
......@@ -82,9 +83,11 @@ private Q_SLOTS:
private:
void updateHamburgerMenu();
void slotToggleMenubar(bool dontShowWarning);
void slotFullScreen(bool t);
QPointer<Akregator::Part> m_part;
KSqueezedTextLabel *const m_statusLabel;
KHamburgerMenu *mHamburgerMenu = nullptr;
KToggleAction *mShowMenuBarAction = nullptr;
KToggleFullScreenAction *mShowFullScreenAction = nullptr;
};
} // namespace Akregator
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment