Exemplo n.º 1
0
/**
 * Loads the settings from \a config from section \a group.
 * Remembered properties are:
 *  - number of rows
 *  - minimum and maximum tab width
 *  - fixed tab height
 *  - button colors
 *  - much more!
 *  .
 * The original group is saved and restored at the end of this function.
 *
 * \note Call @p load() immediately after you created the tabbar, otherwise
 *       some properties might not be restored correctly (like highlighted
 *       buttons).
 */
void KTinyTabBar::load( KConfigBase* config, const QString& group )
{
    KConfigGroup cg( config, group );

    // tabbar properties
    setLocationTop    ( cg.readEntry( "location top", false ) );
    setNumRows        ( cg.readEntry( "count of rows", 1 ) );
    setMinimumTabWidth( cg.readEntry( "minimum width", 150 ) );
    setMaximumTabWidth( cg.readEntry( "maximum width", 300 ) );
    setTabHeight      ( cg.readEntry( "fixed height", 20 ) );
    setTabSortType    ( (SortType) cg.readEntry( "sort type", (int)OpeningOrder ) );
    setTabButtonStyle ( (ButtonStyle) cg.readEntry( "button style", (int)Push ) );
    setFollowCurrentTab(cg.readEntry("follow current tab", true ) );
    setHighlightModifiedTabs( cg.readEntry( "highlight modified", false ) );
    setHighlightPreviousTab( cg.readEntry( "highlight previous", false ) );
    setHighlightActiveTab( cg.readEntry( "highlight active", false ) );
    setHighlightOpacity(cg.readEntry( "highlight opacity", 20 ) );

    // color settings
    setModifiedTabsColor( cg.readEntry( "color modified", m_colorModifiedTab ) );
    setActiveTabColor( cg.readEntry( "color active", m_colorActiveTab ) );
    setPreviousTabColor( cg.readEntry( "color previous", m_colorPreviousTab ) );

    // highlighted entries
    QStringList documents = cg.readEntry( "highlighted documents", QStringList() );
    QStringList colors = cg.readEntry( "highlighted colors", QStringList() );

    // restore highlight map
    m_highlightedTabs.clear();
    for( int i = 0; i < documents.size() && i < colors.size(); ++i )
        m_highlightedTabs[documents[i]] = colors[i];

    setHighlightMarks( highlightMarks() );
}
Exemplo n.º 2
0
/**
 * Show configure dialog. If the button style changes the signal
 * @p tabButtonStyleChanged() will be emitted.
 */
void KTinyTabBar::configureClicked()
{
    m_configureButton->setActivated( false );

    KTinyTabBarConfigDialog dlg( this, (QWidget*)parent() );
    dlg.setObjectName( "tabbar_config_dialog" );
    if( dlg.exec() == KDialog::Accepted )
    {
        KTinyTabBarConfigPage* page = dlg.configPage();

        setLocationTop( page->locationTop() );
        setNumRows( page->numberOfRows() );
        setMinimumTabWidth( page->minimumTabWidth() );
        setMaximumTabWidth( page->maximumTabWidth() );
        setTabHeight( page->fixedTabHeight() );
        setTabSortType( page->tabSortType() );
        setTabButtonStyle( page->tabButtonStyle() );
        setFollowCurrentTab( page->followCurrentTab() );
        setHighlightModifiedTabs( page->highlightModifiedTabs() );
        setHighlightActiveTab( page->highlightActiveTab() );
        setHighlightPreviousTab( page->highlightPreviousTab() );
        setModifiedTabsColor( page->modifiedTabsColor() );
        setActiveTabColor( page->activeTabColor() );
        setPreviousTabColor( page->previousTabColor() );
        setHighlightOpacity( page->highlightOpacity() );

        emit settingsChanged( this );
    }
}
void TabWidgetManager::button6Clicked()
{
    ui->button4->setEnabled(false);
    ui->button5->setEnabled(false);
    ui->button6->setEnabled(true);
    setTabButtonStyle(6);
}
void TabWidgetManager::button8Clicked()
{
    ui->button7->setEnabled(false);
    ui->button8->setEnabled(true);
    setTabButtonStyle(8);
}
void TabWidgetManager::button3Clicked()
{
    emit my_close();
    setTabButtonStyle(3);
}
void TabWidgetManager::button2Clicked()
{
    ui->button2->setEnabled(true);
    ui->button1->setEnabled(false);
    setTabButtonStyle(2);
}