- enhancement: new sky blue icon set, contributed by Alan-CRL

This commit is contained in:
Roy Qu 2022-01-30 00:22:49 +08:00
parent 428a079b7f
commit fffa210a69
5 changed files with 67 additions and 5 deletions

View File

@ -1,3 +1,12 @@
## Contributor of Icons
beanflame@github
XiaoLoong@github
- beanflame@github
- XiaoLoong@github
### devcpp.svg
author: beanflame@github
### Icon set Blue Sky
author: Alan-CRL

View File

@ -3,6 +3,8 @@ Red Panda C++ Version 0.14.1
- fix: failed to show function tip, when there are parameters having '[' and ']'
- enhancement: display localized theme name in the option dialog
- enhancement: show custom theme folder in options dialog -> enviroment -> folders
- enhancement: display localzed icon set name in the option dialog
- enhancement: new sky blue icon set, contributed by Alan-CRL
Red Panda C++ Version 0.14.0
- enhancement: custom icon set ( in the configuration folder)

View File

@ -24,6 +24,9 @@
#include <QPushButton>
#include <QFile>
#include <QDir>
#include <QDirIterator>
#include <QJsonDocument>
#include <QJsonObject>
#include "utils.h"
#include "settings.h"
@ -293,3 +296,33 @@ void IconsManager::setIconSetsFolder(const QString &newIconSetsFolder)
{
mIconSetsFolder = newIconSetsFolder;
}
QList<PIconSet> IconsManager::listIconSets()
{
QDirIterator dirIter(iconSetsFolder());
QList<PIconSet> result;
while(dirIter.hasNext()) {
dirIter.next();
QFileInfo fileInfo = dirIter.fileInfo();
if (!fileInfo.isHidden() && fileInfo.isDir()) {
PIconSet pSet = std::make_shared<IconSet>();
pSet->name = fileInfo.baseName();
pSet->displayName = pSet->name;
QFile infoFile(includeTrailingPathDelimiter(fileInfo.absoluteFilePath())+"info.json");
if (infoFile.exists() && infoFile.open(QFile::ReadOnly)) {
QByteArray content = infoFile.readAll();
QJsonParseError error;
QJsonDocument doc(QJsonDocument::fromJson(content,&error));
if (error.error == QJsonParseError::NoError) {
QJsonObject obj=doc.object();
pSet->displayName = obj["name"].toString();
QString localeName = obj["name_"+pSettings->environment().language()].toString();
if (!localeName.isEmpty())
pSet->displayName = localeName;
}
}
result.append(pSet);
}
}
return result;
}

View File

@ -23,6 +23,13 @@
#include <memory>
#include "parser/parserutils.h"
struct IconSet {
QString name;
QString displayName;
};
using PIconSet = std::shared_ptr<IconSet>;
class QToolButton;
class QPushButton;
class IconsManager : public QObject
@ -170,6 +177,8 @@ public:
const QString iconSetsFolder() const;
void setIconSetsFolder(const QString &newIconSetsFolder);
QList<PIconSet> listIconSets();
signals:
void actionIconsUpdated();
private:

View File

@ -22,6 +22,7 @@
#include "../settings.h"
#include "../mainwindow.h"
#include "../thememanager.h"
#include "../iconsmanager.h"
EnvironmentAppearenceWidget::EnvironmentAppearenceWidget(const QString& name, const QString& group, QWidget *parent) :
SettingsWidget(name,group,parent),
@ -45,7 +46,12 @@ void EnvironmentAppearenceWidget::doLoad()
}
ui->cbFont->setCurrentFont(QFont(pSettings->environment().interfaceFont()));
ui->spinFontSize->setValue(pSettings->environment().interfaceFontSize());
ui->cbIconSet->setCurrentText(pSettings->environment().iconSet());
for (int i=0; i<ui->cbIconSet->count();i++) {
if (ui->cbIconSet->itemData(i) == pSettings->environment().iconSet()) {
ui->cbIconSet->setCurrentIndex(i);
break;
}
}
ui->chkUseCustomIconSet->setChecked(pSettings->environment().useCustomIconSet());
ui->chkUseCustomTheme->setChecked(pSettings->environment().useCustomTheme());
@ -71,7 +77,7 @@ void EnvironmentAppearenceWidget::doSave()
pSettings->environment().setInterfaceFont(ui->cbFont->currentFont().family());
pSettings->environment().setInterfaceFontSize(ui->spinFontSize->value());
pSettings->environment().setLanguage(ui->cbLanguage->currentData().toString());
pSettings->environment().setIconSet(ui->cbIconSet->currentText());
pSettings->environment().setIconSet(ui->cbIconSet->currentData().toString());
pSettings->environment().setUseCustomIconSet(ui->chkUseCustomIconSet->isChecked());
pSettings->environment().setUseCustomTheme(ui->chkUseCustomTheme->isChecked());
@ -89,6 +95,9 @@ void EnvironmentAppearenceWidget::init()
}
ui->cbLanguage->addItem(tr("English"),"en");
ui->cbLanguage->addItem(tr("Simplified Chinese"),"zh_CN");
ui->cbIconSet->addItem("newlook");
QList<PIconSet> iconSets = pIconsManager->listIconSets();
foreach(const PIconSet& iconSet, iconSets) {
ui->cbIconSet->addItem(iconSet->displayName,iconSet->name);
}
SettingsWidget::init();
}