mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Various small fixes (including fullscreen buttons hiding)
When going to fullscreen, add tab button will no longer stay on screen, and also when going back to normal screen, list tabs button will no longer be hidden.
This commit is contained in:
parent
9aa382764e
commit
a4b39822a6
|
@ -64,6 +64,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||
, m_isStateChanged(false)
|
||||
, m_isExited(false)
|
||||
, m_isRestoring(false)
|
||||
, m_databaseConnected(false)
|
||||
{
|
||||
setOverrideCursor(Qt::WaitCursor);
|
||||
#if defined(Q_WS_X11) & !defined(NO_SYSTEM_DATAPATH)
|
||||
|
@ -141,9 +142,6 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||
u.checkProfile();
|
||||
connectDatabase();
|
||||
|
||||
// if (!QDir(m_activeProfil).exists())
|
||||
// m_activeProfil=homePath+"profiles/default/";
|
||||
|
||||
QSettings settings2(m_activeProfil+"settings.ini", QSettings::IniFormat);
|
||||
settings2.beginGroup("SessionRestore");
|
||||
if (settings2.value("isRunning",false).toBool() )
|
||||
|
@ -359,15 +357,20 @@ void MainApplication::makeNewWindow(bool tryRestore, const QUrl &startUrl)
|
|||
|
||||
void MainApplication::connectDatabase()
|
||||
{
|
||||
if (m_databaseConnected)
|
||||
return;
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(m_activeProfil+"browsedata.db");
|
||||
if (!QFile::exists(m_activeProfil+"browsedata.db")) {
|
||||
QFile(DATADIR+"data/default/profiles/default/browsedata.db").copy(m_activeProfil+"browsedata.db");
|
||||
db.setDatabaseName(m_activeProfil + "browsedata.db");
|
||||
if (!QFile::exists(m_activeProfil + "browsedata.db")) {
|
||||
QFile(DATADIR + "data/default/profiles/default/browsedata.db").copy(m_activeProfil + "browsedata.db");
|
||||
db.setDatabaseName(m_activeProfil + "browsedata.db");
|
||||
qWarning("Cannot find SQLite database file! Copying and using the defaults!");
|
||||
}
|
||||
if (!db.open())
|
||||
qWarning("Cannot open SQLite database! Continuing without database....");
|
||||
|
||||
m_databaseConnected = true;
|
||||
}
|
||||
|
||||
void MainApplication::translateApp()
|
||||
|
|
|
@ -142,6 +142,8 @@ private:
|
|||
bool m_isStateChanged;
|
||||
bool m_isExited;
|
||||
bool m_isRestoring;
|
||||
|
||||
bool m_databaseConnected;
|
||||
};
|
||||
|
||||
#endif // MAINAPPLICATION_H
|
||||
|
|
|
@ -985,12 +985,14 @@ void QupZilla::showNavigationWithFullscreen()
|
|||
state = !m_navigationBar->isVisible();
|
||||
else
|
||||
state = !m_tabWidget->getTabBar()->isVisible();
|
||||
|
||||
if (m_navigationVisible)
|
||||
m_navigationBar->setVisible(state);
|
||||
m_tabWidget->getTabBar()->setVisible(state);
|
||||
|
||||
m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(state);
|
||||
|
||||
if (m_bookmarksToolBarVisible)
|
||||
m_bookmarksToolbar->setVisible(state);
|
||||
m_tabWidget->buttonListTabs()->setVisible(state);
|
||||
}
|
||||
|
||||
void QupZilla::fullScreen(bool make)
|
||||
|
@ -1000,21 +1002,27 @@ void QupZilla::fullScreen(bool make)
|
|||
m_statusBarVisible = statusBar()->isVisible();
|
||||
m_navigationVisible = m_navigationBar->isVisible();
|
||||
m_bookmarksToolBarVisible = m_bookmarksToolbar->isVisible();
|
||||
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
|
||||
menuBar()->hide();
|
||||
statusBar()->hide();
|
||||
bookmarksToolbar()->hide();
|
||||
m_navigationBar->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||
|
||||
menuBar()->setVisible(m_menuBarVisible);
|
||||
statusBar()->setVisible(m_statusBarVisible);
|
||||
m_bookmarksToolbar->setVisible(m_bookmarksToolBarVisible);
|
||||
m_navigationBar->setVisible(m_navigationVisible);
|
||||
}
|
||||
|
||||
m_actionShowFullScreen->setChecked(make);
|
||||
m_navigationBar->buttonExitFullscreen()->setVisible(make);
|
||||
m_tabWidget->getTabBar()->setVisible(!make);
|
||||
|
||||
emit setWebViewMouseTracking(make);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
#include "qupzilla.h"
|
||||
#include "squeezelabelv1.h"
|
||||
|
||||
TipLabel::TipLabel(QupZilla* parent) : SqueezeLabelV1(parent) , p_QupZilla(parent)
|
||||
TipLabel::TipLabel(QupZilla* parent)
|
||||
: SqueezeLabelV1(parent)
|
||||
, p_QupZilla(parent)
|
||||
, m_connected(false)
|
||||
{
|
||||
setWindowFlags(Qt::ToolTip);
|
||||
setForegroundRole(QPalette::ToolTipText);
|
||||
|
@ -30,7 +33,17 @@ TipLabel::TipLabel(QupZilla* parent) : SqueezeLabelV1(parent) , p_QupZilla(paren
|
|||
setMargin(2);
|
||||
}
|
||||
|
||||
void TipLabel::paintEvent(QPaintEvent *ev)
|
||||
void TipLabel::show()
|
||||
{
|
||||
if (!m_connected) {
|
||||
connect(p_QupZilla->tabWidget(), SIGNAL(currentChanged(int)), this, SLOT(hide()));
|
||||
m_connected = true;
|
||||
}
|
||||
|
||||
SqueezeLabelV1::show();
|
||||
}
|
||||
|
||||
void TipLabel::paintEvent(QPaintEvent* ev)
|
||||
{
|
||||
QStylePainter p(this);
|
||||
QStyleOptionFrame opt;
|
||||
|
@ -55,6 +68,7 @@ void StatusBarMessage::showMessage(const QString &message)
|
|||
else {
|
||||
WebView* view = p_QupZilla->weView();
|
||||
QWebFrame* mainFrame = view->page()->mainFrame();
|
||||
m_statusBarText->setParent(view);
|
||||
|
||||
int horizontalScrollSize = 0;
|
||||
int verticalScrollSize = 0;
|
||||
|
@ -77,7 +91,7 @@ void StatusBarMessage::showMessage(const QString &message)
|
|||
if (statusRect.contains(QCursor::pos()))
|
||||
position.setY(position.y() - m_statusBarText->height());
|
||||
|
||||
m_statusBarText->move(view->mapToGlobal(position));
|
||||
m_statusBarText->move(/*view->mapToGlobal(*/position/*)*/);
|
||||
m_statusBarText->show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,14 @@ class TipLabel : public SqueezeLabelV1 {
|
|||
|
||||
public:
|
||||
TipLabel(QupZilla* parent);
|
||||
void paintEvent(QPaintEvent *ev);
|
||||
|
||||
void show();
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent* ev);
|
||||
|
||||
QupZilla* p_QupZilla;
|
||||
bool m_connected;
|
||||
};
|
||||
|
||||
class StatusBarMessage : public QObject
|
||||
|
|
|
@ -45,6 +45,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
|
|||
setElideMode(Qt::ElideRight);
|
||||
setTabsClosable(true);
|
||||
setDocumentMode(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
loadSettings();
|
||||
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
|
||||
|
@ -64,6 +65,31 @@ void TabBar::loadSettings()
|
|||
settings.endGroup();
|
||||
}
|
||||
|
||||
void TabBar::updateVisibilityWithFullscreen(bool visible)
|
||||
{
|
||||
if (visible)
|
||||
emit showButtons();
|
||||
else
|
||||
emit hideButtons();
|
||||
|
||||
QTabBar::setVisible(visible);
|
||||
}
|
||||
|
||||
void TabBar::setVisible(bool visible)
|
||||
{
|
||||
if (visible) {
|
||||
if (p_QupZilla->isFullScreen())
|
||||
return;
|
||||
|
||||
emit showButtons();
|
||||
}
|
||||
else {
|
||||
emit hideButtons();
|
||||
}
|
||||
|
||||
QTabBar::setVisible(visible);
|
||||
}
|
||||
|
||||
void TabBar::contextMenuRequested(const QPoint &position)
|
||||
{
|
||||
int index = tabAt(position);
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
void loadSettings();
|
||||
QSize getTabSizeHint(int index) const { return QTabBar::tabSizeHint(index); }
|
||||
|
||||
void setVisible(bool visible);
|
||||
void updateVisibilityWithFullscreen(bool visible);
|
||||
|
||||
signals:
|
||||
void reloadTab(int index);
|
||||
void stopTab(int index);
|
||||
|
@ -52,6 +55,9 @@ signals:
|
|||
|
||||
void moveAddTabButton(int posX);
|
||||
|
||||
void showButtons();
|
||||
void hideButtons();
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -121,7 +121,10 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) :
|
|||
connect(m_tabBar, SIGNAL(closeAllButCurrent(int)), this, SLOT(closeAllButCurrent(int)));
|
||||
connect(m_tabBar, SIGNAL(duplicateTab(int)), this, SLOT(duplicateTab(int)));
|
||||
connect(m_tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)));
|
||||
|
||||
connect(m_tabBar, SIGNAL(moveAddTabButton(int)), this, SLOT(moveAddTabButton(int)));
|
||||
connect(m_tabBar, SIGNAL(showButtons()), this, SLOT(showButtons()));
|
||||
connect(m_tabBar, SIGNAL(hideButtons()), this, SLOT(hideButtons()));
|
||||
|
||||
m_buttonListTabs = new ToolButton(this);
|
||||
m_buttonListTabs->setObjectName("tabwidget-button-opentabs");
|
||||
|
@ -162,11 +165,22 @@ void TabWidget::resizeEvent(QResizeEvent *e)
|
|||
posit.setY(0);
|
||||
posit.setX(width() - m_buttonListTabs->width());
|
||||
m_buttonListTabs->move(posit);
|
||||
m_buttonListTabs->setVisible(getTabBar()->isVisible());
|
||||
|
||||
QTabWidget::resizeEvent(e);
|
||||
}
|
||||
|
||||
void TabWidget::showButtons()
|
||||
{
|
||||
m_buttonListTabs->show();
|
||||
m_buttonAddTab->show();
|
||||
}
|
||||
|
||||
void TabWidget::hideButtons()
|
||||
{
|
||||
m_buttonListTabs->hide();
|
||||
m_buttonAddTab->hide();
|
||||
}
|
||||
|
||||
void TabWidget::moveAddTabButton(int posX)
|
||||
{
|
||||
int posY = ( m_tabBar->height() - m_buttonAddTab->height() ) / 2;
|
||||
|
|
|
@ -79,6 +79,8 @@ public slots:
|
|||
void clearClosedTabsList();
|
||||
|
||||
void moveAddTabButton(int posX);
|
||||
void showButtons();
|
||||
void hideButtons();
|
||||
|
||||
private slots:
|
||||
void aboutToShowTabsMenu();
|
||||
|
|
|
@ -81,6 +81,9 @@ WebView::WebView(QupZilla* mainClass, WebTab* webTab)
|
|||
|
||||
connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));
|
||||
|
||||
//Tracking mouse also on tabs created in fullscreen
|
||||
trackMouse(p_QupZilla->isFullScreen());
|
||||
|
||||
//Zoom levels same as in firefox
|
||||
m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
|
||||
}
|
||||
|
@ -263,7 +266,7 @@ void WebView::iconChanged()
|
|||
if (mApp->isClosing())
|
||||
return;
|
||||
|
||||
if (isCurrent())
|
||||
// if (isCurrent())
|
||||
emit siteIconChanged();
|
||||
|
||||
if (m_isLoading)
|
||||
|
|
Loading…
Reference in New Issue
Block a user