mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Merge branch 'master'
This commit is contained in:
commit
106f1c9dd9
@ -45,6 +45,9 @@ option(WITH_WEBP_SUPPORT "Enable support to load/save .webp files" off)
|
||||
option(WITH_GTK_FILE_DIALOG_SUPPORT "Enable support for the experimental native GTK File Dialog" off)
|
||||
option(WITH_DEPRECATED_GLIB_SUPPORT "Enable support for older glib versions" off)
|
||||
|
||||
option(WITH_DESKTOP_INTEGRATION "Enable desktop integration modules" on)
|
||||
option(WITH_QT_THUMBNAILER "Enable kde5/qt5 thumnailer" off)
|
||||
|
||||
option(USE_STATIC_LIBC "Use static version of C and C++ runtimes" off)
|
||||
option(USE_SHARED_CURL "Use your installed copy of curl" off)
|
||||
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
|
||||
@ -410,6 +413,10 @@ if(APPLE)
|
||||
endif(COMPILER_GCC)
|
||||
endif(APPLE)
|
||||
|
||||
if(WITH_DESKTOP_INTEGRATION)
|
||||
add_subdirectory(desktop)
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
# Main ASE targets
|
||||
|
||||
|
16
desktop/CMakeLists.txt
Normal file
16
desktop/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Aseprite Desktop Integration Module
|
||||
# Copyright (C) 2016 Gabriel Rauter
|
||||
#
|
||||
# Licensed under the the MIT License (https://opensource.org/licenses/MIT).
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(FILES mime/aseprite.xml
|
||||
DESTINATION share/mime/packages)
|
||||
install(PROGRAMS aseprite-thumbnailer
|
||||
DESTINATION bin)
|
||||
install(FILES gnome/aseprite.thumbnailer
|
||||
DESTINATION share/thumbnailers)
|
||||
if(WITH_QT_THUMBNAILER)
|
||||
add_subdirectory(kde)
|
||||
endif()
|
||||
endif()
|
19
desktop/aseprite-thumbnailer
Executable file
19
desktop/aseprite-thumbnailer
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
# Aseprite Desktop Integration Module
|
||||
# Copyright (C) 2016 Gabriel Rauter
|
||||
#
|
||||
# Licensed under the the MIT License (https://opensource.org/licenses/MIT).
|
||||
|
||||
if [ $# -ge 2 -a $# -lt 4 ]; then
|
||||
mkdir -p /tmp/Aseprite
|
||||
filename=${1//\//.}$RANDOM
|
||||
if [ $# -eq 2 ]; then
|
||||
aseprite -b --frame-range "0,0" $1 --sheet /tmp/Aseprite/$filename.png
|
||||
elif [ $# -eq 3 ]; then
|
||||
aseprite -b --frame-range "0,0" $1 --shrink-to "$3,$3" --sheet /tmp/Aseprite/$filename.png
|
||||
fi
|
||||
mkdir -p $(dirname "$2"); mv /tmp/Aseprite/$filename.png $2;
|
||||
else
|
||||
echo "Parameters for aseprite thumbnailer are: inputfile outputfile [size]"
|
||||
fi
|
4
desktop/gnome/aseprite.thumbnailer
Normal file
4
desktop/gnome/aseprite.thumbnailer
Normal file
@ -0,0 +1,4 @@
|
||||
[Thumbnailer Entry]
|
||||
TryExec=aseprite-thumbnailer
|
||||
Exec=aseprite-thumbnailer %i %o %s
|
||||
MimeType=image/bmp;image/gif;image/jpeg;image/png;image/x-pcx;image/x-tga;image/vnd.microsoft.icon;video/x-flic;image/webp;image/x-aseprite;
|
23
desktop/kde/CMakeLists.txt
Normal file
23
desktop/kde/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Aseprite Desktop Integration Module
|
||||
# Copyright (C) 2016 Gabriel Rauter
|
||||
#
|
||||
# Licensed under the the MIT License (https://opensource.org/licenses/MIT).
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
set(QT_MIN_VERSION "5.2.0")
|
||||
project(asepritethumbnail)
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
set(KDE_INSTALL_DIRS_NO_DEPRECATED, TRUE)
|
||||
include(FeatureSummary)
|
||||
include(WriteBasicConfigVersionFile)
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings)
|
||||
find_package(KF5 REQUIRED COMPONENTS KIO)
|
||||
add_definitions(${QT_DEFINITIONS} -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||
set(KDE_INSTALL_USE_QT_SYS_PATHS)
|
||||
add_library(asepritethumbnail MODULE aseprite_thumb_creator.cpp)
|
||||
target_link_libraries(asepritethumbnail KF5::KIOWidgets)
|
||||
install(TARGETS asepritethumbnail DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install(FILES asepritethumbnail.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
38
desktop/kde/aseprite_thumb_creator.cpp
Normal file
38
desktop/kde/aseprite_thumb_creator.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Aseprite Desktop Integration Module
|
||||
// Copyright (C) 2016 Gabriel Rauter
|
||||
//
|
||||
// Licensed under the the MIT License (https://opensource.org/licenses/MIT).
|
||||
|
||||
#include "aseprite_thumb_creator.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QFile>
|
||||
#include <QCryptographicHash>
|
||||
#include <cstdio>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
Q_DECL_EXPORT ThumbCreator *new_creator()
|
||||
{
|
||||
return new AsepriteThumbCreator();
|
||||
}
|
||||
};
|
||||
|
||||
bool AsepriteThumbCreator::create(const QString& path, int width, int height, QImage& img ) {
|
||||
QProcess process;
|
||||
QStringList list;
|
||||
QString tmpFile = QString(QCryptographicHash::hash(path.toLocal8Bit(),QCryptographicHash::Md5).toHex());
|
||||
list << path << tmpFile;
|
||||
process.start(QString("aseprite-thumbnailer"), list);
|
||||
if (!process.waitForFinished()) return false;
|
||||
img.load(tmpFile);
|
||||
QFile::remove(tmpFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
AsepriteThumbCreator::Flags AsepriteThumbCreator::flags() const
|
||||
{
|
||||
return DrawFrame;
|
||||
}
|
21
desktop/kde/aseprite_thumb_creator.h
Normal file
21
desktop/kde/aseprite_thumb_creator.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Aseprite Desktop Integration Module
|
||||
// Copyright (C) 2016 Gabriel Rauter
|
||||
//
|
||||
// Licensed under the the MIT License (https://opensource.org/licenses/MIT).
|
||||
|
||||
#ifndef _ASEPRITE_THUMBCREATOR_H_
|
||||
#define _ASEPRITE_THUMBCREATOR_H_
|
||||
#pragma once
|
||||
|
||||
#include <QLoggingCategory>
|
||||
Q_DECLARE_LOGGING_CATEGORY(LOG_ASEPRITE_THUMBCREATOR)
|
||||
|
||||
#include <kio/thumbcreator.h>
|
||||
|
||||
class AsepriteThumbCreator : public ThumbCreator {
|
||||
public:
|
||||
bool create(const QString& path, int width, int height, QImage& img) override;
|
||||
Flags flags() const override;
|
||||
};
|
||||
|
||||
#endif
|
8
desktop/kde/asepritethumbnail.desktop
Normal file
8
desktop/kde/asepritethumbnail.desktop
Normal file
@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Type=Service
|
||||
Name=Aseprite Pixel Art
|
||||
MimeType=image/bmp;image/gif;image/jpeg;image/png;image/x-pcx;image/x-tga;image/vnd.microsoft.icon;video/x-flic;image/webp;image/x-aseprite;
|
||||
X-KDE-ServiceTypes=ThumbCreator
|
||||
X-KDE-Library=asepritethumbnail
|
||||
CacheThumbnail=true
|
||||
ThumbnailerVersion=1
|
12
desktop/mime/aseprite.xml
Normal file
12
desktop/mime/aseprite.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="image/x-aseprite">
|
||||
<comment xml:lang="en">Aseprite Pixel Art</comment>
|
||||
<magic priority="50">
|
||||
<match type="little16" value="0xA5E0" offset="4"/>
|
||||
</magic>
|
||||
<glob pattern="*.ase"/>
|
||||
<glob pattern="*.aseprite"/>
|
||||
<icon name="aseprite"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
@ -242,7 +242,8 @@ if(USE_ALLEG4_BACKEND)
|
||||
target_link_libraries(she
|
||||
${LOADPNG_LIBRARY}
|
||||
${LIBALLEGRO4_LINK_FLAGS}
|
||||
${DXGUID_LIBRARIES})
|
||||
${DXGUID_LIBRARIES}
|
||||
${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(USE_SKIA_BACKEND)
|
||||
|
Loading…
x
Reference in New Issue
Block a user