commit kiconthemes for openSUSE:Factory
Hello community, here is the log from the commit of package kiconthemes for openSUSE:Factory checked in at 2014-04-02 17:22:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kiconthemes (Old) and /work/SRC/openSUSE:Factory/.kiconthemes.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kiconthemes" Changes: -------- --- /work/SRC/openSUSE:Factory/kiconthemes/kiconthemes.changes 2014-03-10 12:18:07.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kiconthemes.new/kiconthemes.changes 2014-04-02 17:22:16.000000000 +0200 @@ -1,0 +2,9 @@ +Sat Mar 29 19:47:39 UTC 2014 - hrvoje.senjan@gmail.com + +- Update to 4.98.0 + * API improvements and cleanups + * Buildsystem fixes + * For more details please see: + http://www.kde.org/announcements/announce-frameworks5-beta1.php + +------------------------------------------------------------------- Old: ---- kiconthemes-4.97.0.tar.xz New: ---- kiconthemes-4.98.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiconthemes.spec ++++++ --- /var/tmp/diff_new_pack.OT9MU7/_old 2014-04-02 17:22:17.000000000 +0200 +++ /var/tmp/diff_new_pack.OT9MU7/_new 2014-04-02 17:22:17.000000000 +0200 @@ -18,10 +18,10 @@ %define lname libKF5IconThemes5 Name: kiconthemes -Version: 4.97.0 +Version: 4.98.0 Release: 0 BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 0.0.11 +BuildRequires: extra-cmake-modules >= 0.0.12 BuildRequires: fdupes BuildRequires: kconfigwidgets-devel >= %{_kf5_version} BuildRequires: kf5-filesystem ++++++ kiconthemes-4.97.0.tar.xz -> kiconthemes-4.98.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/CMakeLists.txt new/kiconthemes-4.98.0/CMakeLists.txt --- old/kiconthemes-4.97.0/CMakeLists.txt 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/CMakeLists.txt 2014-03-28 19:16:57.000000000 +0100 @@ -3,7 +3,7 @@ project(KIconThemes) # ECM setup -find_package(ECM 0.0.11 REQUIRED NO_MODULE) +find_package(ECM 0.0.12 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) @@ -15,7 +15,7 @@ include(ECMGenerateHeaders) include(ECMMarkNonGuiExecutable) -set(KF5_VERSION "4.97.0") +set(KF5_VERSION "4.98.0") ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KICONTHEMES @@ -24,10 +24,10 @@ SOVERSION 5) # Dependencies -set(QT_REQUIRED_VERSION 5.2.0) -find_package(Qt5Widgets ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE) -find_package(Qt5Svg ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE) -find_package(Qt5DBus ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE) +set(REQUIRED_QT_VERSION 5.2.0) +find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) +find_package(Qt5Svg ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) +find_package(Qt5DBus ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") find_package(KF5I18n ${KF5_VERSION} REQUIRED) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/KF5IconThemesConfig.cmake.in new/kiconthemes-4.98.0/KF5IconThemesConfig.cmake.in --- old/kiconthemes-4.97.0/KF5IconThemesConfig.cmake.in 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/KF5IconThemesConfig.cmake.in 2014-03-28 19:16:57.000000000 +0100 @@ -5,7 +5,7 @@ find_dependency(KF5ItemViews "@KF5_VERSION@") find_dependency(KF5WidgetsAddons "@KF5_VERSION@") -find_dependency(Qt5Widgets "@QT_REQUIRED_VERSION@") +find_dependency(Qt5Widgets "@REQUIRED_QT_VERSION@") include("${CMAKE_CURRENT_LIST_DIR}/KF5IconThemesTargets.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/docs/DESIGN.iconloading new/kiconthemes-4.98.0/docs/DESIGN.iconloading --- old/kiconthemes-4.97.0/docs/DESIGN.iconloading 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/docs/DESIGN.iconloading 1970-01-01 01:00:00.000000000 +0100 @@ -1,187 +0,0 @@ -Discussion of Icon Loading for KDE 3 -==================================================== - -This document describes the design ideas for improving icon loading -in KDE 3. - - -On Wednesday 08 August 2001 04:15 pm, Waldo Bastian wrote: -> On Wednesday 08 August 2001 03:52 pm, Dirk Mueller wrote: -> > On Mit, 08 Aug 2001, Waldo Bastian wrote: -> > > I'm not really sure how to do it... the idea is this: -> > > -> > > A list of shared icons is published somewhere. -> > > Applications load this list -> > > For all icons the application wants to use: -> > > It checks whether a shared version is available, -> > > if so it uses that one. -> > > If not, it loads the icon. -> > > When it has loaded most icons, it somehow (*) adds the icons that it loaded -> > > to the list of published icons. -> > > -> > > I think that the somehow (*) part can be done most reliable by a -> > > central service, e.g. a KDED module. That might also be able to keep -> > > track of usage so that it can throw icons out that aren't used any -> > > more. I think it will be difficult / slow if we need to do ref-counting -> > > for each and every shared icon using some mechanism that involves X. -> > -> > True. but things become a bit complicated if an application reregisters -> > with a different name. or do we handle that already ? -> > -> > what do you do if the DCOP-connection lifetime is crossing the -> > pixmap-lifetime somehow, i.e. the pixmap is still referenced after -> > closing the dcop connection on shutdown ? - -Ok, I have looked into this a bit more and it seems to be rather easy to -create one or more pixmaps in a server process containing icons, a client can -then create a pixmap of the right size itself and with a simple XCopyArea -call, it can copy the icon from the server pixmap to its own pixmap. - -That way the application's pixmap always remain valid. - -Some example code to get the idea: - -Server can publish an icon (test.png) like this: - QImage i("test.png"); - QPixmap p; - p.convertFromImage(i); - qWarning("Handle = %08x", p.handle()); - -Now, if Handle is e.g. 0x06c0000b, the following code (in another process) -can copy this pixmap: - - QPixmap p(35,35); - Drawable src = 0x06c0000b; - XGCValues values; - GC gc = XCreateGC(qt_xdisplay(), src, 0, &values); - XCopyArea(qt_xdisplay(), src, p.handle(), gc, 0, 0, 30, 30, 0, 0); - // p contains now 30x30 pixels of test.png. - -The only hard part is then to publish the icons in a way that applications -know what to copy. I'm thinking about a ksycoca-sort-of index that -applications can map and can use to do fast lookups with. This has no major -problems except for the race-condition that might exist when an icon is -removed. In that case you will remove it from the index first and then later -you will remove the actual image data from the pixmap, however, you must make -sure that none of the client apps will be using the outdated index informatin -any more before you can remove the actual image data. - -For practical purposes that might be solved by removing the entry from the -index, informing the applications via DCOP to flush their outdated index -information and then waiting for a sufficient long period, e.. 5 minutes, -before actually removing the image data. - -I can also imagine a scenario where the index information is only used very -temporarily, e.g. during the creation of a KMainWindow (mmap the file in the -constructor, unmap it from the next event loop) that way icons can be removed -from the index and after e.g. a timeout of 5 minutes one can be relatively -sure that the index will no longer be used. - -I think the best way to distribute the index information is through the file -system but the update mechanism for this file should probably more complex -than the one used in ksycoca. Since ksycoca updates only happen once in a -while, we can afford it to write out a whole new file. For icons this will -probably be more difficult since updates will be part of normal operation, if -the index file is rather large (no idea about that.. how much icons are in -use on an average desktop? 50? 200? 500? 500*80bytes = 40Kb, not too bad) we -might want to write out only the updates, that would probably mean that we -need to have some sort of extensible on-disk hash-table. -Would that be worth the hassle? If we need to access hash-buckets throughout -this 40Kb the OS probably ends up writing all of this file to disk ayway. - -Better keep it simple to start with then... - -Cheers, -Waldo --- -KDE 2.2: We deliver. - -<Zogje> do you have any idea how many Kb of pixmaps are stored in the X-server on average? -<Zogje> e.g. with a standard desktop with 5 konsole's and konqueror or os -<Zogje> cause I was wondering... if we copy pixmaps on the X-server with XCopyArea like I proposed in my mail -<Zogje> then the next step could be to use shared pixmaps on the X-server... if the X-server could refcount pixmaps -<Zogje> i don't think it supports that at the moment -<antlarr> I'm not sure, but Konqueror seems to open around 500 icons (some of them repeated), and konsole... 40 ? (I made the experiments with my other computer and it's down at the moment) -<Zogje> and those icons are 22x22? 32x32? -<Zogje> 4 bytes per pixel? -<antlarr> I can have a look to see the sizes (my original experiments counted them in separate counters) -<antlarr> yes, 4 bytes per pixel -<Zogje> that's about 1.5Kb to 4Kb per pixmap -<Zogje> cause I think pixmap space on the X_server is a limited resource -<Zogje> it prolly can cache them in video-memory -<antlarr> Zogje: what worries me most is how to know when to delete a pixmap from X -<Zogje> but if we have the same pixmap 20 times in the X-server -<Zogje> then we are wasting such caching in a terrible way.. and that would cost us performance -<Zogje> antlarr: yes, that's why I say, we would need refcounting in the X-server itself -<Zogje> antlarr: should talk with Keith about that -<antlarr> Zogje: but if you unload the icon after all apps stop using it, then there's no benefit after you start konqueror again, because they'll have to be loaded again -<Zogje> antlarr: but it will be easier to make the point if we have some solid data behind it -<Zogje> antlarr: well.. there are two issues -<antlarr> you'll just stop loading repeated icons that way -<Zogje> 1) you want to have the benefit of caching, and for that you want to have the icon in the cache, you can throw it away after some time if you think it will not be needed any longer -<Zogje> 2) If you actually _share_ the pixmap, you must 100% guarante that the pixmap remains available as long as it is in use -<Zogje> so for the 1)-case there is no hard requirement, it just affects your cache-efficiency -<Zogje> the 2)-case is a hard requirement, in that if you don't meet it, you will have incorrect operation -<antlarr> Zogje: yes -<Zogje> we can meet 2) by coying the pixmap with e.g. XCopyArea -<Zogje> but a better way would be to have refcounting in the server -<Zogje> that's independent from 1) -<antlarr> Yes, that would be much better -<Zogje> antlarr: so if you can provide staticstic on the icons in use on a typical KDE desktop, including total size and number of icons shared, etc. -<antlarr> Zogje: ok, I'll try it tomorrow morning (I think I'll have some time, but little as I'm trying to study for exams) -<antlarr> Btw, do you plan to use a kind of "icon server" ? -<Zogje> antlarr: then we can take that to the XFree guys and say, if you gives us refcounting we can save XXX Kb of pixmap data on the x-server and we think that will give us better performance -<antlarr> Yes, you're right, that would be the best thing to do -<Zogje> in the mean time we might want to implement such an icon-server then, so that when they actually make ref-counting we can hook it in and get the results directly -<antlarr> So you think the apps should load the icon, apply the effects, convert it to a X pixmap and use it. But how do you plan to know if an icon is already in the XServer ? via atoms ? -<antlarr> s/an icon/an icon with the respective effects applied/ -<antlarr> pmax: that's precisely where I want to get to. -<Zogje> antlarr: I would like to publish an index of the icons and their handles through the filesystem -<Zogje> the app loads the icon, applies the effects, when it has finished starting up it -<Zogje> can make a DCOP call to the icon-server and tell it, here, I'm using these icons -<Zogje> then the icon-server can copy (or refcount++) them and update the file with the -<Zogje> published icons -<antlarr> Ok, so there'll be an icon server -<Zogje> yes -<antlarr> Zogje: you can never know when the app has finished starting up, as it can load some icons later than that -<Zogje> you could basically publish the icons via properties on the X server itself as well -<Zogje> but I think that will be slow -<antlarr> Zogje: yes, I think that too -<antlarr> But I'm not sure about the file with published icons -<Zogje> well, when it loads icons later on, it can tell the icon-server about them later on -<Zogje> or just ignore it -<Zogje> whatever works -<antlarr> what happens with remote connections of apps running on different hosts ? -<Zogje> they are on their own -<pmax> over a slow link -<pmax> icon server becomes n times slower, right? -<Zogje> pmax: when? -<pmax> remote X connections -<antlarr> pmax: it doesn't matter if it's a slow or fast link, I'm talking about the problem with loaded icons that are available on one of the computers, but not on another and about the file with the published icons -<Zogje> pmax: if you use X properties you have X-server round-trips, so that will be an issue on slow-links -<pmax> antlarr: true -<Zogje> pmax: you don't have that if you use the file-system -<pmax> you can always send icons back and forth with dcop too though -<Zogje> antlarr: we have a DCOP communication space that is limited to a certain host and X-Display -<pmax> I send x.509's pem encoded through dcop -<Zogje> antlarr: icon caching should happen within that space -<Zogje> antlarr: you can combine multiple spaces in various ways... but they don't communicate with each other -<Zogje> pmax: no, i don't plan too -<Zogje> pmax: it is faster to load the icon from disk than to use dcop, probably -<antlarr> Zogje: ok -<pmax> Zogje: certainly, but if there is a case where the icon doesn't exist on a remote machine, it could easily be transferred like that -<Zogje> pmax: if the icons doesn't exist you haven't instaled KDE correctly -<pmax> (I was referring to antlarr's comment) -<antlarr> pmax: why do that if you can just store it in the X server and tell the icon server what icon is yours? -<pmax> what about an app that is only on one machine but not the other? then it's icons won't be there -<Zogje> pmax?? -<pmax> antlarr: I'm not saying that's the best way.. I was just saying it's a possibility -<Zogje> pmax: how does that work now? -<antlarr> pmax: Zogje is right, there's no problem with remote apps, it will just not use the icon cache, nothing more -<vod> just found it -<pmax> oh I see -<Zogje> to answer you rfirst question: "won't the ipc be a bottleneck?" no, because you don't use ipc in the critical part (the icon loading) -<pmax> yup I understand how it works now I think -<Zogje> instead you access an index from disk which is quite fast (as fast as ksycoca) -<pmax> I think this will definitely speed things up on my machine since I have a relatively fast box with slow disks -<Zogje> that's why I want to use the file-system instaed of X-properties diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/CMakeLists.txt new/kiconthemes-4.98.0/src/CMakeLists.txt --- old/kiconthemes-4.97.0/src/CMakeLists.txt 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/src/CMakeLists.txt 2014-03-28 19:16:57.000000000 +0100 @@ -1,4 +1,7 @@ add_subdirectory(tools/kiconfinder) +if (APPLE) + add_subdirectory(tools/ksvg2icns) +endif() set(kiconthemes_SRCS kiconbutton.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/Messages.sh new/kiconthemes-4.98.0/src/Messages.sh --- old/kiconthemes-4.97.0/src/Messages.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/kiconthemes-4.98.0/src/Messages.sh 2014-03-28 19:16:57.000000000 +0100 @@ -0,0 +1,18 @@ +#!/bin/sh + +# Invoke the extractrc script on all .ui, .rc, and .kcfg files in the sources. +# The results are stored in a pseudo .cpp file to be picked up by xgettext. +lst=`find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` +if [ -n "$lst" ] ; then + $EXTRACTRC $lst >> rc.cpp +fi + +# If your framework contains tips-of-the-day, call preparetips as well. +if [ -f "data/tips" ] ; then + ( cd data && $PREPARETIPS > ../tips.cpp ) +fi + +# Extract strings from all source files. +# If your framework depends on KI18n, use $XGETTEXT. If it uses Qt translation +# system, use $EXTRACT_TR_STRINGS. +$XGETTEXT `find . -name \*.cpp -o -name \*.h -name \*.qml` -o $podir/kiconthemes5.pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/kiconbutton.h new/kiconthemes-4.98.0/src/kiconbutton.h --- old/kiconthemes-4.97.0/src/kiconbutton.h 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/src/kiconbutton.h 2014-03-28 19:16:57.000000000 +0100 @@ -31,25 +31,26 @@ class KICONTHEMES_EXPORT KIconButton: public QPushButton { Q_OBJECT - Q_PROPERTY(QString icon READ icon WRITE setIcon RESET resetIcon) + Q_PROPERTY(QString icon READ icon WRITE setIcon RESET resetIcon NOTIFY iconChanged USER true) Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize) Q_PROPERTY(bool strictIconSize READ strictIconSize WRITE setStrictIconSize) public: /** - * Constructs a KIconButton using the global iconloader. + * Constructs a KIconButton using the global icon loader. * * @param parent The parent widget. */ explicit KIconButton(QWidget *parent = 0L); /** - * Constructs a KIconButton using a specific KIconLoader. + * Constructs a KIconButton using a specific icon loader. * * @param loader The icon loader to use. * @param parent The parent widget. */ KIconButton(KIconLoader *loader, QWidget *parent); + /** * Destructs the button. */ @@ -57,7 +58,7 @@ /** * Sets a strict icon size policy for allowed icons. When true, - * only icons of the specified group's size in setIconType are allowed, + * only icons of the specified group's size in setIconType() are allowed, * and only icons of that size will be shown in the icon dialog. */ void setStrictIconSize(bool b); @@ -95,23 +96,21 @@ * @see iconSize */ void setIconSize(int size); - /** - * Returns the iconsize set via setIconSize() or 0, if the default - * iconsize will be used. + * Returns the icon size set via setIconSize() or 0, if the default + * icon size will be used. */ int iconSize() const; /** - * Sets the size of the icon to be shown on the button + * Sets the size of the icon to be shown on the button. * @see KIconLoader::StdSizes * @see buttonIconSize * @since 4.1 */ void setButtonIconSize(int size); - /** - * Returns the Button's Icon-Size + * Returns the button's icon size. * @since 4.1 */ int buttonIconSize() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/kicondialog.h new/kiconthemes-4.98.0/src/kicondialog.h --- old/kiconthemes-4.97.0/src/kicondialog.h 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/src/kicondialog.h 2014-03-28 19:16:57.000000000 +0100 @@ -24,7 +24,7 @@ /** * Dialog for interactive selection of icons. Use the function - * getIcon() let the user select an icon. + * getIcon() to let the user select an icon. * * @short An icon selection dialog. */ @@ -34,14 +34,14 @@ public: /** - * Constructs an icon selection dialog using the global iconloader. + * Constructs an icon selection dialog using the global icon loader. * * @param parent The parent widget. */ explicit KIconDialog(QWidget *parent = 0L); /** - * Constructs an icon selection dialog using a specific iconloader. + * Constructs an icon selection dialog using a specific icon loader. * * @param loader The icon loader to use. * @param parent The parent widget. @@ -54,18 +54,22 @@ ~KIconDialog(); /** - * Sets a strict icon size policy for allowed icons. When true, - * only icons of the specified group's size in getIcon() are shown. + * Sets a strict icon size policy for allowed icons. + * + * @param policy When true, only icons of the specified group's + * size in getIcon() are shown. * When false, icons not available at the desired group's size will * also be selectable. */ - void setStrictIconSize(bool b); + void setStrictIconSize(bool policy); /** * Returns true if a strict icon size policy is set. */ bool strictIconSize() const; + /** - * sets a custom icon directory + * Sets the location of the custom icon directory. Only local directory + * paths are allowed. */ void setCustomLocation(const QString &location); @@ -75,20 +79,18 @@ * @see iconSize */ void setIconSize(int size); - /** - * Returns the iconsize set via setIconSize() or 0, if the default - * iconsize will be used. + * Returns the icon size set via setIconSize() or 0, if the default + * icon size will be used. */ int iconSize() const; /** * Allows you to set the same parameters as in the class method * getIcon(), as well as two additional parameters to lock - * the choice between system and user dirs and to lock the custom user - * dir itself. + * the choice between system and user directories and to lock the + * custom icon directory itself. */ - void setup(KIconLoader::Group group, KIconLoader::Context context = KIconLoader::Application, bool strictIconSize = false, int iconSize = 0, @@ -104,7 +106,7 @@ QString openDialog(); /** - * show()es this dialog and emits a newIcon(const QString&) signal when + * show()s this dialog and emits a newIconName(const QString&) signal when * successful. QString() will be emitted if the dialog was aborted. */ void showDialog(); @@ -120,7 +122,7 @@ * @param strictIconSize When true, only icons of the specified group's size * are shown, otherwise icon not available in the desired group's size * will also be selectable. - * @param iconSize the size of the icons -- the default of the icongroup + * @param iconSize the size of the icons -- the default of the icon group * if set to 0 * @param user Begin with the "user icons" instead of "system icons". * @param parent The parent widget of the dialog. @@ -134,7 +136,7 @@ const QString &caption = QString()); Q_SIGNALS: - void newIconName(const QString &); + void newIconName(const QString &iconName); protected Q_SLOTS: void slotOk(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/kiconeffect.h new/kiconthemes-4.98.0/src/kiconeffect.h --- old/kiconthemes-4.97.0/src/kiconeffect.h 2014-03-01 12:50:56.000000000 +0100 +++ new/kiconthemes-4.98.0/src/kiconeffect.h 2014-03-28 19:16:57.000000000 +0100 @@ -62,9 +62,9 @@ * Note that 'LastEffect' is no valid icon effect but only * used internally to check for invalid icon effects. * - * @li NoEffect: Don't apply any icon effect + * @li NoEffect: Do not apply any icon effect * @li ToGray: Tints the icon gray - * @li Colorize: Tints the icon with an other color + * @li Colorize: Tints the icon with a specific color * @li ToGamma: Change the gamma value of the icon * @li DeSaturate: Reduce the saturation of the icon * @li ToMonochrome: Produces a monochrome icon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/tools/ksvg2icns/CMakeLists.txt new/kiconthemes-4.98.0/src/tools/ksvg2icns/CMakeLists.txt --- old/kiconthemes-4.97.0/src/tools/ksvg2icns/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kiconthemes-4.98.0/src/tools/ksvg2icns/CMakeLists.txt 2014-03-28 19:16:57.000000000 +0100 @@ -0,0 +1,5 @@ +add_executable(ksvg2icns ksvg2icns.cpp) +ecm_mark_nongui_executable(ksvg2icns) +target_link_libraries(ksvg2icns Qt5::Gui Qt5::Svg) + +install(TARGETS ksvg2icns ${INSTALL_TARGETS_DEFAULT_ARGS}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-4.97.0/src/tools/ksvg2icns/ksvg2icns.cpp new/kiconthemes-4.98.0/src/tools/ksvg2icns/ksvg2icns.cpp --- old/kiconthemes-4.97.0/src/tools/ksvg2icns/ksvg2icns.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kiconthemes-4.98.0/src/tools/ksvg2icns/ksvg2icns.cpp 2014-03-28 19:16:57.000000000 +0100 @@ -0,0 +1,162 @@ +/****************************************************************************** + * Copyright 2014 Harald Fernengel <harry@kdevelop.org> * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) version 3, or any * + * later version accepted by the membership of KDE e.V. (or its * + * successor approved by the membership of KDE e.V.), which shall * + * act as a proxy defined in Section 6 of version 3 of the license. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. If not, see * + * <http://www.gnu.org/licenses/>. * + * * + ******************************************************************************/ + +/* This tool converts an svg to a Mac OS X icns file. + * Note: Requires the 'iconutil' Mac OS X binary + */ + +#include <QCommandLineParser> +#include <QFileInfo> +#include <QProcess> +#include <QTemporaryDir> + +#include <QGuiApplication> +#include <QPainter> +#include <QSvgRenderer> + +#include "../../../kiconthemes_version.h" + +#include <stdio.h> + +#define EXIT_ON_ERROR(isOk, ...) \ + do { \ + if (!(isOk)) { \ + fprintf(stderr, __VA_ARGS__); \ + return 1; \ + } \ + } while (false); + +static bool writeImage(QSvgRenderer &svg, int size, const QString &outFile1, const QString &outFile2 = QString()) +{ + QImage out(size, size, QImage::Format_ARGB32); + out.fill(Qt::transparent); + + QPainter painter(&out); + svg.render(&painter); + painter.end(); + + if (!out.save(outFile1)) { + fprintf(stderr, "Unable to write %s\n", qPrintable(outFile1)); + return false; + } + if (!outFile2.isEmpty() && !out.save(outFile2)) { + fprintf(stderr, "Unable to write %s\n", qPrintable(outFile2)); + return false; + } + + return true; +} + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + app.setApplicationName("ksvg2icns"); + app.setApplicationVersion(KICONTHEMES_VERSION_STRING); + QCommandLineParser parser; + parser.setApplicationDescription(app.translate("main", "Creates an icns file from an svg image")); + parser.addPositionalArgument("iconname", app.translate("main", "The svg icon to convert")); + parser.addHelpOption(); + + parser.process(app); + if (parser.positionalArguments().isEmpty()) { + parser.showHelp(); + return 1; + } + + bool isOk; + + // create a temporary dir to create an iconset + QTemporaryDir tmpDir("ksvg2icns"); + tmpDir.setAutoRemove(true); + + isOk = tmpDir.isValid(); + EXIT_ON_ERROR(isOk, "Unable to create temporary directory\n"); + + isOk = QDir(tmpDir.path()).mkdir("out.iconset"); + EXIT_ON_ERROR(isOk, "Unable to create out.iconset directory\n"); + + const QString outPath = tmpDir.path() + "/out.iconset"; + + const QStringList &args = app.arguments(); + EXIT_ON_ERROR(args.size() == 2, + "Usage: %s svg-image\n", + qPrintable(args.value(0))); + + const QString &svgFileName = args.at(1); + + // open the actual svg file + QSvgRenderer svg; + isOk = svg.load(svgFileName); + EXIT_ON_ERROR(isOk, "Unable to load %s\n", qPrintable(svgFileName)); + + // The sizes are from: + // https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conc... + + struct OutFiles + { + int size; + QString out1; + QString out2; + }; + + // create the pngs in various resolutions + const OutFiles outFiles[] = { + { 1024, outPath + "/icon_512x512@2x.png", QString() }, + { 512, outPath + "/icon_512x512.png", outPath + "/icon_256x256@2x.png" }, + { 256, outPath + "/icon_256x256.png", outPath + "/icon_128x128@2x.png" }, + { 128, outPath + "/icon_128x128.png", QString() }, + { 64, outPath + "/icon_32x32@2x.png", QString() }, + { 32, outPath + "/icon_32x32.png", outPath + "/icon_16x16@2x.png" }, + { 16, outPath + "/icon_16x16.png", QString() } + }; + + for (size_t i = 0; i < sizeof(outFiles) / sizeof(OutFiles); ++i) { + isOk = writeImage(svg, outFiles[i].size, outFiles[i].out1, outFiles[i].out2); + if (!isOk) { + return 1; + } + } + + // convert the iconset to icns using the "iconutil" command + + const QString outIcns = QFileInfo(svgFileName).baseName() + ".icns"; + + const QStringList utilArgs = QStringList() + << "-c" << "icns" + << "-o" << outIcns + << outPath; + + QProcess iconUtil; + iconUtil.setProgram("iconUtil"); + iconUtil.setArguments(utilArgs); + + iconUtil.start("iconutil", utilArgs, QIODevice::ReadOnly); + isOk = iconUtil.waitForFinished(-1); + EXIT_ON_ERROR(isOk, "Unable to launch iconutil: %s\n", qPrintable(iconUtil.errorString())); + + EXIT_ON_ERROR(iconUtil.exitStatus() == QProcess::NormalExit, "iconutil crashed!\n"); + EXIT_ON_ERROR(iconUtil.exitCode() == 0, "iconutil returned %d\n", iconUtil.exitCode()); + + return 0; +} -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de