Esempio n. 1
0
TabWidget::TabWidget(quint32 id, QWidget *parent) :
    QTabWidget(parent)
{
    m_id = id;
    m_menu = new AltClosableMenu(this);
    m_switchWidget = NULL;
    m_altEventValid = false;

    m_tab_bar = new TabBar(m_id, this);
    setTabBar(m_tab_bar);
    m_menuBtn = new QPushButton(tr("&Menu"), this);
    m_menuBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    m_menuBtn->setMenu(m_menu);
    m_menuBtn->setFlat(true);
    m_menuBtn->installEventFilter(this);

    setCornerWidget(m_menuBtn, Qt::TopLeftCorner);

    new QShortcut(QKeySequence("Ctrl+T"), this, SLOT(newTabBtn()), NULL, Qt::WidgetWithChildrenShortcut);

    connect(this,      SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
    connect(this,      SIGNAL(currentChanged(int)),    SLOT(currentIndexChanged(int)));
    connect(m_tab_bar, SIGNAL(tabMoved(int,int)),      SLOT(tabMoved(int,int)));
    connect(m_tab_bar, SIGNAL(plusPressed()),          SLOT(newTabBtn()));
    connect(m_tab_bar, SIGNAL(split(int,int)),         SIGNAL(split(int,int)));
    connect(m_tab_bar, SIGNAL(pullTab(int,TabWidget*,int)),
                       SLOT(pullTab(int,TabWidget*,int)), Qt::QueuedConnection);
    connect(m_tab_bar, SIGNAL(newWindow(int)),         SLOT(newWindow(int)), Qt::QueuedConnection);

    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    sWorkTabMgr.registerTabWidget(this);
}
ViewManager::ViewManager(DwarfModel *dm, DwarfModelProxy *proxy,
                         QWidget *parent)
    : QTabWidget(parent)
    , m_model(dm)
    , m_proxy(proxy)
    , m_add_tab_button(new QToolButton(this))
{
    m_proxy->setSourceModel(m_model);
    setTabsClosable(true);
    setMovable(true);

    //reload_views();

    m_add_tab_button->setText(tr("Add "));
    m_add_tab_button->setIcon(QIcon(":img/ui-tab--plus.png"));
    m_add_tab_button->setPopupMode(QToolButton::InstantPopup);
    m_add_tab_button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    m_add_tab_button->setToolTip(tr("Add an existing view. New views can be copied or created from the [Windows->Docks->Grid Views] dock."));
    draw_add_tab_button();
    setCornerWidget(m_add_tab_button, Qt::TopLeftCorner);    

    connect(tabBar(), SIGNAL(tabMoved(int, int)), SLOT(write_views()));
    connect(tabBar(), SIGNAL(currentChanged(int)), SLOT(setCurrentIndex(int)), Qt::UniqueConnection);
    connect(this, SIGNAL(tabCloseRequested(int)), SLOT(remove_tab_for_gridview(int)));
    connect(m_model, SIGNAL(need_redraw()), SLOT(redraw_current_tab()));
    //draw_views();

    m_squad_warning = new QErrorMessage(this);    
}
DLSTabWidget::DLSTabWidget(QWidget *parent)
	: KTWCLASS(parent), m_closeButton(0)
{
	setFocusPolicy(Qt::NoFocus);

	loadSettings();
    
	if (!m_tabBarShown)
	{
		tabBar()->hide();
	}
	else 
	{
		m_closeButton = new QToolButton(this);

		m_closeButton->setIcon(QIcon( (const char **) close_xpm));

		m_closeButton->adjustSize();
		m_closeButton->hide();
		setCornerWidget(m_closeButton, Qt::TopRightCorner);
        
		if (m_closeOnHover)
		{
//             		setHoverCloseButton(true);
		}
	}
    
	connect(this, SIGNAL(currentChanged(QWidget*)), this, SLOT(setFocus(QWidget*)));
}
Esempio n. 4
0
MsaEditorTreeTab::MsaEditorTreeTab(MSAEditor* msa, QWidget* parent)
    : QTabWidget(parent), msa(msa), addTabButton(NULL){
    setObjectName("MsaEditorTreeTab");
    addTabButton = new QPushButton(QIcon(":/core/images/add_tree.png"), "", this);
    addTabButton->setToolTip(tr("Add existing tree"));
    setCornerWidget(addTabButton);
    connect(addTabButton, SIGNAL(clicked(bool)), this, SLOT(sl_addTabTriggered()));
    connect(this, SIGNAL(si_tabsCountChanged(int)), SLOT(sl_onCountChanged(int)));

    setTabsClosable(true);
    connect(this, SIGNAL(tabCloseRequested(int)), SLOT(sl_onTabCloseRequested(int)));

    tabBar()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tabBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sl_onContextMenuRequested(const QPoint&)));

    closeOtherTabs = new QAction(tr("Close other tabs"), this);
    closeOtherTabs->setObjectName("Close other tabs");
    connect(closeOtherTabs, SIGNAL(triggered()), SLOT(sl_onCloseOtherTabs()));

    closeAllTabs = new QAction(tr("Close all tabs"), this);
    closeAllTabs->setObjectName("Close all tabs");
    connect(closeAllTabs, SIGNAL(triggered()), SLOT(sl_onCloseAllTabs()));

    closeTab = new QAction(tr("Close tab"), this);
    closeTab->setObjectName("Close tab");
    connect(closeTab, SIGNAL(triggered()), SLOT(sl_onCloseTab()));
}
Esempio n. 5
0
void GraphicsDImgView::installPanIcon()
{
    d->cornerButton = PanIconWidget::button();
    setCornerWidget(d->cornerButton);

    connect(d->cornerButton, SIGNAL(pressed()),
            this, SLOT(slotCornerButtonPressed()));
}
Esempio n. 6
0
MainTab::MainTab(QWidget* parent) : QTabWidget(parent), m_lastIndex(0), m_lastIndexCur(0)
{
    m_toolTabClose = new QToolButton(this);
    m_toolTabClose->setIcon(QIcon(":/menu/tab_remove.png"));
    m_toolTabClose->setEnabled(false);
    setCornerWidget(m_toolTabClose);

    connect(m_toolTabClose, SIGNAL(clicked()), this, SLOT(closeTabBtn()));
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));

    QToolButton* btn = new QToolButton(this);
    QMenu* tabOpenMenu = new QMenu(btn);

    initAppTools(tabOpenMenu);

    btn->setIcon(QIcon(":/menu/tab_new.png"));
    btn->setPopupMode(QToolButton::InstantPopup);
    btn->setMenu(tabOpenMenu);
    setCornerWidget(btn, Qt::TopLeftCorner);
}
Esempio n. 7
0
DTermTab::DTermTab(QWidget *parent) : DTabWidget(parent)
{
// 	tabBar()->setShape( QTabBar::TriangularNorth );
	
	m_newTab = new QToolButton(this);
	m_newTab->setText(tr("New"));
	
	connect(m_newTab, SIGNAL(clicked()), this, SLOT(newTerm()));
	
	m_closeTab = new QToolButton(this);
	m_closeTab->setText(tr("Close"));
	
	
	connect(m_closeTab, SIGNAL(clicked()), this, SLOT(closeCurrentTerm()));
	
	setCornerWidget( m_newTab, Qt::TopLeftCorner );
	setCornerWidget( m_closeTab, Qt::TopRightCorner );
	
	m_closeTab->show();
	m_newTab->show();
	
	newTerm();
}
Esempio n. 8
0
TabLogViewsWidget::TabLogViewsWidget(QWidget *parent)
    : QTabWidget(parent)
    , d(new TabLogViewsWidgetPrivate())
{
    d->contextMenu = NULL;

    QPushButton *tabNewTabButton
        = new QPushButton(SmallIcon(QStringLiteral("tab-new")), QLatin1String(""), this);
    connect(tabNewTabButton, &QAbstractButton::clicked, this, &TabLogViewsWidget::createTab);

    tabNewTabButton->setToolTip(i18n("Create a new tab"));
    tabNewTabButton->setWhatsThis(i18n("Creates a new tab which can display another log."));

    QPushButton *tabCloseTabButton
        = new QPushButton(SmallIcon(QStringLiteral("tab-close")), QLatin1String(""), this);
    connect(tabCloseTabButton, &QAbstractButton::clicked, this, &TabLogViewsWidget::closeTab);

    tabCloseTabButton->setToolTip(i18n("Close the current tab"));
    tabCloseTabButton->setWhatsThis(i18n("Closes the current tab."));

    setCornerWidget(tabNewTabButton, Qt::TopLeftCorner);
    setCornerWidget(tabCloseTabButton, Qt::TopRightCorner);

    setUsesScrollButtons(true);

    // The context menu is managed manually
    setContextMenuPolicy(Qt::ActionsContextMenu);

    // connect(this, SIGNAL(mouseDoubleClick()), this, SLOT(createTab()));
    // connect(this, SIGNAL(contextMenu(QPoint)), this, SLOT(showContextMenu(QPoint)));
    // connect(this, SIGNAL(contextMenu(QWidget*,QPoint)), this, SLOT(showContextMenu(QWidget*,QPoint)));

    // TODO Use this (need to connect to movedTab(int, int) signal and update the QList
    // setTabReorderingEnabled(true);

    connect(this, &QTabWidget::currentChanged, this, &TabLogViewsWidget::changeCurrentTab);
}
Esempio n. 9
0
SourceViewerManager::SourceViewerManager(QWidget* parent) : QTabWidget(parent)
{
    setMovable(true);
    setTabsClosable(true);

    //Close All Tabs
    mCloseAllTabs = new QPushButton(this);
    mCloseAllTabs->setIcon(QIcon(":/icons/images/close-all-tabs.png"));
    mCloseAllTabs->setToolTip("Close All Tabs");
    connect(mCloseAllTabs, SIGNAL(clicked()), this, SLOT(closeAllTabs()));
    setCornerWidget(mCloseAllTabs, Qt::TopLeftCorner);

    connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
    connect(Bridge::getBridge(), SIGNAL(loadSourceFile(QString, int, int)), this, SLOT(loadSourceFile(QString, int, int)));
}
Esempio n. 10
0
ReferenceManager::ReferenceManager(QWidget* parent) : QTabWidget(parent)
{
    setMovable(true);
    setTabsClosable(true);
    mCurrentReferenceView = 0;

    //Close All Tabs
    mCloseAllTabs = new QPushButton(this);
    mCloseAllTabs->setIcon(DIcon("close-all-tabs.png"));
    mCloseAllTabs->setToolTip(tr("Close All Tabs"));
    connect(mCloseAllTabs, SIGNAL(clicked()), this, SLOT(closeAllTabs()));
    setCornerWidget(mCloseAllTabs, Qt::TopLeftCorner);
    setContextMenuPolicy(Qt::CustomContextMenu);

    connect(Bridge::getBridge(), SIGNAL(referenceInitialize(QString)), this, SLOT(newReferenceView(QString)));
    connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
}
TabView::TabView(QWidget *parent)
    : QTabWidget{parent},
      m_ptrTabBar{std14_stl::make_unique<TabBar>(this)},
      m_ptrBtnTabsList{std14_stl::make_unique<QToolButton>(this)},
      m_ptrMnuTabsList{std14_stl::make_unique<QMenu>(this)},
      m_pLastTab{nullptr}
{
    setTabBar(m_ptrTabBar.get());

    m_ptrBtnTabsList->setFixedWidth(20);
    m_ptrBtnTabsList->setPopupMode(QToolButton::MenuButtonPopup);
    m_ptrBtnTabsList->setMenu(m_ptrMnuTabsList.get());

    setCornerWidget(m_ptrBtnTabsList.get(), Qt::TopRightCorner);

    setDocumentMode(true);
    setMovable(true);
    setTabsClosable(true);
    setUsesScrollButtons(true);
}
Esempio n. 12
0
pTabbedWorkspace::pTabbedWorkspace( QWidget* p, pTabbedWorkspace::TabMode m )
	: QWidget( p )
{
	// tab widget
	mTabLayout = new QBoxLayout( QBoxLayout::LeftToRight );
	mTabLayout->setSpacing( 3 );
	mTabLayout->setMargin( 0 );
	mTabLayout->addWidget( ( mTabBar = new pTabBar ) );

	// document widget
	mStackedLayout = new QStackedLayout;
	mStackedLayout->addWidget( ( mStackedWidget = new QStackedWidget ) );
	mStackedLayout->addWidget( ( mWorkspaceWidget = new QWorkspace ) );
	mWorkspaceWidget->setScrollBarsEnabled( true );

	// main layout
	mLayout = new QBoxLayout( QBoxLayout::TopToBottom, this );
	mLayout->setSpacing( 0 );
	mLayout->setMargin( 0 );
	mLayout->addLayout( mTabLayout );
	mLayout->addLayout( mStackedLayout );

	// connections
	connect( mTabBar, SIGNAL( midButtonPressed( int, const QPoint& ) ), this, SLOT( internal_midButtonPressed( int, const QPoint& ) ) );
	connect( mTabBar, SIGNAL( closeButtonClicked( int ) ), this, SLOT( internal_closeButtonClicked( int ) ) );
	connect( mTabBar, SIGNAL( rightButtonPressed( int, const QPoint& ) ), this, SLOT( internal_rightButtonPressed( int, const QPoint& ) ) );
	connect( mTabBar, SIGNAL( tabDropped( int, int ) ), this, SLOT( internal_tabDropped( int, int ) ) );
	connect( mTabBar, SIGNAL( currentChanged( int ) ), this, SLOT( internal_currentChanged( int ) ) );
	connect( mWorkspaceWidget, SIGNAL( windowActivated( QWidget* ) ), this, SLOT( workspaceWidget_windowActivated( QWidget* ) ) );
	
	// init view
	setAttribute( Qt::WA_DeleteOnClose );
	mTabBar->setDrawBase( false );
	mTabBar->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) );
	setCornerWidget( pTabbedWorkspaceRightCorner::instance( this ) );
	setTabMode( m );
	setDocumentMode( pTabbedWorkspace::dmMaximized );
}
Esempio n. 13
0
TabWidget::TabWidget(QWidget * parent)
    :KTabWidget(parent), d(new Private( this ) )
{
    setMinimumSize(250,150);
    setMovable(false);
    setDocumentMode(true);
    connect( this, SIGNAL(currentChanged(int)),
             this, SLOT(slotTabChanged(int)) );
    connect(this, SIGNAL(closeRequest(QWidget*)),
            this, SLOT(slotCloseRequest(QWidget*)));
    setTabsClosable(Settings::closeButtonOnTabs());

    d->tabsClose = new QToolButton(this);
    connect( d->tabsClose, SIGNAL(clicked()), this,
             SLOT(slotRemoveCurrentFrame()) );

    d->tabsClose->setIcon( KIcon( "tab-close" ) );
    d->tabsClose->setEnabled( false );
    d->tabsClose->adjustSize();
    d->tabsClose->setToolTip( i18n("Close the current tab"));
    setCornerWidget( d->tabsClose, Qt::TopRightCorner );
    d->updateTabBarVisibility();
}
Esempio n. 14
0
TabWidget::TabWidget(QWidget *parent)
    : QTabWidget(parent)
    , m_recentlyClosedTabsAction(0)
    , m_newTabAction(0)
    , m_closeTabAction(0)
    , m_nextTabAction(0)
    , m_previousTabAction(0)
    , m_recentlyClosedTabsMenu(0)
    , m_lineEditCompleter(0)
    , m_lineEdits(0)
    , m_tabBar(new TabBar(this))
{
    setElideMode(Qt::ElideRight);

    new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_T), this, SLOT(openLastTab()));

    connect(m_tabBar, SIGNAL(loadUrl(const QUrl&, TabWidget::Tab)),
            this, SLOT(loadUrl(const QUrl&, TabWidget::Tab)));
    connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab()));
    connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
    connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
    connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
    connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
    connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
