r21302 by craig -
scribus-commit
scribus-commit at lists.scribus.net
Thu May 12 19:38:54 UTC 2016
Author: craig
Date: Thu May 12 19:38:54 2016
New Revision: 21302
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21302
Log:
Show installed palettes in the Resource Manager
Modified:
trunk/Scribus/scribus/ui/resourcemanager.cpp
Modified: trunk/Scribus/scribus/ui/resourcemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21302&path=/trunk/Scribus/scribus/ui/resourcemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/resourcemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/resourcemanager.cpp Thu May 12 19:38:54 2016
@@ -215,7 +215,41 @@
void ResourceManager::updateInstalledPalettes()
{
dictionaryMap.clear();
+ QString palDir(findDestinationFolder());
+ foreach(DownloadItem d, availableList)
+ {
+ if (QFileInfo::exists(palDir+d.files))
+ dictionaryMap.insert(d.desc, palDir+d.files);
+ }
+
installedTableWidget->clear();
+ installedTableWidget->setRowCount(dictionaryMap.count());
+ installedTableWidget->setColumnCount(2);
+ installedTableWidget->setSortingEnabled(false);
+ if (dictionaryMap.count()>0)
+ {
+ QMapIterator<QString, QString> i(dictionaryMap);
+ int row=0;
+ while (i.hasNext())
+ {
+ i.next();
+ int column=0;
+ QTableWidgetItem *newItem1 = new QTableWidgetItem(i.key());
+ newItem1->setFlags(newItem1->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable);
+ installedTableWidget->setItem(row, column++, newItem1);
+ QTableWidgetItem *newItem2 = new QTableWidgetItem(i.value());
+ newItem2->setFlags(newItem1->flags());
+ installedTableWidget->setItem(row, column++, newItem2);
+ ++row;
+ }
+ }
+ QStringList headers;
+ headers << tr("Description") << tr("Location") ;
+ installedTableWidget->setHorizontalHeaderLabels(headers);
+
+ installedTableWidget->resizeColumnsToContents();
+ installedTableWidget->setSortingEnabled(true);
+ installedTableWidget->sortByColumn(0, Qt::AscendingOrder);
}
void ResourceManager::updateInstalledTest()
@@ -699,7 +733,7 @@
newItem2->setFlags(newItem1->flags());
availableTableWidget->setItem(row, column++, newItem2);
QTableWidgetItem *newItem3 = new QTableWidgetItem();
- newItem3->setCheckState(dictionaryMap.contains(d.lang) ? Qt::Checked : Qt::Unchecked);
+ newItem3->setCheckState(dictionaryMap.contains(d.files) ? Qt::Checked : Qt::Unchecked);
newItem3->setFlags(newItem1->flags() & ~Qt::ItemIsUserCheckable);
availableTableWidget->setItem(row, column++, newItem3);
QTableWidgetItem *newItem4 = new QTableWidgetItem(d.license);
@@ -784,8 +818,8 @@
updateAvailableHelp();
break;
case RM_PALETTES:
+ updateAvailablePalettes();
updateInstalledPalettes();
- updateAvailablePalettes();
break;
case RM_TEST:
updateInstalledTest();
More information about the scribus-commit
mailing list