Hello community,
here is the log from the commit of package libkmahjongg for openSUSE:Factory checked in at 2016-08-31 00:09:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkmahjongg (Old)
and /work/SRC/openSUSE:Factory/.libkmahjongg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libkmahjongg"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libkmahjongg/libkmahjongg.changes 2016-07-24 19:49:14.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libkmahjongg.new/libkmahjongg.changes 2016-08-31 00:09:03.000000000 +0200
@@ -1,0 +2,16 @@
+Fri Aug 12 10:29:46 UTC 2016 - tittiatcoke@gmail.com
+
+- Update to KDE Applications 16.08.0
+ * KDE Applications 16.08.0
+ * https://www.kde.org/announcements/announce-applications-16.08.0.php
+
+
+-------------------------------------------------------------------
+Mon Aug 8 15:44:48 UTC 2016 - tittiatcoke@gmail.com
+
+- Update to KDE Applications 16.07.90
+ * KDE Applications 16.07.90 (16.08-RC)
+ * https://www.kde.org/announcements/announce-applications-16.07.90.php
+
+
+-------------------------------------------------------------------
Old:
----
libkmahjongg-16.04.3.tar.xz
New:
----
libkmahjongg-16.08.0.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libkmahjongg.spec ++++++
--- /var/tmp/diff_new_pack.0Hrqfg/_old 2016-08-31 00:09:04.000000000 +0200
+++ /var/tmp/diff_new_pack.0Hrqfg/_new 2016-08-31 00:09:04.000000000 +0200
@@ -21,7 +21,7 @@
License: GPL-2.0+
Group: System/GUI/KDE
Url: http://www.kde.org
-Version: 16.04.3
+Version: 16.08.0
Release: 0
Source0: libkmahjongg-%{version}.tar.xz
BuildRequires: fdupes
++++++ libkmahjongg-16.04.3.tar.xz -> libkmahjongg-16.08.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/.clang-format new/libkmahjongg-16.08.0/.clang-format
--- old/libkmahjongg-16.04.3/.clang-format 1970-01-01 01:00:00.000000000 +0100
+++ new/libkmahjongg-16.08.0/.clang-format 2016-08-07 14:15:56.000000000 +0200
@@ -0,0 +1,85 @@
+---
+Language: Cpp
+# BasedOnStyle: WebKit
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands: false
+AlignTrailingComments: false
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: true
+ AfterUnion: true
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+BreakBeforeBinaryOperators: All
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: true
+ColumnLimit: 0
+CommentPragmas: ''
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros: [ foreach, Q_FOREACH ]
+IncludeCategories:
+ - Regex: '^" INTERFACE "$")
-set_target_properties(KF5KMahjongglib PROPERTIES VERSION ${KMAHJONGGLIB_VERSION}
- SOVERSION ${KMAHJONGGLIB_SOVERSION}
+set_target_properties(KF5KMahjongglib PROPERTIES VERSION ${KMAHJONGGLIB_VERSION}
+ SOVERSION ${KMAHJONGGLIB_SOVERSION}
EXPORT_NAME KF5KMahjongglib)
ecm_setup_version(${KMAHJONGGLIB_VERSION} VARIABLE_PREFIX KF5KMAHJONGGLIB
@@ -61,18 +83,19 @@
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfigVersion.cmake"
SOVERSION 6)
-
+
install(TARGETS KF5KMahjongglib EXPORT KF5KMahjonggLibraryDepends
${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/libkmahjongg_export.h
- kmahjonggtileset.h
- kmahjonggbackground.h
- kmahjonggconfigdialog.h
-DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg COMPONENT Devel)
+ ${CMAKE_CURRENT_BINARY_DIR}/libkmahjongg_export.h
+ kmahjonggtileset.h
+ kmahjonggbackground.h
+ kmahjonggconfigdialog.h
+ DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg COMPONENT Devel
+)
########### generate exports ###############
@@ -84,23 +107,28 @@
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5KMahjongglib")
# create the Config.cmake and ConfigVersion.cmake files
-ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5KMahjongglibConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
- INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
- )
-
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfigVersion.cmake"
- DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
- COMPONENT Devel )
+ecm_configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/KF5KMahjongglibConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
+ INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
+)
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfigVersion.cmake"
+ DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel
+)
# install the export set for use with the install-tree
-install(EXPORT KF5KMahjonggLibraryDepends DESTINATION
- ${CMAKECONFIG_INSTALL_DIR} COMPONENT Devel)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kmahjongglib_version.h
- DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg
- COMPONENT Devel)
+install(EXPORT KF5KMahjonggLibraryDepends
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR}
+ COMPONENT Devel
+)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kmahjongglib_version.h
+ DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg
+ COMPONENT Devel
+)
########### Display Summary ###############
feature_summary(WHAT ALL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/backgrounds/CMakeLists.txt new/libkmahjongg-16.08.0/backgrounds/CMakeLists.txt
--- old/libkmahjongg-16.04.3/backgrounds/CMakeLists.txt 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/backgrounds/CMakeLists.txt 2016-08-07 14:15:56.000000000 +0200
@@ -1,28 +1,29 @@
##default
-install( FILES default.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES default.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES default.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES default.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES default.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES default.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
##chinese landscape
-install( FILES chinese_landscape.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES chinese_landscape.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES chinese_landscape.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES chinese_landscape.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES chinese_landscape.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES chinese_landscape.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
##wood light
-install( FILES wood_light.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES wood_light.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES wood_light.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES wood_light.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES wood_light.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES wood_light.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
##summertime greens
-install( FILES summerfield.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES summerfield.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES summerfield.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES summerfield.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES summerfield.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES summerfield.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
##plain color
-install( FILES color_plain.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES color_plain.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
##egyptian
-install( FILES egyptian.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES egyptian.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
-install( FILES egyptian.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/ )
+install(FILES egyptian.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES egyptian.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+install(FILES egyptian.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/backgrounds/)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/backgrounds/color_plain.desktop new/libkmahjongg-16.08.0/backgrounds/color_plain.desktop
--- old/libkmahjongg-16.04.3/backgrounds/color_plain.desktop 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/backgrounds/color_plain.desktop 2016-08-07 14:15:56.000000000 +0200
@@ -4,7 +4,7 @@
Name[be]=Проста колер
Name[bs]=Boja ravnice
Name[ca]=Color llis
-Name[ca@valencia]=Color pla
+Name[ca@valencia]=Color llis
Name[cs]=Prostá barva
Name[da]=Almindelig farve
Name[de]=Einfache Farbe
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggbackground.cpp new/libkmahjongg-16.08.0/kmahjonggbackground.cpp
--- old/libkmahjongg-16.04.3/kmahjonggbackground.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggbackground.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -17,30 +17,41 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// own
#include "kmahjonggbackground.h"
-#include "libkmahjongg_debug.h"
-#include <KLocalizedString>
-#include
-#include
-#include
-#include <QImage>
+// Qt
#include <QFile>
+#include <QImage>
#include <QMap>
+#include <QPainter>
#include <QPixmap>
#include <QPixmapCache>
-#include <QPainter>
+#include <QSvgRenderer>
+
+// KDE
+#include <KConfig>
+#include <KConfigGroup>
+#include <KLocalizedString>
+
+// LibKMahjongg
+#include "libkmahjongg_debug.h"
class KMahjonggBackgroundPrivate
{
- public:
+public:
KMahjonggBackgroundPrivate()
- : w(1), h(1), graphicsLoaded(false), isTiled(true), isSVG(false)
+ : w(1)
+ , h(1)
+ , graphicsLoaded(false)
+ , isPlain(false)
+ , isTiled(true)
+ , isSVG(false)
{
}
QMap authorproperties;
- QString pixmapCacheNameFromElementId(const QString &elementid);
+ QString pixmapCacheNameFromElementId(const QString & elementid);
QPixmap renderBG(short width, short height);
QPixmap backgroundPixmap;
@@ -62,19 +73,21 @@
: d(new KMahjonggBackgroundPrivate)
{
static bool _inited = false;
- if (_inited)
+ if (_inited) {
return;
+ }
_inited = true;
}
-KMahjonggBackground::~KMahjonggBackground() {
+KMahjonggBackground::~KMahjonggBackground()
+{
delete d;
}
bool KMahjonggBackground::loadDefault()
{
// Set default background here.
- QLatin1String idx( "egyptian.desktop" );
+ QLatin1String idx("egyptian.desktop");
QString bgPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kmahjongglib/backgrounds/" + idx);
qCDebug(LIBKMAHJONGG_LOG) << "Inside LoadDefault(), located background at" << bgPath;
@@ -86,7 +99,8 @@
#define kBGVersionFormat 1
-bool KMahjonggBackground::load(const QString &file, short width, short height) {
+bool KMahjonggBackground::load(const QString & file, short width, short height)
+{
//qCDebug(LIBKMAHJONGG_LOG) << "Background loading";
d->isSVG = false;
@@ -95,23 +109,23 @@
// verify if it is a valid file first and if we can open it
QFile bgfile(file);
if (!bgfile.open(QIODevice::ReadOnly)) {
- return (false);
+ return false;
}
bgfile.close();
KConfig bgconfig(file, KConfig::SimpleConfig);
KConfigGroup group = bgconfig.group("KMahjonggBackground");
- d->authorproperties.insert(QLatin1String( "Name" ), group.readEntry("Name"));// Returns translated data
- d->authorproperties.insert(QLatin1String( "Author" ), group.readEntry("Author"));
- d->authorproperties.insert(QLatin1String( "Description" ), group.readEntry("Description"));
- d->authorproperties.insert(QLatin1String( "AuthorEmail" ), group.readEntry("AuthorEmail"));
+ d->authorproperties.insert(QLatin1String("Name"), group.readEntry("Name")); // Returns translated data
+ d->authorproperties.insert(QLatin1String("Author"), group.readEntry("Author"));
+ d->authorproperties.insert(QLatin1String("Description"), group.readEntry("Description"));
+ d->authorproperties.insert(QLatin1String("AuthorEmail"), group.readEntry("AuthorEmail"));
//The "Plain" key is set to 1 by the color_plain background.
d->isPlain = group.readEntry("Plain", 0) != 0;
- d->authorproperties.insert(QLatin1String( "Plain" ), d->isPlain ? QLatin1String("1") : QLatin1String("0"));
+ d->authorproperties.insert(QLatin1String("Plain"), d->isPlain ? QLatin1String("1") : QLatin1String("0"));
//Version control
- int bgversion = group.readEntry("VersionFormat",0);
+ int bgversion = group.readEntry("VersionFormat", 0);
//Format is increased when we have incompatible changes, meaning that older clients are not able to use the remaining information safely
if (bgversion > kBGVersionFormat) {
return false;
@@ -130,11 +144,13 @@
qCDebug(LIBKMAHJONGG_LOG) << "Using background at" << d->graphicspath;
- if (d->graphicspath.isEmpty()) return (false);
+ if (d->graphicspath.isEmpty()) {
+ return false;
+ }
- if (group.readEntry("Tiled",0)) {
- d->w = group.readEntry("Width",0);
- d->h = group.readEntry("Height",0);
+ if (group.readEntry("Tiled", 0) != 0) {
+ d->w = group.readEntry("Width", 0);
+ d->h = group.readEntry("Height", 0);
d->isTiled = true;
} else {
d->w = width;
@@ -146,35 +162,44 @@
return true;
}
-bool KMahjonggBackground::loadGraphics() {
- if (d->graphicsLoaded || d->isPlain) return (true) ;
+bool KMahjonggBackground::loadGraphics()
+{
+ if (d->graphicsLoaded || d->isPlain) {
+ return true;
+ }
d->svg.load(d->graphicspath);
if (d->svg.isValid()) {
d->isSVG = true;
} else {
//qCDebug(LIBKMAHJONGG_LOG) << "could not load svg";
- return( false );
+ return false;
}
- return (true);
+ return true;
}
-void KMahjonggBackground::sizeChanged(int newW, int newH) {
+void KMahjonggBackground::sizeChanged(int newW, int newH)
+{
//in tiled mode we do not care about the whole field size
- if (d->isTiled || d->isPlain) return;
+ if (d->isTiled || d->isPlain) {
+ return;
+ }
- if (newW == d->w && newH == d->h)
+ if (newW == d->w && newH == d->h) {
return;
+ }
d->w = newW;
d->h = newH;
}
-QString KMahjonggBackgroundPrivate::pixmapCacheNameFromElementId(const QString &elementid) {
- return authorproperties[QLatin1String( "Name" )]+ elementid+QString::fromLatin1( "W%1H%2").arg(w).arg(h);
+QString KMahjonggBackgroundPrivate::pixmapCacheNameFromElementId(const QString & elementid)
+{
+ return authorproperties[QLatin1String("Name")] + elementid + QString::fromLatin1("W%1H%2").arg(w).arg(h);
}
-QPixmap KMahjonggBackgroundPrivate::renderBG(short width, short height) {
- QImage qiRend(QSize(width, height),QImage::Format_ARGB32_Premultiplied);
+QPixmap KMahjonggBackgroundPrivate::renderBG(short width, short height)
+{
+ QImage qiRend(QSize(width, height), QImage::Format_ARGB32_Premultiplied);
qiRend.fill(0);
if (svg.isValid()) {
@@ -184,7 +209,8 @@
return QPixmap::fromImage(qiRend);
}
-QBrush & KMahjonggBackground::getBackground() {
+QBrush & KMahjonggBackground::getBackground()
+{
if (d->isPlain) {
d->backgroundBrush = QBrush(QPixmap());
} else {
@@ -197,11 +223,12 @@
return d->backgroundBrush;
}
-QString KMahjonggBackground::path() const {
+QString KMahjonggBackground::path() const
+{
return d->filename;
}
-QString KMahjonggBackground::authorProperty(const QString &key) const {
+QString KMahjonggBackground::authorProperty(const QString & key) const
+{
return d->authorproperties[key];
}
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggbackground.h new/libkmahjongg-16.08.0/kmahjonggbackground.h
--- old/libkmahjongg-16.04.3/kmahjonggbackground.h 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggbackground.h 2016-08-07 14:15:56.000000000 +0200
@@ -17,11 +17,13 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef _KMAHJONGGBACKGROUND_H_
-#define _KMAHJONGGBACKGROUND_H_
+#ifndef KMAHJONGGBACKGROUND_H
+#define KMAHJONGGBACKGROUND_H
-#include
+// Qt
+#include <QBrush>
+// LibKMahjongg
#include "libkmahjongg_export.h"
class KMahjonggBackgroundPrivate;
@@ -47,4 +49,4 @@
Q_DISABLE_COPY(KMahjonggBackground)
};
-#endif
+#endif // KMAHJONGGBACKGROUND_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggbackgroundselector.cpp new/libkmahjongg-16.08.0/kmahjonggbackgroundselector.cpp
--- old/libkmahjongg-16.04.3/kmahjonggbackgroundselector.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggbackgroundselector.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -16,15 +16,21 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// own
#include "kmahjonggbackgroundselector.h"
-#include <KLocalizedString>
+// Qt
+#include <QDir>
#include <QPainter>
+
+// KDE
+#include <KLocalizedString>
+
+// LibKMahjongg
#include "kmahjonggbackground.h"
-#include <QDir>
-KMahjonggBackgroundSelector::KMahjonggBackgroundSelector( QWidget* parent, KConfigSkeleton * aconfig )
- : QWidget( parent )
+KMahjonggBackgroundSelector::KMahjonggBackgroundSelector(QWidget * parent, KConfigSkeleton * aconfig)
+ : QWidget(parent)
{
setupUi(this);
setupData(aconfig);
@@ -50,24 +56,23 @@
//Now get our backgrounds into a list
QStringList bgsAvailable;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kmahjongglib/backgrounds", QStandardPaths::LocateDirectory);
- Q_FOREACH (const QString& dir, dirs) {
+ Q_FOREACH (const QString & dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
- Q_FOREACH (const QString& file, fileNames) {
+ Q_FOREACH (const QString & file, fileNames) {
bgsAvailable.append(dir + '/' + file);
- }
+ }
}
QLatin1String namestr("Name");
int numvalidentries = 0;
- for (int i = 0; i < bgsAvailable.size(); ++i)
- {
+ for (int i = 0; i < bgsAvailable.size(); ++i) {
KMahjonggBackground * abg = new KMahjonggBackground();
QString bgpath = bgsAvailable.at(i);
- if (abg->load(bgpath,backgroundPreview->width(),backgroundPreview->height())) {
+ if (abg->load(bgpath, backgroundPreview->width(), backgroundPreview->height())) {
backgroundMap.insert(abg->authorProperty(namestr), abg);
backgroundList->addItem(abg->authorProperty(namestr));
//Find if this is our currently configured background
- if (bgpath==initialGroup) {
+ if (bgpath == initialGroup) {
//Select current entry
backgroundList->setCurrentRow(numvalidentries);
backgroundChanged();
@@ -85,8 +90,10 @@
{
KMahjonggBackground * selBG = backgroundMap.value(backgroundList->currentItem()->text());
//Sanity checkings. Should not happen.
- if (!selBG) return;
- if (selBG->path()==kcfg_Background->text()) {
+ if (selBG == nullptr) {
+ return;
+ }
+ if (selBG->path() == kcfg_Background->text()) {
return;
}
QLatin1String authstr("Author");
@@ -97,23 +104,22 @@
backgroundContact->setText(selBG->authorProperty(contactstr));
backgroundDescription->setText(selBG->authorProperty(descstr));
- if (selBG->authorProperty(QLatin1String( "Plain" )) == QLatin1String("1")) {
+ if (selBG->authorProperty(QLatin1String("Plain")) == QLatin1String("1")) {
backgroundPreview->setPixmap(QPixmap());
return;
}
//Make sure SVG is loaded when graphics is selected
- if (!selBG->loadGraphics()) return;
+ if (!selBG->loadGraphics()) {
+ return;
+ }
//Draw the preview
//TODO here: add code to load and keep proportions for non-tiled content?
- QImage qiRend(backgroundPreview->size(),QImage::Format_ARGB32_Premultiplied);
+ QImage qiRend(backgroundPreview->size(), QImage::Format_ARGB32_Premultiplied);
qiRend.fill(0);
QPainter p(&qiRend);
- p.fillRect(p.viewport(), selBG->getBackground() );
+ p.fillRect(p.viewport(), selBG->getBackground());
p.end();
backgroundPreview->setPixmap(QPixmap::fromImage(qiRend));
-
}
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggbackgroundselector.h new/libkmahjongg-16.08.0/kmahjonggbackgroundselector.h
--- old/libkmahjongg-16.04.3/kmahjonggbackgroundselector.h 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggbackgroundselector.h 2016-08-07 14:15:56.000000000 +0200
@@ -16,11 +16,16 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __LIB_KMAHJONGGBACKGROUNDSELECTOR_H_
-#define __LIB_KMAHJONGGBACKGROUNDSELECTOR_H_
+#ifndef KMAHJONGGBACKGROUNDSELECTOR_H
+#define KMAHJONGGBACKGROUNDSELECTOR_H
+// Qt
#include <QMap>
+
+// KDE
#include <KConfigSkeleton>
+
+// LibKMahjongg
#include "ui_kmahjonggbackgroundselector.h"
class KMahjonggBackground;
@@ -29,13 +34,13 @@
{
Q_OBJECT
public:
- explicit KMahjonggBackgroundSelector( QWidget* parent, KConfigSkeleton * config );
+ explicit KMahjonggBackgroundSelector( QWidget* parent, KConfigSkeleton * aconfig );
~KMahjonggBackgroundSelector();
- void setupData(KConfigSkeleton * config);
+ void setupData(KConfigSkeleton * aconfig);
QMap backgroundMap;
public slots:
void backgroundChanged();
};
-#endif // __LIB_KMAHJONGGBACKGROUNDSELECTOR_H_
+#endif // KMAHJONGGBACKGROUNDSELECTOR_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggconfigdialog.cpp new/libkmahjongg-16.08.0/kmahjonggconfigdialog.cpp
--- old/libkmahjongg-16.04.3/kmahjonggconfigdialog.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggconfigdialog.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -15,40 +15,45 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "kmahjonggconfigdialog.h"
-
-#include "kmahjonggtilesetselector.h"
-#include "kmahjonggbackgroundselector.h"
-#include "libkmahjongg_debug.h"
-#include
-#include
-#include <KLocalizedString>
-#include
-#include
-#include <KConfigGroup>
+// own
+#include "kmahjonggconfigdialog.h"
+// Qt
#include <QDialog>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
+// KDE
+#include <KConfig>
+#include <KConfigDialogManager>
+#include <KConfigGroup>
+#include <KLocalizedString>
+#include <KRandom>
+#include <KStandardGuiItem>
+
+// LibKMahjongg
+#include "kmahjonggbackgroundselector.h"
+#include "kmahjonggtilesetselector.h"
+#include "libkmahjongg_debug.h"
+
class KMahjonggConfigDialogPrivate
{
public:
KConfigSkeleton * m_config;
};
-KMahjonggConfigDialog::KMahjonggConfigDialog( QWidget *parent, const QString& name,
- KConfigSkeleton *config)
- : KConfigDialog(parent, name, config),
- d(new KMahjonggConfigDialogPrivate)
+KMahjonggConfigDialog::KMahjonggConfigDialog(QWidget * parent, const QString & name,
+ KConfigSkeleton * config)
+ : KConfigDialog(parent, name, config)
+ , d(new KMahjonggConfigDialogPrivate)
{
setFaceType(List);
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Apply);
- QVBoxLayout *mainLayout = new QVBoxLayout;
+ QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Apply);
+ QVBoxLayout * mainLayout = new QVBoxLayout;
setLayout(mainLayout);
- QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ QPushButton * okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &KMahjonggConfigDialog::accept);
@@ -68,27 +73,17 @@
{
KMahjonggTilesetSelector * ts = new KMahjonggTilesetSelector(this, d->m_config);
//TODO: Use the cards icon for our page for now, need to get one for tilesets made
- addPage(ts, i18n("Tiles"), QLatin1String( "games-config-tiles" ));
+ addPage(ts, i18n("Tiles"), QLatin1String("games-config-tiles"));
}
void KMahjonggConfigDialog::addBackgroundPage()
{
KMahjonggBackgroundSelector * ts = new KMahjonggBackgroundSelector(this, d->m_config);
//TODO: need icon
- addPage(ts, i18n("Background"), QLatin1String( "games-config-background" ));
+ addPage(ts, i18n("Background"), QLatin1String("games-config-background"));
}
void KMahjonggConfigDialog::updateWidgetsDefault()
{
//qCDebug(LIBKMAHJONGG_LOG) << "updateWidgetsDefault";
}
-/*void KMahjonggConfigDialog::updateWidgets()
-{
- //qCDebug(LIBKMAHJONGG_LOG) << "updateWidgets";
-}
-void KMahjonggConfigDialog::updateSettings()
-{
- //qCDebug(LIBKMAHJONGG_LOG) << "updateSettings";
-}*/
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggconfigdialog.h new/libkmahjongg-16.08.0/kmahjonggconfigdialog.h
--- old/libkmahjongg-16.04.3/kmahjonggconfigdialog.h 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggconfigdialog.h 2016-08-07 14:15:56.000000000 +0200
@@ -16,14 +16,16 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __LIBKMAHJONGGCONFIGDIALOG_H_
-#define __LIBKMAHJONGGCONFIGDIALOG_H_
-
-#include
-#include
+#ifndef KMAHJONGGCONFIGDIALOG_H
+#define KMAHJONGGCONFIGDIALOG_H
+// KDE
+#include <KConfigDialog>
#include <KConfigSkeleton>
+// LibKMahjongg
+#include
+
class KMahjonggConfigDialogPrivate;
class LIBKMAHJONGG_EXPORT KMahjonggConfigDialog : public KConfigDialog
@@ -38,8 +40,6 @@
protected Q_SLOTS:
void updateWidgetsDefault();
- //void updateWidgets();
- //void updateSettings();
private:
friend class KMahjonggConfigDialogPrivate;
@@ -48,4 +48,4 @@
Q_DISABLE_COPY(KMahjonggConfigDialog)
};
-#endif
+#endif // KMAHJONGGCONFIGDIALOG_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggtileset.cpp new/libkmahjongg-16.08.0/kmahjonggtileset.cpp
--- old/libkmahjongg-16.04.3/kmahjonggtileset.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggtileset.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -17,47 +17,64 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// own
#include "kmahjonggtileset.h"
-#include "libkmahjongg_debug.h"
-#include <KLocalizedString>
-#include
-#include
-#include
-#include
-#include <QPainter>
-#include <QPixmapCache>
+// STL
+#include <cstdlib>
+
+// Qt
#include <QFile>
+#include <QImage>
#include <QMap>
+#include <QPainter>
+#include <QPixmapCache>
#include <QStandardPaths>
+#include <QSvgRenderer>
-#include
+// KDE
+#include <KConfig>
+#include <KConfigGroup>
+#include <KLocalizedString>
+
+// LibKMahjongg
+#include "libkmahjongg_debug.h"
class KMahjonggTilesetMetricsData
{
- public:
- short lvloffx; // used for 3D indentation, x value
- short lvloffy; // used for 3D indentation, y value
- short w; // tile width ( +border +shadow)
- short h; // tile height ( +border +shadow)
- short fw; // face width
- short fh; // face height
+public:
+ short lvloffx; // used for 3D indentation, x value
+ short lvloffy; // used for 3D indentation, y value
+ short w; // tile width ( +border +shadow)
+ short h; // tile height ( +border +shadow)
+ short fw; // face width
+ short fh; // face height
KMahjonggTilesetMetricsData()
- : lvloffx(0), lvloffy(0), w(0), h(0), fw(0), fh(0)
- {}
+ : lvloffx(0)
+ , lvloffy(0)
+ , w(0)
+ , h(0)
+ , fw(0)
+ , fh(0)
+ {
+ }
};
class KMahjonggTilesetPrivate
{
- public:
- KMahjonggTilesetPrivate() : isSVG(false), graphicsLoaded(false) {}
+public:
+ KMahjonggTilesetPrivate()
+ : isSVG(false)
+ , graphicsLoaded(false)
+ {
+ }
QList<QString> elementIdTable;
QMap authorproperties;
KMahjonggTilesetMetricsData originaldata;
KMahjonggTilesetMetricsData scaleddata;
- QString filename; // cache the last file loaded to save reloading it
+ QString filename; // cache the last file loaded to save reloading it
QString graphicspath;
QSvgRenderer svg;
@@ -73,14 +90,16 @@
buildElementIdTable();
static bool _inited = false;
- if (_inited)
+ if (_inited) {
return;
+ }
_inited = true;
}
// ---------------------------------------------------------
-KMahjonggTileset::~KMahjonggTileset() {
+KMahjonggTileset::~KMahjonggTileset()
+{
delete d;
}
@@ -88,11 +107,11 @@
{
d->scaleddata.w = tilew;
d->scaleddata.h = tileh;
- double ratio = ((qreal) d->scaleddata.w) / ((qreal) d->originaldata.w);
- d->scaleddata.lvloffx = (short) (d->originaldata.lvloffx * ratio);
- d->scaleddata.lvloffy = (short) (d->originaldata.lvloffy * ratio);
- d->scaleddata.fw = (short) (d->originaldata.fw * ratio);
- d->scaleddata.fh = (short) (d->originaldata.fh * ratio);
+ double ratio = (static_cast<qreal>(d->scaleddata.w)) / (static_cast<qreal>(d->originaldata.w));
+ d->scaleddata.lvloffx = static_cast<short>(d->originaldata.lvloffx * ratio);
+ d->scaleddata.lvloffy = static_cast<short>(d->originaldata.lvloffy * ratio);
+ d->scaleddata.fw = static_cast<short>(d->originaldata.fw * ratio);
+ d->scaleddata.fh = static_cast<short>(d->originaldata.fh * ratio);
}
QSize KMahjonggTileset::preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells)
@@ -108,20 +127,20 @@
qreal floatw = d->originaldata.w;
qreal floath = d->originaldata.h;
- if ((fullw/fullh)>(bw/bh)) {
+ if ((fullw / fullh) > (bw / bh)) {
//space will be left on height, use width as limit
- aspectratio = bw/fullw;
+ aspectratio = bw / fullw;
} else {
- aspectratio = bh/fullh;
+ aspectratio = bh / fullh;
}
newtilew = aspectratio * floatw;
newtileh = aspectratio * floath;
- return QSize((short)newtilew, (short)newtileh);
+ return QSize(static_cast<short>(newtilew), static_cast<short>(newtileh));
}
bool KMahjonggTileset::loadDefault()
{
- QString idx = QLatin1String( "default.desktop" );
+ QString idx = QLatin1String("default.desktop");
QString tilesetPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kmahjongglib/tilesets/" + idx);
qCDebug(LIBKMAHJONGG_LOG) << "Inside LoadDefault(), located path at" << tilesetPath;
@@ -131,7 +150,7 @@
return loadTileset(tilesetPath);
}
-QString KMahjonggTileset::authorProperty(const QString &key) const
+QString KMahjonggTileset::authorProperty(const QString & key) const
{
return d->authorproperties[key];
}
@@ -158,12 +177,12 @@
short KMahjonggTileset::qWidth() const
{
- return (short) (d->scaleddata.fw / 2.0);
+ return static_cast<short>(d->scaleddata.fw / 2.0);
}
short KMahjonggTileset::qHeight() const
{
- return (short) (d->scaleddata.fh / 2.0);
+ return static_cast<short>(d->scaleddata.fh / 2.0);
}
QString KMahjonggTileset::path() const
@@ -174,10 +193,8 @@
#define kTilesetVersionFormat 1
// ---------------------------------------------------------
-bool KMahjonggTileset::loadTileset( const QString & tilesetPath)
+bool KMahjonggTileset::loadTileset(const QString & tilesetPath)
{
-
- QImage qiTiles;
//qCDebug(LIBKMAHJONGG_LOG) << "Attempting to load .desktop at" << tilesetPath;
//clear our properties map
@@ -186,20 +203,20 @@
// verify if it is a valid file first and if we can open it
QFile tilesetfile(tilesetPath);
if (!tilesetfile.open(QIODevice::ReadOnly)) {
- return (false);
+ return false;
}
tilesetfile.close();
KConfig tileconfig(tilesetPath, KConfig::SimpleConfig);
KConfigGroup group = tileconfig.group("KMahjonggTileset");
- d->authorproperties.insert(QLatin1String( "Name" ), group.readEntry("Name"));// Returns translated data
- d->authorproperties.insert(QLatin1String( "Author" ), group.readEntry("Author"));
- d->authorproperties.insert(QLatin1String( "Description" ), group.readEntry("Description"));
- d->authorproperties.insert(QLatin1String( "AuthorEmail" ), group.readEntry("AuthorEmail"));
+ d->authorproperties.insert(QLatin1String("Name"), group.readEntry("Name")); // Returns translated data
+ d->authorproperties.insert(QLatin1String("Author"), group.readEntry("Author"));
+ d->authorproperties.insert(QLatin1String("Description"), group.readEntry("Description"));
+ d->authorproperties.insert(QLatin1String("AuthorEmail"), group.readEntry("AuthorEmail"));
//Version control
- int tileversion = group.readEntry("VersionFormat",0);
+ int tileversion = group.readEntry("VersionFormat", 0);
//Format is increased when we have incompatible changes, meaning that older clients are not able to use the remaining information safely
if (tileversion > kTilesetVersionFormat) {
return false;
@@ -209,11 +226,12 @@
d->graphicspath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kmahjongglib/tilesets/" + graphName);
//qCDebug(LIBKMAHJONGG_LOG) << "Using tileset at" << d->graphicspath;
- //d->filename = graphicsPath;
//only SVG for now
d->isSVG = true;
- if (d->graphicspath.isEmpty()) return (false);
+ if (d->graphicspath.isEmpty()) {
+ return false;
+ }
d->originaldata.w = group.readEntry("TileWidth", 30);
d->originaldata.h = group.readEntry("TileHeight", 50);
@@ -226,31 +244,15 @@
d->graphicsLoaded = false;
d->filename = tilesetPath;
- /* if (d->isSVG) {
- //really?
- d->svg.load(graphicsPath);
- if (d->svg.isValid()) {
- d->filename = tilesetPath;
- //invalidate our global cache
- QPixmapCache::clear();
-
- d->isSVG = true;
- reloadTileset(QSize(d->originaldata.w, d->originaldata.h));
- } else {
- return( false );
- }
- } else {
- //TODO add support for png??
- return false;
- }*/
-
- return( true );
+ return true;
}
// ---------------------------------------------------------
bool KMahjonggTileset::loadGraphics()
{
- if (d->graphicsLoaded == true) return (true) ;
+ if (d->graphicsLoaded) {
+ return true;
+ }
if (d->isSVG) {
//really?
d->svg.load(d->graphicspath);
@@ -260,79 +262,82 @@
d->graphicsLoaded = true;
reloadTileset(QSize(d->originaldata.w, d->originaldata.h));
} else {
- return( false );
+ return false;
}
} else {
//TODO add support for png??
return false;
}
- return( true );
+ return true;
}
// ---------------------------------------------------------
-bool KMahjonggTileset::reloadTileset( const QSize & newTilesize)
+bool KMahjonggTileset::reloadTileset(const QSize & newTilesize)
{
- QString tilesetPath = d->filename;
-
- if (QSize(d->scaleddata.w, d->scaleddata.h) == newTilesize) return false;
+ if (QSize(d->scaleddata.w, d->scaleddata.h) == newTilesize) {
+ return false;
+ }
if (d->isSVG) {
if (d->svg.isValid()) {
updateScaleInfo(newTilesize.width(), newTilesize.height());
//rendering will be done when needed, automatically using the global cache
} else {
- return( false );
+ return false;
}
} else {
//TODO add support for png???
return false;
}
- return( true );
+ return true;
}
-void KMahjonggTileset::buildElementIdTable() {
+void KMahjonggTileset::buildElementIdTable()
+{
//Build a list for faster lookup of element ids, mapped to the enumeration used by GameData and BoardWidget
//Unselected tiles
- for (short idx=1; idx<=4; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "TILE_%1").arg(idx));
+ for (short idx = 1; idx <= 4; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("TILE_%1").arg(idx));
}
//Selected tiles
- for (short idx=1; idx<=4; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "TILE_%1_SEL").arg(idx));
+ for (short idx = 1; idx <= 4; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("TILE_%1_SEL").arg(idx));
}
//now faces
- for (short idx=1; idx<=9; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "CHARACTER_%1").arg(idx));
+ for (short idx = 1; idx <= 9; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("CHARACTER_%1").arg(idx));
}
- for (short idx=1; idx<=9; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "BAMBOO_%1").arg(idx));
+ for (short idx = 1; idx <= 9; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("BAMBOO_%1").arg(idx));
}
- for (short idx=1; idx<=9; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "ROD_%1").arg(idx));
+ for (short idx = 1; idx <= 9; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("ROD_%1").arg(idx));
}
- for (short idx=1; idx<=4; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "SEASON_%1").arg(idx));
+ for (short idx = 1; idx <= 4; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("SEASON_%1").arg(idx));
}
- for (short idx=1; idx<=4; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "WIND_%1").arg(idx));
+ for (short idx = 1; idx <= 4; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("WIND_%1").arg(idx));
}
- for (short idx=1; idx<=3; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "DRAGON_%1").arg(idx));
+ for (short idx = 1; idx <= 3; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("DRAGON_%1").arg(idx));
}
- for (short idx=1; idx<=4; idx++) {
- d->elementIdTable.append(QString::fromLatin1( "FLOWER_%1").arg(idx));
+ for (short idx = 1; idx <= 4; idx++) {
+ d->elementIdTable.append(QString::fromLatin1("FLOWER_%1").arg(idx));
}
}
-QString KMahjonggTileset::pixmapCacheNameFromElementId(const QString & elementid) {
- return authorProperty(QLatin1String( "Name" ))+ elementid + QString::fromLatin1( "W%1H%2").arg(d->scaleddata.w).arg(d->scaleddata.h);
+QString KMahjonggTileset::pixmapCacheNameFromElementId(const QString & elementid)
+{
+ return authorProperty(QLatin1String("Name")) + elementid + QString::fromLatin1("W%1H%2").arg(d->scaleddata.w).arg(d->scaleddata.h);
}
-QPixmap KMahjonggTileset::renderElement(short width, short height, const QString & elementid) {
- ////qCDebug(LIBKMAHJONGG_LOG) << "render element" << elementid << width << height;
- QImage qiRend(QSize(width, height),QImage::Format_ARGB32_Premultiplied);
+QPixmap KMahjonggTileset::renderElement(short width, short height, const QString & elementid)
+{
+ //qCDebug(LIBKMAHJONGG_LOG) << "render element" << elementid << width << height;
+ QImage qiRend(QSize(width, height), QImage::Format_ARGB32_Premultiplied);
qiRend.fill(0);
if (d->svg.isValid()) {
@@ -342,9 +347,10 @@
return QPixmap::fromImage(qiRend);
}
-QPixmap KMahjonggTileset::selectedTile(int num) {
+QPixmap KMahjonggTileset::selectedTile(int num)
+{
QPixmap pm;
- QString elemId = d->elementIdTable.at(num+4);//selected offset in our idtable;
+ QString elemId = d->elementIdTable.at(num + 4); //selected offset in our idtable;
if (!QPixmapCache::find(pixmapCacheNameFromElementId(elemId), &pm)) {
//use tile size
pm = renderElement(d->scaleddata.w, d->scaleddata.h, elemId);
@@ -353,7 +359,8 @@
return pm;
}
-QPixmap KMahjonggTileset::unselectedTile(int num) {
+QPixmap KMahjonggTileset::unselectedTile(int num)
+{
QPixmap pm;
QString elemId = d->elementIdTable.at(num);
if (!QPixmapCache::find(pixmapCacheNameFromElementId(elemId), &pm)) {
@@ -364,14 +371,15 @@
return pm;
}
-QPixmap KMahjonggTileset::tileface(int num) {
+QPixmap KMahjonggTileset::tileface(int num)
+{
QPixmap pm;
if ((num + 8) >= d->elementIdTable.count()) {
//qCDebug(LIBKMAHJONGG_LOG) << "Client asked for invalid tileface id";
return pm;
}
- QString elemId = d->elementIdTable.at(num + 8);//tileface offset in our idtable;
+ QString elemId = d->elementIdTable.at(num + 8); //tileface offset in our idtable;
if (!QPixmapCache::find(pixmapCacheNameFromElementId(elemId), &pm)) {
//use face size
pm = renderElement(d->scaleddata.fw, d->scaleddata.fh, elemId);
@@ -379,4 +387,3 @@
}
return pm;
}
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggtileset.h new/libkmahjongg-16.08.0/kmahjonggtileset.h
--- old/libkmahjongg-16.04.3/kmahjonggtileset.h 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggtileset.h 2016-08-07 14:15:56.000000000 +0200
@@ -17,45 +17,47 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef _KMAHJONGGTILESET_H_
-#define _KMAHJONGGTILESET_H_
+#ifndef KMAHJONGGTILESET_H
+#define KMAHJONGGTILESET_H
-#include
-#include
+// Qt
+#include <QString>
+#include <QPixmap>
+// LibKMahjongg
#include
class KMahjonggTilesetPrivate;
class LIBKMAHJONGG_EXPORT KMahjonggTileset {
public:
- KMahjonggTileset();
- ~KMahjonggTileset();
+ KMahjonggTileset();
+ ~KMahjonggTileset();
- bool loadDefault();
- bool loadTileset(const QString & tilesetPath);
- bool loadGraphics();
- bool reloadTileset(const QSize & newTilesize);
- QSize preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells);
- QString authorProperty(const QString &key) const;
-
- short width() const;
- short height() const;
- short levelOffsetX() const;
- short levelOffsetY() const;
- short qWidth() const;
- short qHeight() const;
- QString path() const;
-
- QPixmap selectedTile(int num);
- QPixmap unselectedTile(int num);
- QPixmap tileface(int num);
-
- protected:
- void updateScaleInfo(short tilew, short tileh);
- void buildElementIdTable(void);
- QString pixmapCacheNameFromElementId(const QString & elementid);
- QPixmap renderElement(short width, short height, const QString & elementid);
+ bool loadDefault();
+ bool loadTileset(const QString & tilesetPath);
+ bool loadGraphics();
+ bool reloadTileset(const QSize & newTilesize);
+ QSize preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells);
+ QString authorProperty(const QString &key) const;
+
+ short width() const;
+ short height() const;
+ short levelOffsetX() const;
+ short levelOffsetY() const;
+ short qWidth() const;
+ short qHeight() const;
+ QString path() const;
+
+ QPixmap selectedTile(int num);
+ QPixmap unselectedTile(int num);
+ QPixmap tileface(int num);
+
+protected:
+ void updateScaleInfo(short tilew, short tileh);
+ void buildElementIdTable(void);
+ QString pixmapCacheNameFromElementId(const QString & elementid);
+ QPixmap renderElement(short width, short height, const QString & elementid);
private:
@@ -65,4 +67,4 @@
Q_DISABLE_COPY(KMahjonggTileset)
};
-#endif
+#endif // KMAHJONGGTILESET_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggtilesetselector.cpp new/libkmahjongg-16.08.0/kmahjonggtilesetselector.cpp
--- old/libkmahjongg-16.04.3/kmahjonggtilesetselector.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggtilesetselector.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -16,17 +16,22 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+// own
#include "kmahjonggtilesetselector.h"
-#include <KLocalizedString>
-#include <QPainter>
-#include
+// Qt
#include <QDir>
+#include <QPainter>
+#include <QStandardPaths>
+// KDE
+#include <KLocalizedString>
+
+// LibKMahjongg
#include "kmahjonggtileset.h"
-KMahjonggTilesetSelector::KMahjonggTilesetSelector( QWidget* parent, KConfigSkeleton * aconfig )
- : QWidget( parent )
+KMahjonggTilesetSelector::KMahjonggTilesetSelector(QWidget * parent, KConfigSkeleton * aconfig)
+ : QWidget(parent)
{
setupUi(this);
setupData(aconfig);
@@ -34,7 +39,7 @@
KMahjonggTilesetSelector::~KMahjonggTilesetSelector()
{
- tilesetMap.clear();
+ tilesetMap.clear();
}
void KMahjonggTilesetSelector::setupData(KConfigSkeleton * aconfig)
@@ -53,24 +58,23 @@
//Now get our tilesets into a list
QStringList tilesAvailable;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kmahjongglib/tilesets", QStandardPaths::LocateDirectory);
- Q_FOREACH (const QString& dir, dirs) {
+ Q_FOREACH (const QString & dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.desktop"));
- Q_FOREACH (const QString& file, fileNames) {
+ Q_FOREACH (const QString & file, fileNames) {
tilesAvailable.append(dir + '/' + file);
}
}
QLatin1String namestr("Name");
int numvalidentries = 0;
- for (int i = 0; i < tilesAvailable.size(); ++i)
- {
+ for (int i = 0; i < tilesAvailable.size(); ++i) {
KMahjonggTileset * aset = new KMahjonggTileset();
QString atileset = tilesAvailable.at(i);
if (aset->loadTileset(atileset)) {
tilesetMap.insert(aset->authorProperty(namestr), aset);
tilesetList->addItem(aset->authorProperty(namestr));
//Find if this is our currently configured Tileset
- if (atileset==initialGroup) {
+ if (atileset == initialGroup) {
//Select current entry
tilesetList->setCurrentRow(numvalidentries);
tilesetChanged();
@@ -88,8 +92,10 @@
{
KMahjonggTileset * selTileset = tilesetMap.value(tilesetList->currentItem()->text());
//Sanity checkings. Should not happen.
- if (!selTileset) return;
- if (selTileset->path()==kcfg_TileSet->text()) {
+ if (selTileset == nullptr) {
+ return;
+ }
+ if (selTileset->path() == kcfg_TileSet->text()) {
return;
}
QLatin1String authstr("Author");
@@ -101,22 +107,21 @@
tilesetDescription->setText(selTileset->authorProperty(descstr));
//Make sure SVG is loaded when graphics is selected
- if (!selTileset->loadGraphics()) return;
+ if (!selTileset->loadGraphics()) {
+ return;
+ }
//Let the tileset calculate its ideal size for the preview area, but reduce the margins a bit (pass oversized drawing area)
- QSize tilesize = selTileset->preferredTileSize(tilesetPreview->size()*1.3, 1, 1);
+ QSize tilesize = selTileset->preferredTileSize(tilesetPreview->size() * 1.3, 1, 1);
selTileset->reloadTileset(tilesize);
//Draw the preview
- QImage qiRend(tilesetPreview->size(),QImage::Format_ARGB32_Premultiplied);
+ QImage qiRend(tilesetPreview->size(), QImage::Format_ARGB32_Premultiplied);
qiRend.fill(0);
QPainter p(&qiRend);
//Calculate the margins to center the tile
QSize margin = tilesetPreview->size() - tilesize;
//Draw unselected tile and first tileface
- p.drawPixmap(margin.width()/2, margin.height()/2, selTileset->unselectedTile(1));
- p.drawPixmap(margin.width()/2, margin.height()/2, selTileset->tileface(0));
+ p.drawPixmap(margin.width() / 2, margin.height() / 2, selTileset->unselectedTile(1));
+ p.drawPixmap(margin.width() / 2, margin.height() / 2, selTileset->tileface(0));
p.end();
tilesetPreview->setPixmap(QPixmap::fromImage(qiRend));
-
}
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/kmahjonggtilesetselector.h new/libkmahjongg-16.08.0/kmahjonggtilesetselector.h
--- old/libkmahjongg-16.04.3/kmahjonggtilesetselector.h 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/kmahjonggtilesetselector.h 2016-08-07 14:15:56.000000000 +0200
@@ -16,11 +16,16 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __LIB_KMAHJONGGTILESETSELECTOR_H_
-#define __LIB_KMAHJONGGTILESETSELECTOR_H_
+#ifndef KMAHJONGGTILESETSELECTOR_H
+#define KMAHJONGGTILESETSELECTOR_H
+// Qt
#include <QMap>
+
+// KDE
#include <KConfigSkeleton>
+
+// LibKMahjongg
#include "ui_kmahjonggtilesetselector.h"
class KMahjonggTileset;
@@ -29,13 +34,13 @@
{
Q_OBJECT
public:
- explicit KMahjonggTilesetSelector( QWidget* parent, KConfigSkeleton * config );
+ explicit KMahjonggTilesetSelector( QWidget* parent, KConfigSkeleton * aconfig );
~KMahjonggTilesetSelector();
- void setupData(KConfigSkeleton * config);
+ void setupData(KConfigSkeleton * aconfig);
QMap tilesetMap;
public slots:
void tilesetChanged();
};
-#endif // __LIB_KMAHJONGGTILESETSELECTOR_H_
+#endif // KMAHJONGGTILESETSELECTOR_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/libkmahjongg_debug.cpp new/libkmahjongg-16.08.0/libkmahjongg_debug.cpp
--- old/libkmahjongg-16.04.3/libkmahjongg_debug.cpp 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/libkmahjongg_debug.cpp 2016-08-07 14:15:56.000000000 +0200
@@ -17,7 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+// own
#include "libkmahjongg_debug.h"
-Q_LOGGING_CATEGORY(LIBKMAHJONGG_LOG, "log_libkmahjongg")
-
+Q_LOGGING_CATEGORY(LIBKMAHJONGG_LOG, "log_libkmahjongg")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkmahjongg-16.04.3/tilesets/CMakeLists.txt new/libkmahjongg-16.08.0/tilesets/CMakeLists.txt
--- old/libkmahjongg-16.04.3/tilesets/CMakeLists.txt 2016-03-25 14:05:11.000000000 +0100
+++ new/libkmahjongg-16.08.0/tilesets/CMakeLists.txt 2016-08-07 14:15:56.000000000 +0200
@@ -1,36 +1,36 @@
##default
-install( FILES default.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES default.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES default.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES default.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES default.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES default.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##classic
-install( FILES classic.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES classic.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES classic.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES classic.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES classic.svg DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES classic.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##bamboo
-#install( FILES bamboo.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-#install( FILES bamboo.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-#install( FILES bamboo.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+#install(FILES bamboo.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+#install(FILES bamboo.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+#install(FILES bamboo.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##traditional
-install( FILES traditional.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES traditional.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES traditional.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES traditional.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES traditional.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES traditional.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##alphabet
-install( FILES alphabet.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES alphabet.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES alphabet.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES alphabet.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES alphabet.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES alphabet.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##egypt
-install( FILES egypt.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES egypt.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES egypt.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES egypt.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES egypt.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES egypt.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
##Jade
-install( FILES jade.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES jade.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
-install( FILES jade.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/ )
+install(FILES jade.desktop DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES jade.svgz DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)
+install(FILES jade.copyright DESTINATION ${DATA_INSTALL_DIR}/kmahjongglib/tilesets/)