#if QT_VERSION < 0x040500
    connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(moveTab(int, int)));
#endif
    setTabBar(m_tabBar);
#if QT_VERSION >= 0x040500
    setDocumentMode(true);
    connect(m_tabBar, SIGNAL(tabMoved(int, int)),
            this, SLOT(moveTab(int, int)));
#endif

    // Actions
    m_newTabAction = new QAction(tr("New &Tab"), this);
    m_newTabAction->setShortcuts(QKeySequence::AddTab);
    connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab()));

    m_closeTabAction = new QAction(tr("&Close Tab"), this);
    m_closeTabAction->setShortcuts(QKeySequence::Close);
    connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab()));

#if QT_VERSION < 0x040500
    m_newTabAction->setIcon(QIcon(QLatin1String(":addtab.png")));
    m_newTabAction->setIconVisibleInMenu(false);

    m_closeTabAction->setIcon(QIcon(QLatin1String(":closetab.png")));
    m_closeTabAction->setIconVisibleInMenu(false);
#endif

    m_nextTabAction = new QAction(tr("Show Next Tab"), this);
    QList<QKeySequence> shortcuts;
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketRight));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Less));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
    m_nextTabAction->setShortcuts(shortcuts);
    connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab()));

    m_previousTabAction = new QAction(tr("Show Previous Tab"), this);
    shortcuts.clear();
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketLeft));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Greater));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
    m_previousTabAction->setShortcuts(shortcuts);
    connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab()));

    m_recentlyClosedTabsMenu = new QMenu(this);
    connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()),
            this, SLOT(aboutToShowRecentTabsMenu()));
    connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)),
            this, SLOT(aboutToShowRecentTriggeredAction(QAction *)));
    m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this);
    m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
    m_recentlyClosedTabsAction->setEnabled(false);

#if QT_VERSION >= 0x040500
    m_tabBar->setTabsClosable(true);
    connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
            this, SLOT(closeTab(int)));
    m_tabBar->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
#else
    // corner buttons
    QToolButton *addTabButton = new QToolButton(this);
    addTabButton->setDefaultAction(m_newTabAction);
    addTabButton->setAutoRaise(true);
    addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    setCornerWidget(addTabButton, Qt::TopLeftCorner);

    QToolButton *closeTabButton = new QToolButton(this);
    closeTabButton->setDefaultAction(m_closeTabAction);
    closeTabButton->setAutoRaise(true);
    closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    setCornerWidget(closeTabButton, Qt::TopRightCorner);
#endif

    connect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));

    m_lineEdits = new QStackedWidget(this);

    connect(BrowserApplication::historyManager(), SIGNAL(historyCleared()),
        this, SLOT(historyCleared()));
}
Esempio n. 15
0
TabWidget::TabWidget( QWidget* parent )
{
    qDebug() << "[TABWIDGET] Constructing";

    mGrabbedWidget = 0;
    mTabs = 0;

    // set the tab position

    setTabsPosition();
    mStatusBar = &mStatusBar->getInstance();

    // create the tabbar

    mBar = new TabBar;
    setTabBar( mBar );

    // connect the mouse clicks

    connect( mBar, SIGNAL( tabRightClicked( int, QPoint ) ),
             this, SLOT( tabRightClicked( int, QPoint ) ) );

    connect( mBar, SIGNAL( tabMiddleClicked( int, QPoint ) ),
             this, SLOT( tabMiddleClicked( int, QPoint ) ) );

    TabButton* newTabButton = new TabButton( this );
    TabButton* mMenuButton = new TabButton( this );

    connect( newTabButton, SIGNAL( clicked() ),
             this, SLOT( addUnityBrowser()) );

    connect( newTabButton, SIGNAL( middleClicked() ),
             this, SLOT( addUnityBrowserWithSR() ) );

    connect( mMenuButton, SIGNAL( clicked() ),
             mMenuButton, SLOT( showMenu()) );

    mMenuButton->setMenu( kueueMainMenu() );

    newTabButton->setIcon( QIcon( ":icons/menus/newtab.png" ) );
    mMenuButton->setIcon( QIcon(":/icons/kueue.png") );

    if ( Settings::unityEnabled() )
    {
        setCornerWidget( newTabButton, Qt::TopRightCorner );
    }

    setCornerWidget( mMenuButton, Qt::TopLeftCorner );

    // create the main browser tabs...

    mQueueBrowser = new QueueBrowser( this );

    mSubownerBrowser = new SubownerBrowser( this );

    mPersonalTab = new BrowserWithSearch( mQueueBrowser, this );

    mSubownerTab = new BrowserWithSearch( mSubownerBrowser, this );

    connect( mQueueBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mSubownerBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mQueueBrowser, SIGNAL( expandAll() ),
             this, SLOT( expandAllTables() ) );

    connect( mQueueBrowser, SIGNAL( closeAll() ),
             this, SLOT( closeAllTables() ) );

    mQmonBrowser = new QMonBrowser( this );
    mMonitorTab = new BrowserWithSearch( mQmonBrowser, this );

    mStatsBrowser = new StatsBrowser( this );
    mStatsTab = new BrowserWithSearch( mStatsBrowser, this );

    if ( Settings::unityEnabled() )
    {
        addUnityBrowser();
        rebuildMaps();
    }

    mSubVisible = true;

    // ...and add them to the tabbar

    insertTab( 0, mPersonalTab, QIcon( ":icons/conf/targets.png" ), "Personal queue" );
    insertTab( 1, mSubownerTab, QIcon( ":icons/conf/targets.png" ), "Subowned SRs" );
    insertTab( 2, mMonitorTab, QIcon( ":/icons/conf/monitor.png" ), "Queue monitor" );
    insertTab( 3, mStatsTab, QIcon( ":/icons/conf/stats.png" ), "Statistics" );

    QShortcut* search = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_F ), this );

    connect( search, SIGNAL( activated() ),
             this, SLOT( showSearch() ) );

    refreshTabs();
}
Esempio n. 16
0
TabWidget::TabWidget(QWidget *parent)
    : QTabWidget(parent)
    , m_recentlyClosedTabsAction(0)
    , m_newTabAction(0)
    , m_closeTabAction(0)
    , m_nextTabAction(0)
    , m_previousTabAction(0)
    , m_recentlyClosedTabsMenu(0)
    , m_swappedDelayedWidget(false)
    , m_lineEditCompleter(0)
    , m_lineEdits(0)
    , m_tabBar(new TabBar(this))
{
    setElideMode(Qt::ElideRight);

    new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_T), this, SLOT(openLastTab()));

    connect(m_tabBar, SIGNAL(loadUrl(const QUrl&, TabWidget::OpenUrlIn)),
            this, SLOT(loadUrl(const QUrl&, TabWidget::OpenUrlIn)));
    connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab()));
    connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
    connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
    connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
    connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
    connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
