⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 klearlook.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			if (hue < 60)			b = m1 + (m2 - m1) * hue / 60;		else if (hue < 180)			b = m2;		else if (hue < 240)			b = m1 + (m2 - m1) * (240 - hue) / 60;		else			b = m1;			*h = r;		*l = g;		*s = b;	}}static bool equal( double d1, double d2 ) {    return ( fabs( d1 - d2 ) < 0.0001 );}static void shade( const QColor &a, QColor *b, float k ) {    if ( equal( k, 1.0 ) )        * b = a;    else {        double red = a.red() / 256.0,               green = a.green() / 256.0,               blue = a.blue() / 256.0;        rgb2hls( &red, &green, &blue );        green *= k;        if ( green > 1.0 )            green = 1.0;        else if ( green < 0.0 )            green = 0.0;        blue *= k;        if ( blue > 1.0 )            blue = 1.0;        else if ( blue < 0.0 )            blue = 0.0;        hls2rgb( &red, &green, &blue );        b->setRgb( limit( red * 256 ), limit( green * 256 ), limit( blue * 256 ) );    }}static void shadeGradient( const QColor &base, QColor *vals ) {    vals[ KlearlookStyle::GRADIENT_BASE ] = base;        shade( vals[ KlearlookStyle::GRADIENT_BASE ],        &( vals[ KlearlookStyle::GRADIENT_TOP ] ), SHADE_GRADIENT_TOP );            shade( vals[ KlearlookStyle::GRADIENT_BASE ],        &( vals[ KlearlookStyle::GRADIENT_BOTTOM ] ), SHADE_GRADIENT_BOTTOM );            shade( vals[ KlearlookStyle::GRADIENT_BASE ],        &( vals[ KlearlookStyle::GRADIENT_LIGHT ] ), SHADE_GRADIENT_LIGHT );    shade( vals[ KlearlookStyle::GRADIENT_BASE ],        &( vals[ KlearlookStyle::GRADIENT_DARK ] ), SHADE_GRADIENT_DARK );}static void drawLines( QPainter *p, const QRect &r, bool horiz, int nLines, int offset, const QColor *cols,                       int startOffset, bool etched, bool lightGradient ) {    int space = ( nLines * 2 ) + ( nLines - 1 ),                x = horiz ? r.x() : r.x() + ( ( r.width() - space ) >> 1 ),                    y = horiz ? r.y() + ( ( r.height() - space ) >> 1 ) : r.y(),                        x2 = r.x() + r.width() - 1,                             y2 = r.y() + r.height() - 1,                                  i,                                  displacement = etched ? 1 : 0;    if ( horiz ) {        if ( startOffset && y + startOffset > 0 )            y += startOffset;	p->setPen( cols[ etched ? lightGradient ? 3 : 4 : 0 ] );        for ( i = 0; i < space; i += 3 )            p->drawLine( x + offset, y + i, x2 - ( offset + displacement ), y + i );        p->setPen( cols[ etched ? 0 : lightGradient ? 3 : 4 ] );        for ( i = 1; i < space; i += 3 )            p->drawLine( x + offset + displacement, y + i - 2, x2 - offset, y + i  - 2);    } else {        if ( startOffset && x + startOffset > 0 )            x += startOffset;	p->setPen( cols[ etched ? lightGradient ? 3 : 4 : 0 ] );        for ( i = 0; i < space; i += 3 )            p->drawLine( x + i, y + offset, x + i, y2 - ( offset + displacement ) );        p->setPen( cols[ etched ? 0 : lightGradient ? 3 : 4 ] );        for ( i = 1; i < space; i += 3 )            p->drawLine( x + i -2, y + offset + displacement, x + i -2, y2 - offset );    }}inline QColor getFill( QStyle::SFlags flags, const QColor *use ) {    return !( flags & QStyle::Style_Enabled )           ? use[ 1 ]           : flags & QStyle::Style_Down           ? use[ 3 ]           : flags & QStyle::Style_MouseOver           ? flags & ( QStyle::Style_On | QStyle::Style_Sunken )           ? use[ 3 ].light( QTC_HIGHLIGHT_FACTOR )           : use[ NUM_SHADES ].light( QTC_HIGHLIGHT_FACTOR )                   : flags & ( QStyle::Style_On | QStyle::Style_Sunken )                   ? use[ 3 ]                   : use[ NUM_SHADES ];}#ifdef USE_SINGLE_STYLEKlearlookStyle::KlearlookStyle()#elseKlearlookStyle::KlearlookStyle(    bool gpm, bool bb, bool bf, bool round, EGroove st, h,    bool ge, bool va, bool bdt, bool crlh, EDefBtnIndicator dbi, ETBarBorder tbb,    ELvExpander lve, ELvLines lvl, bool lvd, bool ico, int popuplvl ) )#endif: KStyle( AllowMenuTransparency, WindowsStyleScrollBar ),themedApp( APP_OTHER ),#ifndef USE_SINGLE_STYLEborderButton( bb ), borderFrame( bf ), rounded( round ), etchedSlider( etched ), appearance( ge ? APPEARANCE_GRADIENT : APPEARANCE_FLAT ),pmProfile( PROFILE_SUNKEN ), vArrow( va ), boldDefText( bdt ), crLabelHighlight( crlh ), lvDark( lvd ),defBtnIndicator( dbi ), sliderThumbs( st ), handles( h ), toolbarBorders( tbb ), lvExpander( lve ), lvLines( lvl ), menuIcons( ico ), borderSplitter( true ), popupmenuHighlightLevel(popuplvl)#endif#if KDE_VERSION >= 0x30200isTransKicker( false ),#endifhover( HOVER_NONE ),oldCursor( -1, -1 ),formMode( false ),hoverWidget( NULL ),hoverSect( QTC_NO_SECT ) {    QSettings s;    contrast = s.readNumEntry( "/Qt/KDE/contrast", 7 );    if ( contrast < 0 || contrast > 10 )        contrast = 7;#ifdef USE_SINGLE_STYLE    borderButton = borderFrame = s.readBoolEntry( "/klearlookstyle/Settings/border", true );    rounded = borderButton ? s.readBoolEntry( "/klearlookstyle/Settings/round", true ) : false;    menuIcons = s.readBoolEntry( "/klearlookstyle/Settings/icons", true );    darkMenubar = s.readBoolEntry( "/klearlookstyle/Settings/darkMenubar", true );    popupmenuHighlightLevel = s.readNumEntry( "/klearlookstyle/Settings/popupmenuHighlightLevel", 3);    QString tmp = s.readEntry( "/klearlookstyle/Settings/toolbarBorders", QString::null );    toolbarBorders = tmp.isEmpty()                     ? TB_LIGHT                     : qtc_to_tbar_border( tmp.latin1() );    bool etched = s.readBoolEntry( "/klearlookstyle/Settings/etched", true );    tmp = s.readEntry( "/klearlookstyle/Settings/sliderThumbs", QString::null );    sliderThumbs = tmp.isEmpty()                   ? etched ? GROOVE_SUNKEN : GROOVE_RAISED               : qtc_to_groove( tmp.latin1() );    tmp = s.readEntry( "/klearlookstyle/Settings/lvExpander", QString::null );    lvExpander = tmp.isEmpty()                 ? LV_EXP_ARR                 : qtc_to_lv_expander( tmp.latin1() );    tmp = s.readEntry( "/klearlookstyle/Settings/lvLines", QString::null );    lvLines = tmp.isEmpty()              ? LV_LINES_SOLID              : qtc_to_lv_lines( tmp.latin1() );                      lvDark = s.readBoolEntry( "/klearlookstyle/Settings/lvDark", false );    handles = qtc_to_groove( s.readEntry( "/klearlookstyle/Settings/sliderThumbs", DEF_HANDLE_STR ).latin1() );        if ( GROOVE_NONE == handles )        handles = GROOVE_RAISED;            appearance = qtc_to_appearance(        s.readEntry( "/klearlookstyle/Settings/appearance", DEF_APPEARANCE_STR ).latin1() );    pmProfile = qtc_to_profile( s.readEntry( "/klearlookstyle/Settings/pm", DEF_PROFILE_STR ).latin1() );    vArrow = s.readBoolEntry( "/klearlookstyle/Settings/vArrow", false );    boldDefText = s.readBoolEntry( "/klearlookstyle/Settings/embolden", false );    crLabelHighlight = s.readBoolEntry( "/klearlookstyle/Settings/crLabelHighlight", false );    defBtnIndicator = qtc_to_ind(        s.readEntry( "/klearlookstyle/Settings/defBtnIndicator", DEF_IND_STR ).latin1() );            //if(!boldDefText && IND_NONE==defBtnIndicator)    //    defBtnIndicator=IND_CORNER;        borderSplitter = s.readBoolEntry( "/klearlookstyle/Settings/borderSplitter", false );#endif    if ( PROFILE_RAISED != pmProfile )        shadeColors( qApp->palette().active().highlight(), menuPbar );    else        shadeGradient( qApp->palette().active().highlight(), menuPbar );    shadeColors( qApp->palette().active().background(), gray );    shadeColors( qApp->palette().active().button(), button );}void KlearlookStyle::polish( QApplication *app ) {    if ( !qstrcmp( app->argv() [ 0 ], "kicker" ) || !qstrcmp( app->argv() [ 0 ], "appletproxy" ) ) {        themedApp = APP_KICKER;#if KDE_VERSION >= 0x30200        isTransKicker = rounded && kickerIsTrans();#endif    } else if ( !qstrcmp( app->argv() [ 0 ], "korn" ) ) {        themedApp = APP_KORN;#if KDE_VERSION >= 0x30200        isTransKicker = rounded && kickerIsTrans();#endif    } else        themedApp = qstrcmp( qApp->argv() [ 0 ], "soffice.bin" ) ? APP_OTHER : APP_OPENOFFICE;}void KlearlookStyle::polish( QPalette &pal ) {    int c = QSettings().readNumEntry( "/Qt/KDE/contrast", 7 );    bool newContrast = false;    if ( c < 0 || c > 10 )        c = 7;    if ( c != contrast ) {        contrast = c;        newContrast = true;    }    if ( newContrast || gray[ NUM_SHADES ] != qApp->palette().active().background() )        shadeColors( qApp->palette().active().background(), gray );    if ( newContrast || button[ NUM_SHADES ] != qApp->palette().active().button() )        shadeColors( qApp->palette().active().button(), button );    if ( PROFILE_RAISED == pmProfile ) {        if ( newContrast || menuPbar[ NUM_SHADES ] != qApp->palette().active().highlight() )            shadeColors( qApp->palette().active().highlight(), menuPbar );    } else        if ( qApp->palette().active().highlight() != menuPbar[ GRADIENT_BASE ] )            shadeGradient( qApp->palette().active().highlight(), menuPbar );    const QColorGroup &actGroup = pal.active(),                                  &inactGroup = pal.inactive();    const QColor *use = backgroundColors( actGroup );    QColorGroup newAct( actGroup.foreground(), actGroup.button(),        use[ 0 ], use[ 5 ], actGroup.mid(), actGroup.text(),        actGroup.brightText(), actGroup.base(), actGroup.background() );    newAct.setColor( QColorGroup::Highlight, actGroup.color( QColorGroup::Highlight ) );    pal.setActive( newAct );    use = backgroundColors( inactGroup );    QColorGroup newInact( inactGroup.foreground(), inactGroup.button(),        use[ 0 ], use[ 5 ], inactGroup.mid(), inactGroup.text(),        inactGroup.brightText(), inactGroup.base(), inactGroup.background() );    newInact.setColor( QColorGroup::Highlight, inactGroup.color( QColorGroup::Highlight ) );    pal.setInactive( newInact );}static const char * kdeToolbarWidget = "kde toolbar widget";void KlearlookStyle::polish( QWidget *widget ) {    if ( ::qt_cast<QRadioButton *>( widget )      || ::qt_cast<QCheckBox *>( widget )      || ::qt_cast<QSpinWidget *>( widget )      || widget->inherits( "QSplitterHandle" ) ) {#if QT_VERSION >= 0x030200        widget->setMouseTracking( true );#endif        widget->installEventFilter( this );    } else if ( ::qt_cast<QButton *>( widget ) || ::qt_cast<QComboBox *>( widget ) ||                widget->inherits( "QToolBarExtensionWidget" ) ) {        widget->setBackgroundMode( QWidget::PaletteBackground );        widget->installEventFilter( this );            } else if ( ::qt_cast<QMenuBar *>( widget )             || ::qt_cast<QToolBar *>( widget )             || ::qt_cast<QPopupMenu *>( widget ) )        widget->setBackgroundMode( QWidget::PaletteBackground );            else if ( widget->inherits( "KToolBarSeparator" ) ) {        widget->setBackgroundMode( QWidget::NoBackground );        widget->installEventFilter( this );            } else if ( ::qt_cast<QScrollBar *>( widget ) ) {        widget->setMouseTracking( true );        widget->installEventFilter( this );        widget->setBackgroundMode( QWidget::NoBackground );            } else if ( ::qt_cast<QSlider *>( widget ) || ::qt_cast<QHeader *>( widget ) ) {        widget->setMouseTracking( true );        widget->installEventFilter( this );            } else if ( 0 == qstrcmp( widget->name(), kdeToolbarWidget ) ) {        widget->installEventFilter( this );        widget->setBackgroundMode( QWidget::NoBackground );  // We paint the whole background.    }    KStyle::polish( widget );}void KlearlookStyle::unPolish( QWidget *widget ) {    if ( ::qt_cast<QRadioButton *>( widget ) ||         ::qt_cast<QCheckBox *>( widget ) ||         ::qt_cast<QSpinWidget *>( widget ) ||            widget->inherits( "QSplitterHandle" ) ) {#if QT_VERSION >= 0x030200        widget->setMouseTracking( false );#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -