Use JS provider defs provided by qtutilities

This commit is contained in:
Martchus 2017-03-14 23:24:10 +01:00
parent 039f64584e
commit b34a0e635f
8 changed files with 94 additions and 30 deletions

View File

@ -9,6 +9,7 @@ set(META_APP_AUTHOR "Martchus")
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META_APP_DESCRIPTION "A tageditor with Qt GUI and command line interface. Supports MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska")
set(META_GUI_OPTIONAL true)
set(META_JS_SRC_DIR renamingutility)
set(META_VERSION_MAJOR 2)
set(META_VERSION_MINOR 2)
set(META_VERSION_PATCH 1)
@ -71,7 +72,6 @@ set(WIDGETS_HEADER_FILES
renamingutility/filesystemitemmodel.h
renamingutility/filteredfilesystemitemmodel.h
renamingutility/renamingengine.h
renamingutility/scriptdefs.h
renamingutility/tageditorobject.h
)
set(WIDGETS_SRC_FILES

View File

@ -1,5 +1,8 @@
#ifndef SCRIPTDEFS_H
#define SCRIPTDEFS_H
// Created via CMake from template webviewdefs.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_JAVA_SCRIPT_DEFINES
#define TAGEDITOR_JAVA_SCRIPT_DEFINES
#include <QtGlobal>
@ -11,8 +14,6 @@
# define TAGEDITOR_JS_QOBJECT(engine, obj) engine.newQObject(obj)
# define TAGEDITOR_JS_INT(value) value.toInt()
# define TAGEDITOR_JS_IS_VALID_PROG(program) (!program.isError() && program.isCallable())
QT_FORWARD_DECLARE_CLASS(QJSValue)
QT_FORWARD_DECLARE_CLASS(QJSEngine)
#elif defined(TAGEDITOR_USE_SCRIPT)
# define TAGEDITOR_JS_ENGINE QScriptEngine
# define TAGEDITOR_JS_VALUE QScriptValue
@ -21,8 +22,15 @@ QT_FORWARD_DECLARE_CLASS(QJSEngine)
# define TAGEDITOR_JS_QOBJECT(engine, obj) engine.newQObject(obj, QScriptEngine::ScriptOwnership)
# define TAGEDITOR_JS_INT(value) value.toInt32()
# define TAGEDITOR_JS_IS_VALID_PROG(program) (!program.isError() && program.isFunction())
QT_FORWARD_DECLARE_CLASS(QScriptValue)
QT_FORWARD_DECLARE_CLASS(QScriptEngine)
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for JavaScript provider present."
#endif
#endif // SCRIPTDEFS_H
#ifdef TAGEDITOR_JS_ENGINE
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_JS_ENGINE)
#endif
#ifdef TAGEDITOR_JS_VALUE
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_JS_VALUE)
#endif
#endif // TAGEDITOR_JAVA_SCRIPT_DEFINES

19
gui/jsincludes.h Normal file
View File

@ -0,0 +1,19 @@
// Created via CMake from template webviewdefs.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_JAVA_SCRIPT_INCLUDES
#define TAGEDITOR_JAVA_SCRIPT_INCLUDES
#include <QtGlobal>
#if defined(TAGEDITOR_USE_JSENGINE)
# include <QJSEngine>
# include <QJSValue>
#elif defined(TAGEDITOR_USE_SCRIPT)
# include <QScriptEngine>
# include <QScriptValue>
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for JavaScript provider present."
#endif
#endif // TAGEDITOR_JAVA_SCRIPT_INCLUDES

36
renamingutility/jsdefs.h Normal file
View File

