diff options
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 903ec12b..1efcb0e4 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -57,24 +57,23 @@ #include <QtGui/QToolButton> +// loading pixmap path +const QString loadingGifPath = KStandardDirs::locate("appdata" , "pics/loading.mng"); + MainView::MainView(MainWindow *parent) : KTabWidget(parent) - , _widgetBar(new StackedUrlBar(this)) - , m_addTabButton(0) + , m_widgetBar(new StackedUrlBar(this)) + , m_addTabButton(new QToolButton(this)) , m_currentTabIndex(0) , m_parentWindow(parent) { // setting tabbar TabBar *tabBar = new TabBar(this); - m_addTabButton = new QToolButton(this); setTabBar(tabBar); // set mouse tracking for tab previews setMouseTracking(true); - // loading pixmap path - m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng"); - // connecting tabbar signals connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int))); @@ -87,7 +86,7 @@ MainView::MainView(MainWindow *parent) connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int))); connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); - connect(tabBar, SIGNAL(tabMoved(int, int)), _widgetBar, SLOT(moveBar(int, int))); + connect(tabBar, SIGNAL(tabMoved(int, int)), m_widgetBar, SLOT(moveBar(int, int))); // current page index changing connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); @@ -96,13 +95,6 @@ MainView::MainView(MainWindow *parent) } -MainView::~MainView() -{ - delete _widgetBar; - delete m_addTabButton; -} - - void MainView::postLaunch() { QStringList list = Application::sessionManager()->closedSites(); @@ -278,7 +270,7 @@ void MainView::currentChanged(int index) this, SIGNAL(linkHovered(const QString&))); emit currentTitle(tab->view()->title()); - _widgetBar->setCurrentIndex(index); + m_widgetBar->setCurrentIndex(index); // clean up "status bar" emit showStatusBarMessage(QString()); @@ -288,7 +280,7 @@ void MainView::currentChanged(int index) // set focus to the current webview if (tab->url().scheme() == QL1S("about")) - _widgetBar->currentWidget()->setFocus(); + m_widgetBar->currentWidget()->setFocus(); else tab->view()->setFocus(); } @@ -325,12 +317,12 @@ WebTab *MainView::newWebTab(bool focused) if ( ReKonfig::openTabsNearCurrent() ) { insertTab(currentIndex() + 1, tab, i18n("(Untitled)")); - _widgetBar->insertWidget(currentIndex() + 1, tab->urlBar()); + m_widgetBar->insertWidget(currentIndex() + 1, tab->urlBar()); } else { addTab(tab, i18n("(Untitled)")); - _widgetBar->addWidget(tab->urlBar()); + m_widgetBar->addWidget(tab->urlBar()); } updateTabBar(); @@ -495,8 +487,8 @@ void MainView::closeTab(int index, bool del) removeTab(index); updateTabBar(); // UI operation: do it ASAP!! - _widgetBar->removeWidget( tabToClose->urlBar() ); - _widgetBar->setCurrentIndex(m_currentTabIndex); + m_widgetBar->removeWidget( tabToClose->urlBar() ); + m_widgetBar->setCurrentIndex(m_currentTabIndex); if (del) { @@ -677,7 +669,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie) } if (addMovie && !label->movie()) { - QMovie *movie = new QMovie(m_loadingGitPath, QByteArray(), label); + QMovie *movie = new QMovie(loadingGifPath, QByteArray(), label); movie->setSpeed(50); label->setMovie(movie); movie->start(); |