mirror of
https://github.com/ModOrganizer2/modorganizer-preview_base.git
synced 2026-07-27 14:01:41 -07:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dc5a32871 | ||
|
|
db0a791155 | ||
|
|
65ce23f906 | ||
|
|
4fddc311c5 | ||
|
|
c863a94793 | ||
|
|
77f074f59e | ||
|
|
b72216ad8c | ||
|
|
0a8bcff070 | ||
|
|
b8118074c0 | ||
|
|
344965df52 | ||
|
|
ff3b241f6c |
@@ -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
@@ -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
|
||||
|
||||
+14
-3
@@ -25,6 +25,8 @@ 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;
|
||||
@@ -51,7 +53,7 @@ bool PreviewBase::init(MOBase::IOrganizer*)
|
||||
|
||||
QString PreviewBase::name() const
|
||||
{
|
||||
return tr("Preview Base");
|
||||
return "Preview Base";
|
||||
}
|
||||
|
||||
QString PreviewBase::author() const
|
||||
@@ -66,7 +68,7 @@ QString PreviewBase::description() const
|
||||
|
||||
MOBase::VersionInfo PreviewBase::version() const
|
||||
{
|
||||
return VersionInfo(0, 1, 0, VersionInfo::RELEASE_BETA);
|
||||
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
|
||||
}
|
||||
|
||||
bool PreviewBase::isActive() const
|
||||
@@ -102,7 +104,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user