Compare commits

...
Author SHA1 Message Date
Mikaël Capelle bdd4397c8f Update following cmake_common changes. 2022-04-19 23:56:03 +02:00
Jeremy Rimpo 69fa4b8a3d Changes to compile with Qt6 + Boost 1.77 2021-12-05 03:42:49 -06:00
Mikaël Capelle 8fe992ed7f Update translation file. 2021-02-02 20:39:14 +01:00
Jeremy Rimpo 5597a8eff9 [ci skip] Update artifacts paths for msbuild 2021-01-29 10:53:43 -06:00
Mikaël Capelle 02b74362d5 Merge pull request #8 from Holt59/iplugin-isactive-refactoring
IPlugin::isActive refactoring
2020-11-18 10:01:33 +01:00
Mikaël Capelle d7c6137f29 Update following removal of IPlugin::isActive(). 2020-11-11 15:12:26 +01:00
Jeremy Rimpo 9fc4e63e2d [skip ci] Use PR branch for umbrella repo (if it exists) 2020-09-25 00:34:24 -05:00
Jeremy Rimpo 247f890396 Fix artifacts 2020-09-23 19:44:13 -05:00
Jeremy Rimpo f5318afbdf Add appveyor config 2020-09-23 19:36:37 -05:00
Silarn 0bdfcb7ae5 Appveyor CMAKE fix 2020-05-01 04:59:08 -05:00
isanae 15f34d3fbd Merge pull request #7 from isanae/new-cmakefiles
New cmakefiles
2020-04-26 02:54:54 -04:00
isanae 9eb356a24b now using new cmakefiles 2020-04-23 21:01:59 -04:00
Al 1e2c008cab Merge pull request #5 from Al12rs/blacklist
Added "enabled" and "blacklisted_extensions" settings.
2020-01-31 21:53:14 +01:00
Chris Bessent 886bd07410 Merge pull request #6 from ModOrganizer2/2_2_2
Pull in 2.2.2.1 changes
2020-01-13 23:08:38 -07:00
AL aaa57ae734 Update translations. 2020-01-13 13:56:29 +01:00
AL c232536d14 Added "enabled" and "blacklisted_extensions" settings. 2020-01-13 13:56:06 +01:00
8 changed files with 111 additions and 128 deletions
+8 -12
View File
@@ -1,14 +1,10 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.16)
ADD_COMPILE_OPTIONS($<$<CXX_COMPILER_ID:MSVC>:/MP> $<$<CXX_COMPILER_ID:MSVC>:$<$<CONFIG:RELEASE>:/O2>> $<$<CXX_COMPILER_ID:MSVC>:$<$<CONFIG:RELWITHDEBINFO>:/O2>>)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()
SET(PROJ_NAME preview_base)
PROJECT(${PROJ_NAME})
SET(DEPENDENCIES_DIR CACHE PATH "")
# hint to find qt in dependencies path
LIST(APPEND CMAKE_PREFIX_PATH ${QT_ROOT}/lib/cmake)
ADD_SUBDIRECTORY(src)
project(preview_base)
add_subdirectory(src)
+42
View File
@@ -0,0 +1,42 @@
version: 1.0.{build}
skip_branch_with_pr: true
image: Visual Studio 2019
environment:
WEBHOOK_URL:
secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1Vbg57wBaeLhi49uGjxPw5GVujHku6kxN6ab89zhbS5GVeluR76GM83IbKV4Sh7udXzoYZZdg6YudtYHzdhCgUeiedpswbuczTq9ceIkkfSEWZuh/lMAAVVwvcGsJAnoPFw=
build:
parallel: true
build_script:
- pwsh: >-
$ErrorActionPreference = 'Stop'
git clone --depth=1 --no-single-branch https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella
New-Item -ItemType Directory -Path c:\projects\modorganizer-build
cd c:\projects\modorganizer-umbrella
($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH -eq $null) ? ($branch = $env:APPVEYOR_REPO_BRANCH) : ($branch = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH)
git checkout $(git show-ref --verify --quiet refs/remotes/origin/${branch} || echo '-b') ${branch}
C:\Python37-x64\python.exe unimake.py -d c:\projects\modorganizer-build -s Appveyor_Build=True ${env:APPVEYOR_PROJECT_NAME}
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
artifacts:
- path: vsbuild\src\RelWithDebInfo\preview_base.dll
name: preview_base_dll
- path: vsbuild\src\RelWithDebInfo\preview_base.pdb
name: preview_base_pdb
- path: vsbuild\src\RelWithDebInfo\preview_base.lib
name: preview_base_lib
on_success:
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
- ps: ./send.ps1 success $env:WEBHOOK_URL
on_failure:
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stdout.log
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stderr.log
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
- ps: ./send.ps1 failure $env:WEBHOOK_URL
+4 -53
View File
@@ -1,54 +1,5 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11)
cmake_minimum_required(VERSION 3.16)
CMAKE_POLICY(SET CMP0020 NEW)
CMAKE_POLICY(SET CMP0043 NEW)
FILE(GLOB ${PROJ_NAME}_SRCS *.cpp)
FILE(GLOB ${PROJ_NAME}_HDRS *.h)
FILE(GLOB ${PROJ_NAME}_FORMS *.ui)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTOUIC ON)
FIND_PACKAGE(Qt5Widgets REQUIRED)
QT5_WRAP_UI(${PROJ_NAME}_UIHDRS ${${PROJ_NAME}_FORMS})
FIND_PACKAGE(Qt5LinguistTools)
QT5_CREATE_TRANSLATION(${PROJ_NAME}_translations_qm ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/${PROJ_NAME}_en.ts)
SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost)
IF (Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
ENDIF (Boost_FOUND)
SET(default_project_path "${CMAKE_SOURCE_DIR}/..")
GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH)
SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects")
SET(lib_path "${project_path}/../../install/libs")
INCLUDE_DIRECTORIES(${project_path}/uibase/src)
LINK_DIRECTORIES(${lib_path})
ADD_LIBRARY(${PROJ_NAME} SHARED ${${PROJ_NAME}_HDRS} ${${PROJ_NAME}_SRCS} ${${PROJ_NAME}_UIHDRS} ${${PROJ_NAME}_translations_qm})
TARGET_LINK_LIBRARIES(${PROJ_NAME}
Qt5::Widgets
${Boost_LIBRARIES}
uibase)
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES COMPILE_FLAGS /GL)
SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LTCG /LARGEADDRESSAWARE /OPT:REF /OPT:ICF")
###############
## Installation
INSTALL(TARGETS ${PROJ_NAME}
RUNTIME DESTINATION bin/plugins)
INSTALL(FILES $<TARGET_PDB_FILE:${PROJ_NAME}>
DESTINATION pdb)
add_library(preview_base SHARED)
mo2_configure_plugin(preview_base WARNINGS OFF)
mo2_install_target(preview_base)
-11
View File
@@ -1,11 +0,0 @@
Import('qt_env')
env = qt_env.Clone()
env.AppendUnique(CPPDEFINES = [ 'PREVIEWBASE_LIBRARY' ])
lib = env.SharedLibrary('previewBase', env.Glob('*.cpp'))
env.InstallModule(lib)
res = env['QT_USED_MODULES']
Return('res')
-26
View File
@@ -1,26 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2014-01-14T19:50:56
#
#-------------------------------------------------
TARGET = previewBase
TEMPLATE = lib
CONFIG += plugins
CONFIG += dll
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets gui
DEFINES += PREVIEWBASE_LIBRARY
SOURCES += previewbase.cpp
HEADERS += previewbase.h
include(../plugin_template.pri)
OTHER_FILES += \
previewbase.json\
SConscript
+16 -1
View File
@@ -4,9 +4,24 @@
<context>
<name>PreviewBase</name>
<message>
<location filename="previewbase.cpp" line="77"/>
<location filename="previewbase.cpp" line="82"/>
<source>Preview Base</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="92"/>
<source>Supports previewing various types of data files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="103"/>
<source>Enable previewing of basic file types, such as images and text files.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="104"/>
<source>Specify a list of comma separated extensions (without &quot;.&quot;) that should not be previewed by this plugin.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
+32 -18
View File
@@ -26,39 +26,49 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
#include <QTextEdit>
#include <QtPlugin>
#include <QApplication>
#include <QDesktopWidget>
#include <QScreen>
using namespace MOBase;
PreviewBase::PreviewBase()
: m_MOInfo(nullptr)
{
}
bool PreviewBase::init(IOrganizer *moInfo)
{
m_MOInfo = moInfo;
const QStringList& blacklist = m_MOInfo->pluginSetting(name(), "blacklisted_extensions").toString().toLower().split(',');
// set up image reader to be used for all image types qt (the current installation) supports
auto imageReader = std::bind(&PreviewBase::genImagePreview, this, std::placeholders::_1, std::placeholders::_2);
foreach (const QByteArray &fileType, QImageReader::supportedImageFormats()) {
foreach(const QByteArray & fileType, QImageReader::supportedImageFormats()) {
auto strFileType = QString(fileType).toLower();
// skip dds as that one is handled by the dds preview plugin.
if (strFileType == "dds")
if (strFileType == "dds" || blacklist.contains(strFileType))
continue;
m_PreviewGenerators[strFileType] = imageReader;
}
const QStringList supportedTextFormats = { "txt", "ini", "json", "log", "cfg" };
auto textReader = std::bind(&PreviewBase::genTxtPreview, this, std::placeholders::_1, std::placeholders::_2);
m_PreviewGenerators["txt"] = textReader;
m_PreviewGenerators["ini"] = textReader;
m_PreviewGenerators["json"] = textReader;
m_PreviewGenerators["log"] = textReader;
m_PreviewGenerators["cfg"] = textReader;
foreach(const QString fileType, supportedTextFormats) {
}
// skip blacklisted ones
if (blacklist.contains(fileType))
continue;
m_PreviewGenerators[fileType] = textReader;
}
bool PreviewBase::init(MOBase::IOrganizer*)
{
return true;
}
@@ -67,6 +77,11 @@ QString PreviewBase::name() const
return "Preview Base";
}
QString PreviewBase::localizedName() const
{
return tr("Preview Base");
}
QString PreviewBase::author() const
{
return "Tannin";
@@ -82,14 +97,13 @@ MOBase::VersionInfo PreviewBase::version() const
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
}
bool PreviewBase::isActive() const
{
return true;
}
QList<MOBase::PluginSetting> PreviewBase::settings() const
{
return QList<MOBase::PluginSetting>();
QList<PluginSetting> result;
result.push_back(PluginSetting("enabled", tr("Enable previewing of basic file types, such as images and text files."), QVariant(true)));
result.push_back(PluginSetting("blacklisted_extensions", tr("Specify a list of comma separated extensions (without \".\") "
"that should not be previewed by this plugin."), QVariant("")));
return result;
}
std::set<QString> PreviewBase::supportedExtensions() const
@@ -116,7 +130,7 @@ QWidget *PreviewBase::genImagePreview(const QString &fileName, const QSize&) con
{
QLabel *label = new QLabel();
QPixmap pic = QPixmap(fileName);
QSize screenSize = QApplication::desktop()->screenGeometry().size();
QSize screenSize = QApplication::primaryScreen()->geometry().size();
// ensure the output image is no more than 80% of the screen height.
// If the aspect ratio is higher than that of the screen this would still allow the image to extend
// beyond the screen but it ensures you can drag the window and close it
+9 -7
View File
@@ -37,13 +37,13 @@ public:
PreviewBase();
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
virtual bool init(MOBase::IOrganizer *moInfo) override;
virtual QString name() const override;
virtual QString localizedName() const override;
virtual QString author() const override;
virtual QString description() const override;
virtual MOBase::VersionInfo version() const override;
virtual QList<MOBase::PluginSetting> settings() const override;
public:
virtual std::set<QString> supportedExtensions() const;
@@ -57,6 +57,8 @@ private:
private:
std::map<QString, std::function<QWidget*(const QString&, const QSize&)> > m_PreviewGenerators;
private:
const MOBase::IOrganizer* m_MOInfo;
};
#endif // PREVIEWBASE_H