//________________________________________________________
    bool Configuration::operator == (const Configuration& other ) const
    {

        return
            titleAlignment() == other.titleAlignment() &&
            centerTitleOnFullWidth() == other.centerTitleOnFullWidth() &&
            buttonSize() == other.buttonSize() &&
            frameBorder() == other.frameBorder() &&
            blendColor() == other.blendColor() &&
            sizeGripMode() == other.sizeGripMode() &&
            backgroundOpacity() == other.backgroundOpacity()&&
            separatorMode() == other.separatorMode() &&
            drawTitleOutline() == other.drawTitleOutline() &&
            hideTitleBar() == other.hideTitleBar() &&
            useDropShadows() == other.useDropShadows() &&
            useOxygenShadows() == other.useOxygenShadows() &&
            closeFromMenuButton() == other.closeFromMenuButton() &&
            transparencyEnabled() == other.transparencyEnabled() &&
            useNarrowButtonSpacing() == other.useNarrowButtonSpacing() &&
            useExtendedWindowBorder() == other.useExtendedWindowBorder() &&
            opacityFromStyle() == other.opacityFromStyle() &&
            backgroundOpacity() == other.backgroundOpacity() &&
            animationsEnabled() == other.animationsEnabled() &&
            buttonAnimationsEnabled() == other.buttonAnimationsEnabled() &&
            titleAnimationsEnabled() == other.titleAnimationsEnabled() &&
            shadowAnimationsEnabled() == other.shadowAnimationsEnabled() &&
            tabAnimationsEnabled() == other.tabAnimationsEnabled() &&
            buttonAnimationsDuration() == other.buttonAnimationsDuration() &&
            titleAnimationsDuration() == other.titleAnimationsDuration() &&
            shadowAnimationsDuration() == other.shadowAnimationsDuration() &&
            tabAnimationsDuration() == other.tabAnimationsDuration();

    }
Ejemplo n.º 2
0
ProgressUI::ProgressUI(QWidget *parent)
    : THWidgetBase(parent)
{
    timerId = -1;
    gradient = 0;
    hideTitleBar();
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool);
    setWindowModality(Qt::ApplicationModal);

    QVBoxLayout *v = new QVBoxLayout(this);
    v->setContentsMargins(5, 5, 5, 5);
    v->setSpacing(0);
    lbl = new QLabel(this);
    lbl->setStyleSheet(QStringLiteral("font-family:΢ÈíÑźÚ;font:12px;color:white;"));
    QProgressBar *pbar = new QProgressBar(this);
    pbar->setRange(0, 100);
    pbar->setValue(0);
    pbar->setFixedSize(260, 12);
    QFile file;
    file.setFileName(":res/css/progressbar.css");
    if (file.open(QIODevice::ReadOnly))
    {
        QByteArray ba = file.readAll();
        pbar->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba));
    }
    file.close();
    v->addWidget(lbl, 1, Qt::AlignCenter);
    v->addWidget(pbar, 1, Qt::AlignCenter);
    setFixedSize(280, 50);

    connect(this, &ProgressUI::setValue, pbar, [=] (int value) {
        pbar->setValue(value);
        if (pbar->value() >= 100)
        {
            lbl->setText(QStringLiteral("Íê³É"));
            emit execFinished();
            QTimer::singleShot(1000, this, [=] () {
                disconnect(this, 0, 0, 0);
                this->close();
                this->deleteLater();
            });
        }
    });

    timerId = startTimer(60/*, Qt::VeryCoarseTimer*/);


}
    //__________________________________________________
    void Configuration::write( KConfigGroup& group ) const
    {

        Configuration defaultConfiguration;

        if( titleAlignment() != defaultConfiguration.titleAlignment() ) group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
        if( centerTitleOnFullWidth() != defaultConfiguration.centerTitleOnFullWidth() ) group.writeEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH, centerTitleOnFullWidth() );
        if( buttonSize() != defaultConfiguration.buttonSize() ) group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
        if( blendColor() != defaultConfiguration.blendColor() ) group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
        if( frameBorder() != defaultConfiguration.frameBorder() ) group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
        if( sizeGripMode() != defaultConfiguration.sizeGripMode() ) group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );

        if( backgroundOpacity() != defaultConfiguration.backgroundOpacity() ) group.writeEntry( OxygenConfig::BACKGROUND_OPACITY, backgroundOpacity() );
        if( opacityFromStyle() != defaultConfiguration.opacityFromStyle() ) group.writeEntry( OxygenConfig::OPACITY_FROM_STYLE, opacityFromStyle() );

        if( separatorMode() != defaultConfiguration.separatorMode() )
        {
            group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever );
            group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive );
        }

        if( drawTitleOutline() != defaultConfiguration.drawTitleOutline() ) group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
        if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
        if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
        if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
        if( closeFromMenuButton() != defaultConfiguration.closeFromMenuButton() ) group.writeEntry( OxygenConfig::CLOSE_FROM_MENU_BUTTON, closeFromMenuButton() );
        if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
        if( useExtendedWindowBorder() != defaultConfiguration.useExtendedWindowBorder() ) group.writeEntry( OxygenConfig::EXTENDED_WINDOW_BORDERS, useExtendedWindowBorder() );

        // animations
        if( animationsEnabled() != defaultConfiguration.animationsEnabled() ) group.writeEntry( OxygenConfig::ANIMATIONS_ENABLED, animationsEnabled() );
        if( buttonAnimationsEnabled() != defaultConfiguration.buttonAnimationsEnabled() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_ENABLED, buttonAnimationsEnabled() );
        if( titleAnimationsEnabled() != defaultConfiguration.titleAnimationsEnabled() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_ENABLED, titleAnimationsEnabled() );
        if( shadowAnimationsEnabled() != defaultConfiguration.shadowAnimationsEnabled() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_ENABLED, shadowAnimationsEnabled() );
        if( tabAnimationsEnabled() != defaultConfiguration.tabAnimationsEnabled() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_ENABLED, tabAnimationsEnabled() );

        // animations duration
        if( buttonAnimationsDuration() != defaultConfiguration.buttonAnimationsDuration() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_DURATION, buttonAnimationsDuration() );
        if( titleAnimationsDuration() != defaultConfiguration.titleAnimationsDuration() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_DURATION, titleAnimationsDuration() );
        if( shadowAnimationsDuration() != defaultConfiguration.shadowAnimationsDuration() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_DURATION, shadowAnimationsDuration() );
        if( tabAnimationsDuration() != defaultConfiguration.tabAnimationsDuration() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_DURATION, tabAnimationsDuration() );

    }