Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
fe0b36dc34 | |||
1864ff5b7f | |||
fb1ad2ba06 | |||
e3dfc9c673 | |||
eb648e3112 | |||
5495fa06d3 | |||
41e75f10b5 | |||
6b0e4b6767 |
17
.github/workflows/macos.yml
vendored
Normal file
17
.github/workflows/macos.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: MyCi_MacOS
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2.2.1
|
||||
- name: Run a qt project
|
||||
run: |
|
||||
cmake ./
|
||||
make
|
@ -133,7 +133,7 @@ install (
|
||||
|
||||
# CPACK: General Settings
|
||||
set (CPACK_GENERATOR "TBZ2")
|
||||
set (CPACK_PACKAGE_NAME "PineapplePictures")
|
||||
set (CPACK_PACKAGE_NAME "pineapple-pictures")
|
||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Yet another image viewer")
|
||||
set (CPACK_PACKAGE_VENDOR "Gary Wang")
|
||||
set (CPACK_PACKAGE_CONTACT "https://github.com/BLumia/PineapplePictures/issues/")
|
||||
@ -142,7 +142,9 @@ if (WIN32)
|
||||
elseif (APPLE)
|
||||
# ...
|
||||
elseif (UNIX)
|
||||
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set (CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5svg5")
|
||||
set (CPACK_DEBIAN_PACKAGE_RECOMMENDS "kimageformat-plugins")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
|
33
appveyor.yml
33
appveyor.yml
@ -1,24 +1,49 @@
|
||||
environment:
|
||||
CMAKE_INSTALL_ROOT: C:\projects\cmake
|
||||
matrix:
|
||||
- build_name: mingw73_32_qt5_12_6
|
||||
QTPATH: C:\Qt\5.12.6\mingw73_32
|
||||
MINGW32: C:\Qt\Tools\mingw730_32
|
||||
|
||||
install:
|
||||
- mkdir %CMAKE_INSTALL_ROOT%
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
- git submodule update --init --recursive
|
||||
- set PATH=%PATH%;%QTPATH%\bin;%MINGW32%\bin
|
||||
- set PATH=%PATH%;%CMAKE_INSTALL_ROOT%;%QTPATH%\bin;%MINGW32%\bin
|
||||
|
||||
build_script:
|
||||
# prepare
|
||||
- mkdir 3rdparty
|
||||
- cinst ninja
|
||||
# install ECM so we can build KImageFormats
|
||||
- cd 3rdparty
|
||||
- git clone -q git://anongit.kde.org/extra-cmake-modules.git
|
||||
- cd extra-cmake-modules
|
||||
- cmake -G "Ninja" . -DCMAKE_INSTALL_PREFIX=%CMAKE_INSTALL_ROOT%
|
||||
- cmake --build .
|
||||
- cmake --build . --target install
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
# install KImageFormats
|
||||
- cd 3rdparty
|
||||
- git clone git://anongit.kde.org/kimageformats.git
|
||||
- cd kimageformats
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX='%cd%' ..\
|
||||
- cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="-s" -DCMAKE_MAKE_PROGRAM=mingw32-make -DQT_PLUGIN_INSTALL_DIR=%QTPATH%\plugins
|
||||
- cmake --build . --config Release
|
||||
- cmake --build . --config Release --target install
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
# finally...
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX='%cd%'
|
||||
- mingw32-make
|
||||
- mingw32-make install
|
||||
# fixme: I don't know how to NOT make the binary installed to the ./bin/ folder...
|
||||
- cd bin
|
||||
- windeployqt --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler --release .\ppic.exe
|
||||
- tree
|
||||
- windeployqt --verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler --release .\ppic.exe
|
||||
# for debug..
|
||||
- tree /f
|
||||
|
||||
artifacts:
|
||||
- path: build\bin
|
||||
|
@ -39,8 +39,10 @@ void GraphicsView::showFileFromUrl(const QUrl &url, bool doRequestGallery)
|
||||
QImageReader imageReader(filePath);
|
||||
imageReader.setAutoTransform(true);
|
||||
imageReader.setDecideFormatFromContent(true);
|
||||
QImage::Format imageFormat = imageReader.imageFormat();
|
||||
if (imageFormat == QImage::Format_Invalid) {
|
||||
// Since if the image format / plugin does not support this feature, imageFormat() will returns an invalid format.
|
||||
// So we cannot use imageFormat() and check if it returns QImage::Format_Invalid to detect if we support the file.
|
||||
// QImage::Format imageFormat = imageReader.imageFormat();
|
||||
if (imageReader.format().isEmpty()) {
|
||||
showText(tr("File is not a valid image"));
|
||||
} else {
|
||||
showImage(QPixmap::fromImageReader(&imageReader));
|
||||
|
@ -113,6 +113,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(quitAppShorucut, &QShortcut::activated,
|
||||
std::bind(&MainWindow::quitAppAction, this, false));
|
||||
|
||||
QShortcut * quitAppShorucut2 = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||
connect(quitAppShorucut2, &QShortcut::activated,
|
||||
std::bind(&MainWindow::quitAppAction, this, false));
|
||||
|
||||
QShortcut * prevPictureShorucut = new QShortcut(QKeySequence(Qt::Key_PageUp), this);
|
||||
connect(prevPictureShorucut, &QShortcut::activated,
|
||||
this, &MainWindow::galleryPrev);
|
||||
@ -121,6 +125,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(nextPictureShorucut, &QShortcut::activated,
|
||||
this, &MainWindow::galleryNext);
|
||||
|
||||
QShortcut * fullscreenShorucut = new QShortcut(QKeySequence(QKeySequence::FullScreen), this);
|
||||
connect(fullscreenShorucut, &QShortcut::activated,
|
||||
this, &MainWindow::toggleFullscreen);
|
||||
|
||||
centerWindow();
|
||||
}
|
||||
|
||||
@ -185,12 +193,18 @@ QUrl MainWindow::currentImageFileUrl() const
|
||||
return QUrl();
|
||||
}
|
||||
|
||||
void MainWindow::clearGallery()
|
||||
{
|
||||
m_currentFileIndex = -1;
|
||||
m_files.clear();
|
||||
}
|
||||
|
||||
void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
||||
{
|
||||
QFileInfo info(path);
|
||||
QDir dir(info.path());
|
||||
QString currentFileName = info.fileName();
|
||||
QStringList entryList = dir.entryList({"*.jpg", "*.jpeg", "*.png", "*.gif", "*.svg", "*.bmp"},
|
||||
QStringList entryList = dir.entryList({"*.jpg", "*.jpeg", "*.jfif", "*.png", "*.gif", "*.svg", "*.bmp"},
|
||||
QDir::Files | QDir::NoSymLinks, QDir::NoSort);
|
||||
|
||||
QCollator collator;
|
||||
@ -198,8 +212,7 @@ void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
||||
|
||||
std::sort(entryList.begin(), entryList.end(), collator);
|
||||
|
||||
m_currentFileIndex = -1;
|
||||
m_files.clear();
|
||||
clearGallery();
|
||||
|
||||
for (int i = 0; i < entryList.count(); i++) {
|
||||
const QString & oneEntry = entryList.at(i);
|
||||
@ -357,6 +370,7 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QAction * pasteImage = new QAction(tr("&Paste Image"));
|
||||
connect(pasteImage, &QAction::triggered, this, [ = ](){
|
||||
clearGallery();
|
||||
m_graphicsView->showImage(clipboardImage);
|
||||
});
|
||||
|
||||
@ -551,3 +565,12 @@ void MainWindow::quitAppAction(bool force)
|
||||
closeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleFullscreen()
|
||||
{
|
||||
if (isFullScreen()) {
|
||||
showNormal();
|
||||
} else {
|
||||
showFullScreen();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
void adjustWindowSizeBySceneRect();
|
||||
QUrl currentImageFileUrl() const;
|
||||
|
||||
void clearGallery();
|
||||
void loadGalleryBySingleLocalFile(const QString &path);
|
||||
void galleryPrev();
|
||||
void galleryNext();
|
||||
@ -52,6 +53,7 @@ protected slots:
|
||||
void toggleStayOnTop();
|
||||
bool stayOnTop();
|
||||
void quitAppAction(bool force = false);
|
||||
void toggleFullscreen();
|
||||
|
||||
private:
|
||||
QPoint m_oldMousePos;
|
||||
|
Reference in New Issue
Block a user