Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/KisTemplatesPane.cpp
| Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 68 | Q_FOREACH (KisTemplate* t, group->templates()) { | |||
|---|---|---|---|---|---|
| 76 | icon = icon.copy((icon.width() - IconExtent) / 2, (icon.height() - IconExtent) / 2, IconExtent, IconExtent); | 76 | icon = icon.copy((icon.width() - IconExtent) / 2, (icon.height() - IconExtent) / 2, IconExtent, IconExtent); | ||
| 77 | QStandardItem* item = new QStandardItem(QPixmap::fromImage(icon), t->name()); | 77 | QStandardItem* item = new QStandardItem(QPixmap::fromImage(icon), t->name()); | ||
| 78 | item->setEditable(false); | 78 | item->setEditable(false); | ||
| 79 | item->setData(t->description(), Qt::UserRole); | 79 | item->setData(t->description(), Qt::UserRole); | ||
| 80 | item->setData(t->file(), Qt::UserRole + 1); | 80 | item->setData(t->file(), Qt::UserRole + 1); | ||
| 81 | item->setData(preview, Qt::UserRole + 2); | 81 | item->setData(preview, Qt::UserRole + 2); | ||
| 82 | rootItem->appendRow(item); | 82 | rootItem->appendRow(item); | ||
| 83 | 83 | | |||
| 84 | if (d->m_alwaysUseTemplate == t->file()) { | | |||
| 85 | selectItem = item; | | |||
| 86 | } | | |||
| 87 | else { | | |||
| 88 | if (templateFileInfo.exists()) { | 84 | if (templateFileInfo.exists()) { | ||
| 89 | if (!selectItem && (t->file() == fullTemplateName)) { | 85 | if (!selectItem && (t->file() == fullTemplateName)) { | ||
| 90 | selectItem = item; | 86 | selectItem = item; | ||
| 91 | } | 87 | } | ||
| 92 | } | 88 | } | ||
| 93 | else { | 89 | else { | ||
| 94 | if (!selectItem && QFileInfo(t->file()).fileName() == templateFileInfo.fileName()) { | 90 | if (!selectItem && QFileInfo(t->file()).fileName() == templateFileInfo.fileName()) { | ||
| 95 | selectItem = item; | 91 | selectItem = item; | ||
| 96 | } | 92 | } | ||
| 97 | } | 93 | } | ||
| 98 | } | | |||
| 99 | 94 | | |||
| 100 | if (defaultTemplate && (t->file() == defaultTemplate->file())) { | 95 | if (defaultTemplate && (t->file() == defaultTemplate->file())) { | ||
| 101 | defaultItem = item; | 96 | defaultItem = item; | ||
| 102 | } | 97 | } | ||
| 103 | } | 98 | } | ||
| 104 | 99 | | |||
| 105 | QModelIndex selectedIndex; | 100 | QModelIndex selectedIndex; | ||
| 106 | 101 | | |||
| ▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines | |||||