Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0ea20bb2 authored by Laurent Montel's avatar Laurent Montel 😁

Const'ref

parent 524fcbd0
......@@ -23,7 +23,7 @@
#include <KLocalizedString>
KHMTheme::KHMTheme( QString name, QString uiName, QString svgFileName, QString author, QString themeVersion,
KHMTheme::KHMTheme( const QString &name, const QString &uiName, const QString &svgFileName, const QString &author, const QString &themeVersion,
QRect wordRect, QRect hintRect, QRect kRect,
QColor letterColor, QColor guessButtonTextColor, QColor guessButtonColor, QColor guessButtonHoverColor, QColor letterInputTextColor,
QPoint goodWordPos)
......
......@@ -32,7 +32,7 @@ class KHMTheme
QPoint KHMgoodWordPos;
public:
KHMTheme( QString name, QString uiName, QString svgFileName, QString author, QString themeVersion,
KHMTheme( const QString &name, const QString &uiName, const QString &svgFileName, const QString &author, const QString &themeVersion,
QRect wordRect, QRect hintRect, QRect kRect,
QColor letterColor, QColor guessButtonTextColor, QColor guessButtonColor, QColor guessButtonHoverColor, QColor letterInputTextColor,
QPoint goodWordPos);
......
......@@ -24,7 +24,7 @@ KHMThemeFactory::KHMThemeFactory()
{
}
bool KHMThemeFactory::addTheme(QString themeFile)
bool KHMThemeFactory::addTheme(const QString &themeFile)
{
QFile file (themeFile);
QDomDocument tree(QStringLiteral("KHangManTheme")); //do we need it?
......@@ -66,7 +66,7 @@ bool KHMThemeFactory::addTheme(QString themeFile)
return true;
}
void KHMThemeFactory::walkDirectory(QDir dir) //unused! (but works)
void KHMThemeFactory::walkDirectory(const QDir &dir) //unused! (but works)
{
QFileInfoList xmlFilesList;
QStringList allowedExtenstion(QStringLiteral("*.xml"));
......@@ -113,7 +113,7 @@ KHMTheme * KHMThemeFactory::buildTheme (int id)
return 0;
}
QRect KHMThemeFactory::makeRect(QDomElement element, QString propertyName)
QRect KHMThemeFactory::makeRect(const QDomElement &element, const QString &propertyName)
{
QDomElement rect=element.firstChildElement(propertyName);
......@@ -125,21 +125,21 @@ QRect KHMThemeFactory::makeRect(QDomElement element, QString propertyName)
);
}
QColor KHMThemeFactory::getColor(QDomElement element, QString propertyName)
QColor KHMThemeFactory::getColor(const QDomElement &element, const QString &propertyName)
{
QDomElement color=element.firstChildElement(propertyName);
return QColor ( color.attribute(QStringLiteral("r")).toInt(), color.attribute(QStringLiteral("g")).toInt(), color.attribute(QStringLiteral("b")).toInt());
}
bool KHMThemeFactory::checkTheme(QDomElement root, QString themeVersion)
bool KHMThemeFactory::checkTheme(const QDomElement &root, const QString &themeVersion)
{
QString rootName=root.tagName();
return (rootName.compare(QLatin1String("KHangManThemes"))==0) && (themeVersion.compare(root.attribute(QStringLiteral("version")))==0);
}
void KHMThemeFactory::doTheme(QDomElement theme, QString version) //fetch all the properties from .xml and stick it together
void KHMThemeFactory::doTheme(const QDomElement &theme, const QString &version) //fetch all the properties from .xml and stick it together
//"theme" means <theme></theme> section
{
QDomElement coords=theme.firstChildElement(QStringLiteral("coords"));
......
......@@ -37,8 +37,8 @@ public:
KHMThemeFactory();
~KHMThemeFactory();
bool addTheme(QString filePath); //returns "true" if theme has been added successfully, "false" otherwise
void walkDirectory(QDir dir); //walks the directory loads valid themes files. No recursion
bool addTheme(const QString &filePath); //returns "true" if theme has been added successfully, "false" otherwise
void walkDirectory(const QDir &dir); //walks the directory loads valid themes files. No recursion
int getQty() const; //returns quantity of list
QStringList getNames(); //returns short names(worknames) of all the themes
......@@ -48,10 +48,10 @@ public:
private:
QList<KHMTheme> themesList;
QRect makeRect(QDomElement element, QString propertyName);
QColor getColor(QDomElement element, QString propertyName);
bool checkTheme(QDomElement root, QString themeVersion);
void doTheme(QDomElement theme, QString version);
QRect makeRect(const QDomElement &element, const QString &propertyName);
QColor getColor(const QDomElement &element, const QString &propertyName);
bool checkTheme(const QDomElement &root, const QString &themeVersion);
void doTheme(const QDomElement &theme, const QString &version);
};
#endif // KHMTHEMEFACTORY_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment