Example #1
0
ThemeConfig::ThemeConfig(QWidget *parent) :
    QWidget(parent)
{
    mConfig = KSharedConfig::openConfig(SDDM_CONFIG_FILE, KConfig::SimpleConfig);
    
    configUi = new Ui::ThemeConfig();
    configUi->setupUi(this);
    configUi->messageWidget->setVisible(false);

    ThemesModel *model = new ThemesModel(this);
    configUi->themesListView->setModel(model);

    ThemesDelegate *delegate = new ThemesDelegate(configUi->themesListView);
    delegate->setPreviewSize(QSize(128,128));
    configUi->themesListView->setItemDelegate(delegate);
    model->populate();
    connect(this, &ThemeConfig::themesChanged, model, &ThemesModel::populate);

    connect(configUi->themesListView, SIGNAL(activated(QModelIndex)), SLOT(themeSelected(QModelIndex)));
    connect(configUi->themesListView, SIGNAL(clicked(QModelIndex)), SLOT(themeSelected(QModelIndex)));
    connect(configUi->selectBackgroundButton, SIGNAL(imagePathChanged(QString)), SLOT(backgroundChanged(QString)));

    connect(configUi->getNewButton, &QPushButton::clicked, this, &ThemeConfig::getNewStuffClicked);
    connect(configUi->installFromFileButton, &QPushButton::clicked, this, &ThemeConfig::installFromFileClicked);
    connect(configUi->removeThemeButton, &QPushButton::clicked, this, &ThemeConfig::removeThemeClicked);


    prepareInitialTheme();
}
Example #2
0
void FrameSvgItem::setImagePath(const QString &path)
{
    if (m_frameSvg->imagePath() == path) {
        return;
    }

    updateDevicePixelRatio();
    m_frameSvg->setImagePath(path);
    m_frameSvg->setElementPrefix(m_prefix);

    if (implicitWidth() <= 0) {
        setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
    }

    if (implicitHeight() <= 0) {
        setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
    }

    emit imagePathChanged();
    m_margins->update();
    m_fixedMargins->update();

    if (isComponentComplete()) {
        m_frameSvg->resizeFrame(QSizeF(width(), height()));
        m_textureChanged = true;
        update();
    }
}
Example #3
0
void ImageLoader::handleReply(AbstractProcessor *processor)
{
    Q_D(ImageLoader);
    ImageProcessor *imageProcessor = qobject_cast<ImageProcessor *>(processor);
    QString imagePath = imageProcessor->imagePath();
    if (d->imagePath != imagePath) {
        d->imagePath = imagePath;
        emit imagePathChanged();
    }
}
Example #4
0
void SelectImageButton::setImagePath(const QString &imagePath) {
    m_imagePath = imagePath;

    QPixmap image(imagePath);
    if (! image.isNull()) {
        QIcon imageIcon;
        //scale oversized avatars to fit, but don't stretch smaller images
        imageIcon.addPixmap(image.scaled(iconSize().boundedTo(image.size()), Qt::KeepAspectRatio));
        setIcon(imageIcon);
    } else {
        setIcon(QIcon::fromTheme(QLatin1String("image-x-generic")));
    }
    Q_EMIT imagePathChanged(m_imagePath);
}
Example #5
0
void TweetDialog::setImagePath(const QString &imagePath)
{
    if (d->imagePath == imagePath) return;
    d->imagePath = imagePath;
    emit imagePathChanged(imagePath);
}