#if QT_VERSION < 0x040500
    connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(moveTab(int, int)));
#endif
    setTabBar(m_tabBar);
#if QT_VERSION >= 0x040500
    setDocumentMode(true);
    connect(m_tabBar, SIGNAL(tabMoved(int, int)),
            this, SLOT(moveTab(int, int)));
#endif

    // Actions
    m_newTabAction = new QAction(this);
    m_newTabAction->setShortcuts(QKeySequence::AddTab);
    connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab()));

    m_closeTabAction = new QAction(this);
    m_closeTabAction->setShortcuts(QKeySequence::Close);
    connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab()));

    m_newTabAction->setIcon(QIcon(QLatin1String(":addtab.png")));
    m_newTabAction->setIconVisibleInMenu(false);

#if QT_VERSION >= 0x040500
    QSettings settings;
    settings.beginGroup(QLatin1String("tabs"));
    bool oneCloseButton = settings.value(QLatin1String("oneCloseButton"), false).toBool();
    if (oneCloseButton) {
#endif
        // With Qt < 4.5 do this always, with >=4.5 only if enabled.
        m_closeTabAction->setIcon(QIcon(QLatin1String(":closetab.png")));
        m_closeTabAction->setIconVisibleInMenu(false);
#if QT_VERSION >= 0x040500
    }
