Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/options/opt_theme.cpp b/src/options/opt_theme.cpp
- index 173b4473..027805f2 100644
- --- a/src/options/opt_theme.cpp
- +++ b/src/options/opt_theme.cpp
- @@ -59,10 +59,6 @@ QWidget *OptionsTabAppearanceTheme::widget()
- PsiThemeViewDelegate *vd = new PsiThemeViewDelegate(d->themeView);
- d->themeView->setItemDelegate(vd);
- d->themeView->setModel(themesModel);
- - int sw = provider->screenshotWidth();
- - if (sw) {
- - d->themeView->setFixedWidth(sw);
- - }
- connect(d->themeView->selectionModel(),
- SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- SIGNAL(dataChanged()));
- diff --git a/src/options/opt_theme.ui b/src/options/opt_theme.ui
- index e526e20d..955e8ab1 100644
- --- a/src/options/opt_theme.ui
- +++ b/src/options/opt_theme.ui
- @@ -19,19 +19,6 @@
- <item>
- <widget class="QListView" name="themeView"/>
- </item>
- - <item>
- - <spacer name="horizontalSpacer_2">
- - <property name="orientation">
- - <enum>Qt::Horizontal</enum>
- - </property>
- - <property name="sizeHint" stdset="0">
- - <size>
- - <width>40</width>
- - <height>20</height>
- - </size>
- - </property>
- - </spacer>
- - </item>
- </layout>
- </item>
- <item>
- diff --git a/src/psithememodel.cpp b/src/psithememodel.cpp
- index 9720b43a..5195929a 100644
- --- a/src/psithememodel.cpp
- +++ b/src/psithememodel.cpp
- @@ -125,6 +125,7 @@ void PsiThemeModel::setType(const QString &type)
- //endResetModel();
- }
- });
- + sort(Qt::AscendingOrder);
- }
- }
- }
- diff --git a/src/psithemeviewdelegate.cpp b/src/psithemeviewdelegate.cpp
- index 81e4e9e5..4ce83a8c 100644
- --- a/src/psithemeviewdelegate.cpp
- +++ b/src/psithemeviewdelegate.cpp
- @@ -31,6 +31,10 @@ void PsiThemeViewDelegate::paint(QPainter *painter,
- {
- QPixmap screenshot = index.data(PsiThemeModel::ScreenshotRole).value<QPixmap>();
- QPixmap texture = IconsetFactory::iconPixmap("psi/themeTitleTexture");
- + QPixmap statusIcon("://iconsets/system/default/ok.png");
- + bool isSelected = option.state & QStyle::State_Selected;
- + int statusIconW = isSelected ? 16 : 0;
- + int statusIconH = statusIconW;
- int texturew = texture.width();
- int textureh = texture.height();
- @@ -54,7 +58,7 @@ void PsiThemeViewDelegate::paint(QPainter *painter,
- QFontMetrics fm(f);
- QString text = index.data(PsiThemeModel::TitleRole).toString();
- QSize textSize = fm.size(Qt::TextSingleLine, text);
- - int tw = textSize.width() + 10;
- + int tw = textSize.width() + 10 + (isSelected ? statusIconW + 4: 0); //4 - icon offset
- int y = option.rect.top();
- int vw = option.rect.width();
- @@ -62,10 +66,11 @@ void PsiThemeViewDelegate::paint(QPainter *painter,
- painter->drawPixmap(vw - tw - texturew, y, texturew, textureh, texture);
- painter->drawPixmap(vw - tw, y, tw, textureh, texture.copy(texturew - 1, 0, 1, textureh).scaled(tw, textureh));
- -
- - painter->setPen(option.state & QStyle::State_Selected? Qt::white : QColor(170, 170, 170));
- + painter->setPen(isSelected ? Qt::white : QColor(170, 170, 170));
- QRect txtr(vw - tw, y, tw, textureh-5); // 5 shadow size?
- painter->drawText(txtr, Qt::AlignCenter, text);
- + if (statusIconW > 0)
- + painter->drawPixmap(vw - tw - 4, y, statusIconW, statusIconH, statusIcon); //4 - icon offset
- }
- QSize PsiThemeViewDelegate::sizeHint(const QStyleOptionViewItem &option,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement