Compare commits

...
27 Commits
Author SHA1 Message Date
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
7 changed files with 87 additions and 24 deletions
+5
View File
@@ -0,0 +1,5 @@
edit
CMakeLists.txt.user
/msbuild.log
/*std*.log
/*build
+11
View File
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.16)
project(preview_base)
set(project_type plugin)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake)
else()
include(../cmake_common/project.cmake)
endif()
add_subdirectory(src)
+6
View File
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/src.cmake)
else()
include(../../cmake_common/src.cmake)
endif()
+22
View File
@@ -0,0 +1,22 @@
<?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="91"/>
<source>Supports previewing various types of data files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="107"/>
<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="108"/>
<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>
+41 -12
View File
@@ -33,21 +33,46 @@ using namespace MOBase;
PreviewBase::PreviewBase()
: m_MOInfo(nullptr)
{
}
bool PreviewBase::init(IOrganizer *moInfo)
{
m_MOInfo = moInfo;
if (!isActive()) {
return true;
}
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;
}
@@ -68,23 +93,27 @@ QString PreviewBase::description() const
MOBase::VersionInfo PreviewBase::version() const
{
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
}
bool PreviewBase::isActive() const
{
return true;
return m_MOInfo->pluginSetting(name(), "enabled").toBool();
}
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 +122,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 {
+2
View File
@@ -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