diff options
author | lionelc <lionelc@lionelc.(none)> | 2009-10-27 18:32:50 +0100 |
---|---|---|
committer | lionelc <lionelc@lionelc.(none)> | 2009-10-27 18:32:50 +0100 |
commit | 3f616b7a24f5c02928e90f18554056cff3f84976 (patch) | |
tree | abf30620ea37b0bdfe1aecd8eb819e825c2db75a /src | |
parent | Merge commit 'refs/merge-requests/1925' of git://gitorious.org/rekonq/mainlin... (diff) | |
download | rekonq-3f616b7a24f5c02928e90f18554056cff3f84976.tar.xz |
One passivepopup: less flickering.
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cpp | 44 | ||||
-rw-r--r-- | src/mainwindow.h | 3 |
2 files changed, 19 insertions, 28 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e26b39bd..fcd5a778 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -100,6 +100,7 @@ MainWindow::MainWindow() , m_historyBackMenu(0) , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, false, false) ) , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, false) ) + , m_popup( new KPassivePopup(this) ) , m_ac( new KActionCollection(this) ) { // enable window size "auto-save" @@ -140,6 +141,12 @@ MainWindow::MainWindow() // no more status bar.. setStatusBar(0); + // setting popup notification + m_popup->setAutoDelete(false); + connect(Application::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), m_popup, SLOT(hide())); + m_popup->setFrameShape(QFrame::NoFrame); + m_popup->setLineWidth(0); + QTimer::singleShot(0, this, SLOT(postLaunch())); } @@ -903,7 +910,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) emit shiftCtrlTabPressed(); return; } - + KMainWindow::keyPressEvent(event); } @@ -932,20 +939,10 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) // deleting popus if empty msgs if(msg.isEmpty()) { - if(m_popup) - { - m_popup->deleteLater(); - } + m_popup->hide(); return; } - KPassivePopup *popup_sav = m_popup; - - m_popup = new KPassivePopup(this); - m_popup->setAutoDelete(true); - - connect(Application::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), m_popup, SLOT(hide())); - QPixmap px; QString pixPath; @@ -966,17 +963,15 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) int margin = 4; // setting the popup - m_popup->setFrameShape(QFrame::NoFrame); QLabel *label = new QLabel(msg); label->setMaximumWidth(width()-2*margin); - m_popup->setLineWidth(0); m_popup->setView(label); - m_popup->setFixedSize(0, 0); + QSize labelSize(label->fontMetrics().width(msg)+2*margin, label->fontMetrics().height()+2*margin); + m_popup->setFixedSize(labelSize); m_popup->layout()->setAlignment(Qt::AlignTop); m_popup->layout()->setMargin(margin); // useful values - QSize labelSize(label->fontMetrics().width(msg)+2*margin, label->fontMetrics().height()+2*margin); bool scrollbarIsVisible = m_view->currentWebView()->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); int scrollbarSize = 0; if (scrollbarIsVisible) @@ -998,12 +993,7 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) y = bottomLeftY - labelSize.height(); } - QPoint p(x,y); - - m_popup->show(p); - - if(popup_sav) - delete popup_sav; + m_popup->show(QPoint(x,y)); } @@ -1039,7 +1029,7 @@ void MainWindow::clearPrivateData() { QWebSettings::clearIconDatabase(); } - + if(clearWidget.homePageThumbs->isChecked()) { QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rekonq"), true); @@ -1069,7 +1059,7 @@ void MainWindow::slotAboutToShowBackMenu() // Limit history views in the menu to 8 if(historyCount > 8) historyCount = 8; - + kDebug() << "History Count: " << historyCount; for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { @@ -1096,18 +1086,18 @@ void MainWindow::slotOpenActionUrl(QAction *action) kDebug() << "Invalid Offset!"; return; } - + if (offset < 0) { history->goToItem(history->itemAt(offset)); // back return; } - + if (offset > 0) { history->goToItem(history->forwardItems(history->count() - offset).back()); // forward FIXME CRASH } - + } diff --git a/src/mainwindow.h b/src/mainwindow.h index 7c42e58f..64e2067c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -167,9 +167,10 @@ private: QString m_lastSearch; - QPointer<KPassivePopup> m_popup; + KPassivePopup *m_popup; KActionCollection *m_ac; + }; #endif // MAINWINDOW_H |