-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0673a90
Showing
20 changed files
with
1,651 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
BasedOnStyle: WebKit | ||
|
||
Language: Cpp | ||
Standard: Cpp11 | ||
|
||
# Break before operators that aren’t assignments. | ||
BreakBeforeBinaryOperators: NonAssignment | ||
|
||
# Macros for which the opening brace stays attached. | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
- forever | ||
- Q_FOREVER | ||
- QBENCHMARK | ||
- QBENCHMARK_ONCE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(dynamic-wallpaper-importer) | ||
|
||
find_package(ECM 5.38 REQUIRED NO_MODULE) | ||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||
|
||
include(KDEInstallDirs) | ||
include(KDECMakeSettings) | ||
include(KDECompilerSettings NO_POLICY_SCOPE) | ||
include(FeatureSummary) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
add_subdirectory(src) | ||
|
||
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# dynamic-wallpaper-importer | ||
|
||
|
||
## Building dynamic-wallpaper-importer from Git | ||
|
||
Before building dynamic-wallpaper-importer from source code, you need to install | ||
a couple of prerequisites. | ||
|
||
Arch Linux: | ||
|
||
```sh | ||
sudo pacman -S libheif libplist qt5-base | ||
``` | ||
|
||
Once all prerequisites are installed, you need to grab the source code | ||
|
||
```sh | ||
git clone https://github.com/zzag/dynamic-wallpaper-importer.git | ||
cd dynamic-wallpaper-importer | ||
``` | ||
|
||
Configure the build | ||
|
||
```sh | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=/usr | ||
``` | ||
|
||
Now trigger the build by running the following command | ||
|
||
```sh | ||
make | ||
``` | ||
|
||
To install run | ||
|
||
```sh | ||
sudo make install | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
``` | ||
$ dynamic-wallpaper-importer --help | ||
Usage: dynamic-wallpaper-importer [options] | ||
Dynamic wallpaper importer | ||
Options: | ||
-h, --help Displays this help. | ||
-v, --version Displays version information. | ||
--format <png|jpg> Preferred image format. | ||
--source <file> Path to the source dynamic wallpaper. | ||
--id <id> Preferred id of the wallpaper. | ||
--label <label> Preferred name of the wallpaper. | ||
--target <directory> Directory where wallpaper will be stored. | ||
``` | ||
|
||
|
||
## Related | ||
|
||
* [plasma5-wallpapers-dynamic](https://github.com/zzag/plasma5-wallpapers-dynamic) - | ||
Dynamic wallpaper plugin for KDE Plasma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#.rst: | ||
# Findlibheif | ||
# ------- | ||
# | ||
# Try to find libheif on a Unix system. | ||
# | ||
# This will define the following variables: | ||
# | ||
# ``libheif_FOUND`` | ||
# True if (the requested version of) libheif is available | ||
# ``libheif_VERSION`` | ||
# The version of libheif | ||
# ``libheif_LIBRARIES`` | ||
# This should be passed to target_compile_options() if the target is not | ||
# used for linking | ||
# ``libheif_INCLUDE_DIRS`` | ||
# This should be passed to target_include_directories() if the target is not | ||
# used for linking | ||
# ``libheif_DEFINITIONS`` | ||
# This should be passed to target_compile_options() if the target is not | ||
# used for linking | ||
# | ||
# If ``libheif_FOUND`` is TRUE, it will also define the following imported target: | ||
# | ||
# ``libheif::libheif`` | ||
# The libheif library | ||
# | ||
# In general we recommend using the imported target, as it is easier to use. | ||
# Bear in mind, however, that if the target is in the link interface of an | ||
# exported library, it must be made available by the package config file. | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PKG_libheif QUIET libheif) | ||
|
||
set(libheif_VERSION ${PKG_libheif_VERSION}) | ||
set(libheif_DEFINITIONS ${PKG_libheif_CFLAGS_OTHER}) | ||
|
||
find_path(libheif_INCLUDE_DIR | ||
NAMES libheif/heif.h | ||
HINTS ${PKG_libheif_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(libheif_LIBRARY | ||
NAMES heif | ||
HINTS ${PKG_libheif_LIBRARY_DIRS} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(libheif | ||
FOUND_VAR libheif_FOUND | ||
REQUIRED_VARS libheif_LIBRARY | ||
libheif_INCLUDE_DIR | ||
VERSION_VAR libheif_VERSION | ||
) | ||
|
||
if (libheif_FOUND AND NOT TARGET libheif::libheif) | ||
add_library(libheif::libheif UNKNOWN IMPORTED) | ||
set_target_properties(libheif::libheif PROPERTIES | ||
IMPORTED_LOCATION "${libheif_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${libheif_DEFINITIONS}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${libheif_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
set(libheif_INCLUDE_DIRS ${libheif_INCLUDE_DIR}) | ||
set(libheif_LIBRARIES ${libheif_LIBRARY}) | ||
|
||
mark_as_advanced(libheif_INCLUDE_DIR) | ||
mark_as_advanced(libheif_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#.rst: | ||
# Findlibplist | ||
# ------- | ||
# | ||
# Try to find libplist on a Unix system. | ||
# | ||
# This will define the following variables: | ||
# | ||
# ``libplist_FOUND`` | ||
# True if (the requested version of) libplist is available | ||
# ``libplist_VERSION`` | ||
# The version of libplist | ||
# ``libplist_LIBRARIES`` | ||
# This should be passed to target_compile_options() if the target is not | ||
# used for linking | ||
# ``libplist_INCLUDE_DIRS`` | ||
# This should be passed to target_include_directories() if the target is not | ||
# used for linking | ||
# ``libplist_DEFINITIONS`` | ||
# This should be passed to target_compile_options() if the target is not | ||
# used for linking | ||
# | ||
# If ``libplist_FOUND`` is TRUE, it will also define the following imported target: | ||
# | ||
# ``libplist::libplist`` | ||
# The libplist library | ||
# | ||
# In general we recommend using the imported target, as it is easier to use. | ||
# Bear in mind, however, that if the target is in the link interface of an | ||
# exported library, it must be made available by the package config file. | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PKG_libplist QUIET libplist) | ||
|
||
set(libplist_VERSION ${PKG_libplist_VERSION}) | ||
set(libplist_DEFINITIONS ${PKG_libplist_CFLAGS_OTHER}) | ||
|
||
find_path(libplist_INCLUDE_DIR | ||
NAMES plist/plist.h | ||
HINTS ${PKG_libplist_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(libplist_LIBRARY | ||
NAMES plist | ||
HINTS ${PKG_libplist_LIBRARY_DIRS} | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(libplist | ||
FOUND_VAR libplist_FOUND | ||
REQUIRED_VARS libplist_LIBRARY | ||
libplist_INCLUDE_DIR | ||
VERSION_VAR libplist_VERSION | ||
) | ||
|
||
if (libplist_FOUND AND NOT TARGET libplist::libplist) | ||
add_library(libplist::libplist UNKNOWN IMPORTED) | ||
set_target_properties(libplist::libplist PROPERTIES | ||
IMPORTED_LOCATION "${libplist_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${libplist_DEFINITIONS}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${libplist_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
set(libplist_INCLUDE_DIRS ${libplist_INCLUDE_DIR}) | ||
set(libplist_LIBRARIES ${libplist_LIBRARY}) | ||
|
||
mark_as_advanced(libplist_INCLUDE_DIR) | ||
mark_as_advanced(libplist_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
find_package(Qt5 REQUIRED COMPONENTS | ||
Core | ||
Gui | ||
Xml | ||
) | ||
|
||
add_library(dynamicwallpaperimportercommon SHARED | ||
Importer.cc | ||
Loader.cc | ||
Wallpaper.cc | ||
Writer.cc | ||
) | ||
|
||
target_link_libraries(dynamicwallpaperimportercommon | ||
Qt5::Core | ||
Qt5::Gui | ||
) | ||
|
||
add_executable(dynamic-wallpaper-importer | ||
main.cc | ||
) | ||
|
||
target_link_libraries(dynamic-wallpaper-importer | ||
Qt5::Core | ||
Qt5::Gui | ||
|
||
dynamicwallpaperimportercommon | ||
) | ||
|
||
add_subdirectory(importers) | ||
|
||
install(TARGETS dynamicwallpaperimportercommon ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) | ||
install(TARGETS dynamic-wallpaper-importer ${INSTALL_TARGETS_DEFAULT_ARGS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2019 Vlad Zahorodnii <vladzzag@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include "Importer.h" | ||
|
||
Importer::Importer(QObject* parent) | ||
: QObject(parent) | ||
{ | ||
} | ||
|
||
Importer::~Importer() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2019 Vlad Zahorodnii <vladzzag@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QMimeType> | ||
#include <QObject> | ||
|
||
#include <memory> | ||
|
||
class Wallpaper; | ||
|
||
class Q_DECL_EXPORT Importer : public QObject { | ||
Q_OBJECT | ||
|
||
public: | ||
explicit Importer(QObject* parent = nullptr); | ||
~Importer() override; | ||
|
||
/** | ||
* Returns the list of supported mime types. | ||
*/ | ||
virtual QVector<QMimeType> supportedMimeTypes() const = 0; | ||
|
||
/** | ||
* Attempts to load a dynamic wallpaper with the given @p fileName. | ||
* | ||
* This method will return @c null, if the importer failed to load the wallpaper. | ||
*/ | ||
virtual std::unique_ptr<Wallpaper> load(const QString& fileName) const = 0; | ||
|
||
private: | ||
Q_DISABLE_COPY(Importer) | ||
}; | ||
|
||
Q_DECLARE_INTERFACE(Importer, "com.github.zzag.wallpaper.Importer") |
Oops, something went wrong.