#endif

    m_nextTabAction = new QAction(this);
    connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab()));

    m_previousTabAction = new QAction(this);
    connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab()));

    m_recentlyClosedTabsMenu = new QMenu(this);
    connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()),
            this, SLOT(aboutToShowRecentTabsMenu()));
    connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)),
            this, SLOT(aboutToShowRecentTriggeredAction(QAction *)));
    m_recentlyClosedTabsAction = new QAction(this);
    m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
    m_recentlyClosedTabsAction->setEnabled(false);

#if QT_VERSION < 0x040500
    QToolButton *addTabButton = new QToolButton(this);
    addTabButton->setDefaultAction(m_newTabAction);
    addTabButton->setAutoRaise(true);
    addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    setCornerWidget(addTabButton, Qt::TopLeftCorner);
#endif

#if QT_VERSION >= 0x040500
    if (oneCloseButton) {
#endif
        // corner buttons
        // With Qt < 4.5 do this always, with >=4.5 only if enabled.
        QToolButton *closeTabButton = new QToolButton(this);
        closeTabButton->setDefaultAction(m_closeTabAction);
        closeTabButton->setAutoRaise(true);
        closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
        setCornerWidget(closeTabButton, Qt::TopRightCorner);
#if QT_VERSION >= 0x040500
    } else {
        m_tabBar->setTabsClosable(true);

        connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
                this, SLOT(closeTab(int)));
    }
