Compare commits

...
10 Commits
8 changed files with 72 additions and 68 deletions
+4 -5
View File
@@ -1,11 +1,10 @@
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)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(../cmake_common/project.cmake)
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
+4 -5
View File
@@ -1,6 +1,5 @@
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()
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
+8 -3
View File
@@ -4,17 +4,22 @@
<context>
<name>PreviewBase</name>
<message>
<location filename="previewbase.cpp" line="91"/>
<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="107"/>
<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="108"/>
<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>
+7 -11
View File
@@ -26,7 +26,7 @@ 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;
@@ -41,10 +41,6 @@ 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
@@ -81,6 +77,11 @@ QString PreviewBase::name() const
return "Preview Base";
}
QString PreviewBase::localizedName() const
{
return tr("Preview Base");
}
QString PreviewBase::author() const
{
return "Tannin";
@@ -96,11 +97,6 @@ MOBase::VersionInfo PreviewBase::version() const
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
}
bool PreviewBase::isActive() const
{
return m_MOInfo->pluginSetting(name(), "enabled").toBool();
}
QList<MOBase::PluginSetting> PreviewBase::settings() const
{
QList<PluginSetting> result;
@@ -134,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
+7 -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;