1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[CommandLineOptions] New option to toggle fullscreen.

This commit is contained in:
nowrep 2014-01-22 17:34:25 +01:00
parent a1a0764101
commit a1f9b784d7
7 changed files with 31 additions and 11 deletions

View File

@ -51,7 +51,8 @@ void CommandLineOptions::showHelp()
" -nw or --new-window open new window\n"
" -pb or --private-browsing start private browsing\n"
" -dm or --download-manager show download manager\n"
" -nr or --no-remote open new instance\n"
" -fs or --fullscreen toggle fullscreen\n"
" -nr or --no-remote open new browser instance\n"
" -ct=URL or --current-tab=URL open URL in current tab\n"
" -ow=URL or --open-window=URL open URL in new window\n"
"\n"
@ -156,6 +157,12 @@ void CommandLineOptions::parseActions()
m_actions.append(pair);
}
if (arg.startsWith(QLatin1String("-fs")) || arg.startsWith(QLatin1String("--fullscreen"))) {
ActionPair pair;
pair.action = Qz::CL_ToggleFullScreen;
m_actions.append(pair);
}
if (arg.startsWith(QLatin1String("-ct")) || arg.startsWith(QLatin1String("--current-tab"))) {
int index = arg.indexOf(QLatin1Char('='));
if (index != -1) {

View File

@ -170,6 +170,10 @@ MainApplication::MainApplication(int &argc, char** argv)
case Qz::CL_NewWindow:
messages.append(QLatin1String("ACTION:NewWindow"));
break;
case Qz::CL_ToggleFullScreen:
messages.append(QLatin1String("ACTION:ToggleFullScreen"));
m_postLaunchActions.append(ToggleFullScreen);
break;
case Qz::CL_ShowDownloadManager:
messages.append(QLatin1String("ACTION:ShowDownloadManager"));
m_postLaunchActions.append(OpenDownloadManager);
@ -320,6 +324,10 @@ void MainApplication::postLaunch()
getWindow()->tabWidget()->addView(QUrl(), Qz::NT_SelectedNewEmptyTab);
}
if (m_postLaunchActions.contains(ToggleFullScreen)) {
getWindow()->toggleFullScreen();
}
AutoSaver* saver = new AutoSaver();
connect(saver, SIGNAL(saveApp()), this, SLOT(saveStateSlot()));
@ -560,6 +568,10 @@ void MainApplication::receiveAppMessage(QString message)
downManager()->show();
actWin = downManager();
}
else if (text == QLatin1String("ToggleFullScreen") && actWin) {
QupZilla* qz = static_cast<QupZilla*>(actWin);
qz->toggleFullScreen();
}
else if (text.startsWith(QLatin1String("OpenUrlInCurrentTab"))) {
actUrl = QUrl::fromUserInput(text.mid(19));
}
@ -577,13 +589,13 @@ void MainApplication::receiveAppMessage(QString message)
return;
}
QupZilla* qz = qobject_cast<QupZilla*>(actWin);
actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
actWin->raise();
actWin->activateWindow();
actWin->setFocus();
QupZilla* qz = qobject_cast<QupZilla*>(actWin);
if (qz && !actUrl.isEmpty()) {
qz->loadAddress(actUrl);
}

View File

@ -159,7 +159,7 @@ private slots:
void saveSettings();
private:
enum PostLaunchAction { OpenDownloadManager, OpenNewTab };
enum PostLaunchAction { OpenDownloadManager, OpenNewTab, ToggleFullScreen };
void loadTheme(const QString &name);
void translateApp();

View File

@ -485,7 +485,7 @@ void QupZilla::setupMenu()
#else
m_actionShowFullScreen->setShortcut(QKeySequence("Ctrl+F11"));
#endif
connect(m_actionShowFullScreen, SIGNAL(triggered(bool)), MENU_RECEIVER, SLOT(toggleFullScreen(bool)));
connect(m_actionShowFullScreen, SIGNAL(triggered(bool)), MENU_RECEIVER, SLOT(toggleFullScreen()));
m_actionStop = new QAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), MENU_RECEIVER);
connect(m_actionStop, SIGNAL(triggered()), MENU_RECEIVER, SLOT(stop()));
m_actionStop->setShortcut(QKeySequence("Esc"));
@ -1930,13 +1930,13 @@ bool QupZilla::event(QEvent* event)
return QMainWindow::event(event);
}
void QupZilla::toggleFullScreen(bool make)
void QupZilla::toggleFullScreen()
{
if (make) {
showFullScreen();
if (isFullScreen()) {
showNormal();
}
else {
showNormal();
showFullScreen();
}
}

View File

@ -122,6 +122,7 @@ signals:
public slots:
void setWindowTitle(const QString &t);
void toggleFullScreen();
void showWebInspector(bool toggle = true);
void showBookmarksToolbar();
@ -200,7 +201,6 @@ private slots:
void zoomIn();
void zoomOut();
void zoomReset();
void toggleFullScreen(bool make);
void changeEncoding(QObject* obj = 0);
void triggerCaretBrowsing();

View File

@ -68,6 +68,7 @@ enum CommandLineAction {
CL_NewTab,
CL_NewWindow,
CL_ShowDownloadManager,
CL_ToggleFullScreen,
CL_StartPrivateBrowsing,
CL_StartNewInstance,
CL_ExitAction

View File

@ -183,7 +183,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
connect(m_buttonHome, SIGNAL(controlClicked()), p_QupZilla, SLOT(goHomeInNewTab()));
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab()));
connect(m_buttonAddTab, SIGNAL(middleMouseClicked()), p_QupZilla->tabWidget(), SLOT(addTabFromClipboard()));
connect(m_exitFullscreen, SIGNAL(clicked(bool)), p_QupZilla, SLOT(toggleFullScreen(bool)));
connect(m_exitFullscreen, SIGNAL(clicked(bool)), p_QupZilla, SLOT(toggleFullScreen()));
}
void NavigationBar::setSplitterSizes(int locationBar, int websearchBar)