Compare commits

...
Author SHA1 Message Date
Mikaël Capelle 1bfa64842e Merge pull request #9 from ModOrganizer2/update-cmake-common-qt6
Update following cmake_common changes.
2022-04-28 17:50:08 +02:00
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
Chris Bessent f661415c23 Merge pull request #4 from ModOrganizer2/Develop
Stage for release 2.2.2
2020-01-06 05:12:31 -07:00
LostDragonist 027e07ef09 Update version to 1.1.0.0 2019-12-07 01:53:03 -07:00
Al 29b8a77baa Add support for json, log and cfg txt files previews 2019-10-02 23:52:17 +02:00
Al 02c564c53c Add support for ini files and remove support for dds files as preview_dds plugin will handle those from now on. 2019-10-02 23:41:27 +02:00
Jeremy Rimpo e387e6fdb2 Merge pull request #3 from ModOrganizer2/Develop
Stage for release 2.2.1
2019-07-14 18:02:45 -05:00
Silarn da3160e088 Set optimization for release builds 2019-05-22 02:04:30 -05:00
Brian Munro da9ce4a3ba Merge pull request #2 from Modorganizer2/Develop
Stage for 2.1.3 release
2018-05-08 12:33:09 +02:00
Silarn 0188c4b5e9 Updating gitignore 2018-05-04 00:28:44 -05:00
Brian Munro 9934cc4319 Merge pull request #1 from Modorganizer2/Develop
Merge to Master for Release
2018-04-13 08:51:13 +02:00
Jeremy Rimpo df3f5458f2 Remove extraneous search code 2018-04-13 00:38:23 -05:00
Silarn 1f3a5068f8 Prep for Qt 5.11 (backward-compatible) 2018-04-10 23:28:33 -05:00
Silarn 0eb25c6f75 Fix up CMAKE to use /MP and allow building through umbrella 2018-04-07 17:12:22 -05:00
LePresidente bfbfe2c7da Updated cmakelists to get the QT5 location from the QT_ROOT variable, instead of expecting it in DEPENDENCIES_DIR. 2017-09-21 16:47:16 +02:00
Tannin 0a83590936 translation 2016-06-04 19:47:34 +02:00
Tannin 9c29e470cd updated build scripts 2015-11-16 21:39:53 +01:00
Tannin 7a680df548 more work on build system 2015-10-09 19:58:14 +02:00
Tannin c31c70486f fixed build system 2015-09-26 23:59:50 +02:00
Tannin 1d77e869cd updated build system 2015-09-26 12:13:27 +02:00
convert-repo 72a8636f85 update tags 2015-09-07 17:41:42 +00:00
Tannin f77b5daf9d incorrect use of "complete" file suffixes 2015-06-09 20:40:13 +02:00
10 changed files with 141 additions and 74 deletions
+5
View File
@@ -0,0 +1,5 @@
edit
CMakeLists.txt.user
/msbuild.log
/*std*.log
/*build
+10
View File
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()
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
+5
View File
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.16)
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
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>PreviewBase</name>
<message>
<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>
+43 -18
View File
@@ -26,28 +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()) {
m_PreviewGenerators[QString(fileType).toLower()] = imageReader;
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" || blacklist.contains(strFileType))
continue;
m_PreviewGenerators[strFileType] = imageReader;
}
m_PreviewGenerators["txt"]
= std::bind(&PreviewBase::genTxtPreview, this, std::placeholders::_1, std::placeholders::_2);
const QStringList supportedTextFormats = { "txt", "ini", "json", "log", "cfg" };
}
auto textReader = std::bind(&PreviewBase::genTxtPreview, this, std::placeholders::_1, std::placeholders::_2);
foreach(const QString fileType, supportedTextFormats) {
// skip blacklisted ones
if (blacklist.contains(fileType))
continue;
m_PreviewGenerators[fileType] = textReader;
}
bool PreviewBase::init(MOBase::IOrganizer*)
{
return true;
}
@@ -56,6 +77,11 @@ QString PreviewBase::name() const
return "Preview Base";
}
QString PreviewBase::localizedName() const
{
return tr("Preview Base");
}
QString PreviewBase::author() const
{
return "Tannin";
@@ -68,23 +94,22 @@ QString PreviewBase::description() const
MOBase::VersionInfo PreviewBase::version() const
{
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
}
bool PreviewBase::isActive() const
{
return true;
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
}
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
{
std::set<QString> extensions;
foreach (const auto &generator, m_PreviewGenerators) {
for (const auto &generator : m_PreviewGenerators) {
extensions.insert(generator.first);
}
@@ -93,7 +118,7 @@ std::set<QString> PreviewBase::supportedExtensions() const
QWidget *PreviewBase::genFilePreview(const QString &fileName, const QSize &maxSize) const
{
auto iter = m_PreviewGenerators.find(QFileInfo(fileName).completeSuffix().toLower());
auto iter = m_PreviewGenerators.find(QFileInfo(fileName).suffix().toLower());
if (iter != m_PreviewGenerators.end()) {
return iter->second(fileName, maxSize);
} else {
@@ -105,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
-12
View File
@@ -1,12 +0,0 @@
#ifndef PREVIEWBASE_GLOBAL_H
#define PREVIEWBASE_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(PREVIEWBASE_LIBRARY)
# define PREVIEWBASESHARED_EXPORT Q_DECL_EXPORT
#else
# define PREVIEWBASESHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // PREVIEWBASE_GLOBAL_H