@ -0,0 +1,36 @@
// Created via CMake from template webviewdefs.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_JAVA_SCRIPT_DEFINES
#define TAGEDITOR_JAVA_SCRIPT_DEFINES
#include <QtGlobal>
#if defined(TAGEDITOR_USE_JSENGINE)
# define TAGEDITOR_JS_ENGINE QJSEngine
# define TAGEDITOR_JS_VALUE QJSValue
# define TAGEDITOR_JS_READONLY
# define TAGEDITOR_JS_UNDELETABLE
# define TAGEDITOR_JS_QOBJECT(engine, obj) engine.newQObject(obj)
# define TAGEDITOR_JS_INT(value) value.toInt()
# define TAGEDITOR_JS_IS_VALID_PROG(program) (!program.isError() && program.isCallable())
#elif defined(TAGEDITOR_USE_SCRIPT)
# define TAGEDITOR_JS_ENGINE QScriptEngine
# define TAGEDITOR_JS_VALUE QScriptValue
# define TAGEDITOR_JS_READONLY ,QScriptValue::ReadOnly
# define TAGEDITOR_JS_UNDELETABLE ,QScriptValue::Undeletable
# define TAGEDITOR_JS_QOBJECT(engine, obj) engine.newQObject(obj, QScriptEngine::ScriptOwnership)
# define TAGEDITOR_JS_INT(value) value.toInt32()
# define TAGEDITOR_JS_IS_VALID_PROG(program) (!program.isError() && program.isFunction())
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for JavaScript provider present."
#endif
#ifdef TAGEDITOR_JS_ENGINE
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_JS_ENGINE)
#endif
#ifdef TAGEDITOR_JS_VALUE
QT_FORWARD_DECLARE_CLASS(TAGEDITOR_JS_VALUE)
#endif
#endif // TAGEDITOR_JAVA_SCRIPT_DEFINES

View File

@ -0,0 +1,19 @@
// Created via CMake from template webviewdefs.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef TAGEDITOR_JAVA_SCRIPT_INCLUDES
#define TAGEDITOR_JAVA_SCRIPT_INCLUDES
#include <QtGlobal>
#if defined(TAGEDITOR_USE_JSENGINE)
# include <QJSEngine>
# include <QJSValue>
#elif defined(TAGEDITOR_USE_SCRIPT)
# include <QScriptEngine>
# include <QScriptValue>
#elif !defined(TAGEDITOR_NO_WEBVIEW)
# error "No definition for JavaScript provider present."
#endif
#endif // TAGEDITOR_JAVA_SCRIPT_INCLUDES

View File

@ -2,19 +2,13 @@
#define RENAMINGUTILITY_RENAMINGENGINE_H
#include "./filesystemitem.h"
#include "./scriptdefs.h"
#include "./jsdefs.h"
#include "./jsincludes.h"
#include <QObject>
#include <QList>
#include <QDir>
#include <QAtomicInteger>
#if defined(TAGEDITOR_USE_JSENGINE)
# include <QJSEngine>
# include <QJSValue>
#elif defined(TAGEDITOR_USE_SCRIPT)
# include <QScriptEngine>
# include <QScriptValue>
#endif
#include <memory>

View File

@ -2,6 +2,7 @@
#include "./tageditorobject.h"
#include "./filesystemitem.h"
#include "./jsincludes.h"
#include "../misc/utility.h"
@ -17,14 +18,6 @@
#include <QDir>
#if defined(TAGEDITOR_USE_JSENGINE)
# include <QJSEngine>
# include <QJSValue>
#elif defined(TAGEDITOR_USE_SCRIPT)
# include <QScriptEngine>
# include <QScriptValue>
#endif
#include <iostream>
using namespace ConversionUtilities;

View File

@ -3,14 +3,9 @@
#ifndef TAGEDITOR_NO_JSENGINE
#include "./scriptdefs.h"
#include "./jsdefs.h"
#include <QObject>
#if defined(TAGEDITOR_USE_JSENGINE)
# include <QJSValue>
#elif defined(TAGEDITOR_USE_SCRIPT)
# include <QScriptValue>
#endif
QT_FORWARD_DECLARE_CLASS(QFileInfo)