Compare commits

...
38 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
Tannin 1dc5a32871 Merge 2015-05-09 21:46:40 +02:00
Tannin db0a791155 Merge in changes by Tom Tanner 2015-03-27 18:24:37 +01:00
Tom Tanner 65ce23f906 Fixed Scons build for existing bits.
Changed pynedit.pro to fetch from 'standard' install location
Changed saveas code to use organizer report rather than uibase - this way it's
not dependant on the vagaries of the include path, and works the same as the
rest of the organiser directory
2015-03-20 10:34:30 +00:00
Tom Tanner 4fddc311c5 Merge with branch1.2 2015-03-18 17:40:29 +00:00
Tom Tanner c863a94793 Refactoring and cleanup. 2015-03-18 14:16:04 +00:00
Tom Tanner 77f074f59e Every plugin now built 2015-03-17 16:31:15 +00:00
Tannin b72216ad8c extended the game-plugin interface 2015-01-29 19:26:42 +01:00
Tannin 0a8bcff070 Merge with branch1.2 2015-01-03 15:58:52 +01:00
Tannin b8118074c0 - archive library can now query for password during extraction (seems to be necessary for rars)
- process blacklist is now taken from a file if there is one, not hardcoded
- removed workaround for the papyrus compiler
- updated loot client to work with the actual api
- loot client now links with loot32.dll at runtime
- loot client now produces its output in a (json-)file which includes all plugin messages and dirty flags
- fomod installer now tries to parse the xml with several encodings
- fomod installer will now display a diagnostics warning if the jpg imageformat isn't supported
- base preview plugin now tries to be a bit smarter about resizing images to fit the screen
- bugfix: fomod installer no longer tries to open an image even after detecting its invalid
- bugfix: potential null-pointer dereferentiation in getprivateprofile... hooks
- bugfix: potential null-pointer dereferentiation in download manager
- bugfix: internal origin name showed up in one more place
- bugfix: ToString function produced strings that were one (zero-termination-)character too long
2014-11-05 23:48:06 +01:00
Tannin 344965df52 - re-enabled building of loot_cli and started developing against the new api
- extended set of default categories
- more tolerand bbcode parser
- added a few colors for the bbcode parser
- more fixes to qt5 compatibility
- started work on ability to unloading (and thus re-loading) of plugins
- names of plugins are no longer localizable (because those names are also used to store settings)
- added settings to disable individual diagnosis settings
- path of dependencies is now configured in a .pri file instead of environment variablees
- bugfix: if the modid-input is canceled, the id was saved as -1 and wasn't re-requested from the user
- bugfix: moving files with the SHFileOperation-Api didn't update the vfs correctly (still not perfect but better)
- bugfix: attempt to remove the deleter-file seems to have caused error messages for some users
- bugfix: fixed a couple of cases that might have caused the tutorial to hang
2014-09-08 20:37:23 +02:00
TheBloke ff3b241f6c .pro files - formatting/consistency fixes
Many small formatting changes to the majority of .pro files
 Consistent style for Qt version checking, using greaterThan(QT_MAJOR_VERSION, 4)
  This seems safest, as would continue to work for a future Qt 6 etc.
  Note that this makes redudundant the commit before this one, to organizer.pro
 Consistent indenting
 Moved some file configuration sections to be together with related sections
 Moved some installation-related sections (e.g. OUTDIR/DSTDIR) to be at the bottom,
  immediately before the related POST_LINK install lines.
 Similarly, in some cases separated out CONFIG(debug,.. checks into separate
  LIB/INCLUDE sections (high in file) and installation directory sections (low
   in file)
2014-07-07 23:32:18 +01:00
9 changed files with 114 additions and 30 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()
+11
View File
@@ -0,0 +1,11 @@
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')
+3 -4
View File
@@ -10,9 +10,7 @@ TEMPLATE = lib
CONFIG += plugins
CONFIG += dll
contains(QT_VERSION, "^5.*") {
QT += widgets
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets gui
DEFINES += PREVIEWBASE_LIBRARY
@@ -24,4 +22,5 @@ HEADERS += previewbase.h
include(../plugin_template.pri)
OTHER_FILES += \
previewbase.json
previewbase.json\
SConscript
+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>
+54 -14
View File
@@ -25,33 +25,60 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel>
#include <QTextEdit>
#include <QtPlugin>
#include <QApplication>
#include <QDesktopWidget>
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;
}
QString PreviewBase::name() const
{
return tr("Preview Base");
return "Preview Base";
}
QString PreviewBase::author() const
@@ -66,23 +93,27 @@ QString PreviewBase::description() const
MOBase::VersionInfo PreviewBase::version() const
{
return VersionInfo(0, 1, 0, VersionInfo::RELEASE_BETA);
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);
}
@@ -91,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 {
@@ -102,7 +133,16 @@ QWidget *PreviewBase::genFilePreview(const QString &fileName, const QSize &maxSi
QWidget *PreviewBase::genImagePreview(const QString &fileName, const QSize&) const
{
QLabel *label = new QLabel();
label->setPixmap(QPixmap(fileName));
QPixmap pic = QPixmap(fileName);
QSize screenSize = QApplication::desktop()->screenGeometry().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
int maxHeight = static_cast<int>(screenSize.height() * 0.8f);
if (pic.size().height() > maxHeight) {
pic = pic.scaledToHeight(maxHeight, Qt::SmoothTransformation);
}
label->setPixmap(pic);
return label;
}
+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