#endif

    connect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));

    m_lineEdits = new QStackedWidget(this);

    connect(BrowserApplication::historyManager(), SIGNAL(historyCleared()),
        this, SLOT(historyCleared()));

    // Initialize Actions' labels
    retranslate();
}
Esempio n. 17
0
KonqFrameTabs::KonqFrameTabs(QWidget *parent, KonqFrameContainerBase *parentContainer,
                             KonqViewManager *viewManager)
    : KTabWidget(parent),
      m_pPopupMenu(0),
      m_pSubPopupMenuTab(0),
      m_rightWidget(0), m_leftWidget(0), m_alwaysTabBar(false)
{
    // Set an object name so the widget style can identify this widget.
    setObjectName(QStringLiteral("kde_konq_tabwidget"));
    setDocumentMode(true);

    KAcceleratorManager::setNoAccel(this);

    tabBar()->setWhatsThis(i18n("This bar contains the list of currently open tabs. Click on a tab to make it "
                                "active. You can also use keyboard shortcuts to "
                                "navigate through tabs. The text on the tab shows the content "
                                "currently open in it; place your mouse over the tab to see the full title, in "
                                "case it has been shortened to fit the tab width."));
    //qDebug() << "KonqFrameTabs::KonqFrameTabs()";

    m_pParentContainer = parentContainer;
    m_pActiveChild = 0L;
    m_pViewManager = viewManager;

    m_permanentCloseButtons = KonqSettings::permanentCloseButton();
    if (m_permanentCloseButtons) {
        setTabsClosable(true);
    }
    tabBar()->setSelectionBehaviorOnRemove(
        KonqSettings::tabCloseActivatePrevious() ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);

    if (KonqSettings::tabPosition() == QLatin1String("Bottom")) {
        setTabPosition(QTabWidget::South);
    }
    connect(this, SIGNAL(closeRequest(QWidget*)), SLOT(slotCloseRequest(QWidget*)));
    connect(this, SIGNAL(removeTabPopup()),
            m_pViewManager->mainWindow(), SLOT(slotRemoveTabPopup()));

    if (KonqSettings::addTabButton()) {
        m_leftWidget = new NewTabToolButton(this);
        connect(m_leftWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotAddTab()));
        connect(m_leftWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
                SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
        connect(m_leftWidget, SIGNAL(receivedDropEvent(QDropEvent*)),
                SLOT(slotReceivedDropEvent(QDropEvent*)));
        m_leftWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
        m_leftWidget->adjustSize();
        m_leftWidget->setToolTip(i18n("Open a new tab"));
        setCornerWidget(m_leftWidget, Qt::TopLeftCorner);
    }
    if (KonqSettings::closeTabButton()) {
        m_rightWidget = new QToolButton(this);
        connect(m_rightWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotRemoveTab()));
        m_rightWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
        m_rightWidget->adjustSize();
        m_rightWidget->setToolTip(i18n("Close the current tab"));
        setCornerWidget(m_rightWidget, Qt::TopRightCorner);
    }

    setAutomaticResizeTabs(true);
    setMovable(true);

    connect(tabBar(), SIGNAL(tabMoved(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(movedTab(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(mouseMiddleClick()),
            SLOT(slotMouseMiddleClick()));
    connect(this, SIGNAL(mouseMiddleClick(QWidget*)),
            SLOT(slotMouseMiddleClick(QWidget*)));
    connect(this, SIGNAL(mouseDoubleClick()),
            m_pViewManager->mainWindow(), SLOT(slotAddTab()));

    connect(this, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
            SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
    connect(this, SIGNAL(receivedDropEvent(QDropEvent*)),
            SLOT(slotReceivedDropEvent(QDropEvent*)));
    connect(this, SIGNAL(receivedDropEvent(QWidget*,QDropEvent*)),
            SLOT(slotReceivedDropEvent(QWidget*,QDropEvent*)));
    connect(this, SIGNAL(initiateDrag(QWidget*)),
            SLOT(slotInitiateDrag(QWidget*)));

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#pragma message("KF5: revert the commit that introduced this line")
#endif
    tabBar()->installEventFilter(this);
    initPopupMenu();
}
Esempio n. 18
0
void TabWidget::init()
{
	setWindowRole("kadu-tabs");

	TabBar *tabbar = new TabBar(this);
	setTabBar(tabbar);

	setAcceptDrops(true);
	setMovable(true);

	setDocumentMode(true);

	connect(tabbar, SIGNAL(contextMenu(int, const QPoint &)),
			SLOT(onContextMenu(int, const QPoint &)));
	connect(tabbar, SIGNAL(tabCloseRequested(int)),
			SLOT(onDeleteTab(int)));
	connect(tabbar,SIGNAL(mouseDoubleClickEventSignal(QMouseEvent *)),
			SLOT(mouseDoubleClickEvent(QMouseEvent *)));
	connect(tabbar, SIGNAL(currentChanged(int)),
			SLOT(currentTabChanged(int)));

	//widget (container) for buttons with opening conversations
	//both buttons are displayed when checking Show "New Tab" button in configurations
	OpenChatButtonsWidget = new QWidget(this);
	QHBoxLayout *horizontalLayout = new QHBoxLayout;

	horizontalLayout->setSpacing(2);
	horizontalLayout->setContentsMargins(3, 0, 2, 3);

	//button for new chat from last conversations
	OpenRecentChatButton = new QToolButton(OpenChatButtonsWidget);
	OpenRecentChatButton->setIcon(m_iconsManager->iconByPath(KaduIcon("internet-group-chat")));
	OpenRecentChatButton->setToolTip(tr("Recent Chats"));
	OpenRecentChatButton->setAutoRaise(true);
	connect(OpenRecentChatButton, SIGNAL(clicked()), SLOT(openRecentChatsMenu()));

	//menu for recent chats
	RecentChatsMenuWidget = m_pluginInjectedFactory->makeInjected<RecentChatsMenu>(OpenRecentChatButton);
	connect(RecentChatsMenuWidget, SIGNAL(triggered(QAction *)), this, SLOT(openRecentChat(QAction *)));
	connect(RecentChatsMenuWidget, SIGNAL(chatsListAvailable(bool)), OpenRecentChatButton, SLOT(setEnabled(bool)));

	//button for opening chat
	QToolButton *openChatButton = new QToolButton(OpenChatButtonsWidget);
	openChatButton->setIcon(m_iconsManager->iconByPath(KaduIcon("mail-message-new")));
	openChatButton->setToolTip(tr("Open Chat with..."));
	openChatButton->setAutoRaise(true);
	connect(openChatButton, SIGNAL(clicked()), SLOT(newChat()));

	horizontalLayout->addWidget(OpenRecentChatButton);
	horizontalLayout->addWidget(openChatButton);

	OpenChatButtonsWidget->setLayout(horizontalLayout);
	OpenChatButtonsWidget->setVisible(false);

	RightCornerWidget = new QWidget(this);
	QHBoxLayout *rightCornerWidgetLayout = new QHBoxLayout;

	rightCornerWidgetLayout->setSpacing(2);
	rightCornerWidgetLayout->setContentsMargins(3, 0, 2, 3);

	TabsMenu = new QMenu(this);
	connect(TabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(tabsMenuSelected(QAction *)));
	TabsListButton = new QToolButton(RightCornerWidget);
	TabsListButton->setIcon(m_iconsManager->iconByPath(KaduIcon("internet-group-chat")));
	TabsListButton->setToolTip(tr("Tabs"));
	TabsListButton->setAutoRaise(true);
	TabsListButton->setVisible(false);
	TabsListButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	TabsListButton->setMenu(TabsMenu);
	connect(TabsListButton, SIGNAL(clicked()), SLOT(openTabsList()));
	rightCornerWidgetLayout->addWidget(TabsListButton);

	//przycisk zamkniecia aktywnej karty znajdujacy sie w prawym gornym rogu
	CloseChatButton = new QToolButton(this);
	CloseChatButton->setIcon(m_iconsManager->iconByPath(KaduIcon("kadu_icons/tab-remove")));
	CloseChatButton->setToolTip(tr("Close Tab"));
	CloseChatButton->setAutoRaise(true);
	CloseChatButton->setVisible(false);
	connect(CloseChatButton, SIGNAL(clicked()), SLOT(deleteTab()));
	rightCornerWidgetLayout->addWidget(CloseChatButton);

	RightCornerWidget->setLayout(rightCornerWidgetLayout);
	setCornerWidget(RightCornerWidget, Qt::TopRightCorner);

	configurationUpdated();
}
Esempio n. 19
0
TabWidget::TabWidget(QWidget *parent)
    : QTabWidget(parent)
    , m_recentlyClosedTabsAction(0)
    , m_newTabAction(0)
    , m_closeTabAction(0)
    , m_nextTabAction(0)
    , m_previousTabAction(0)
    , m_recentlyClosedTabsMenu(0)
    , m_lineEditCompleter(0)
    , m_lineEdits(0)
    , m_tabBar(new TabBar(this))
{
    setElideMode(Qt::ElideRight);

    connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab()));
    connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
    connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
    connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
    connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
    connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
    connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(moveTab(int, int)));
    setTabBar(m_tabBar);

    // Actions
    m_newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this);
    m_newTabAction->setShortcuts(QKeySequence::AddTab);
    m_newTabAction->setIconVisibleInMenu(false);
    connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab()));

    m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this);
    m_closeTabAction->setShortcuts(QKeySequence::Close);
    m_closeTabAction->setIconVisibleInMenu(false);
    connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab()));

    m_nextTabAction = new QAction(tr("Show Next Tab"), this);
    QList<QKeySequence> shortcuts;
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketRight));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Less));
    m_nextTabAction->setShortcuts(shortcuts);
    connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab()));

    m_previousTabAction = new QAction(tr("Show Previous Tab"), this);
    shortcuts.clear();
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketLeft));
    shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Greater));
    m_previousTabAction->setShortcuts(shortcuts);
    connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab()));

    m_recentlyClosedTabsMenu = new QMenu(this);
    connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()),
            this, SLOT(aboutToShowRecentTabsMenu()));
    connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)),
            this, SLOT(aboutToShowRecentTriggeredAction(QAction *)));
    m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this);
    m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
    m_recentlyClosedTabsAction->setEnabled(false);

    // corner buttons
    QToolButton *addTabButton = new QToolButton(this);
    addTabButton->setDefaultAction(m_newTabAction);
    addTabButton->setAutoRaise(true);
    addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    setCornerWidget(addTabButton, Qt::TopLeftCorner);

    QToolButton *closeTabButton = new QToolButton(this);
    closeTabButton->setDefaultAction(m_closeTabAction);
    closeTabButton->setAutoRaise(true);
    closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    setCornerWidget(closeTabButton, Qt::TopRightCorner);

    connect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));

    m_lineEdits = new QStackedWidget(this);
}