Skip to content

Commit

Permalink
feat: rmove freeimage lib (#147) (#150)
Browse files Browse the repository at this point in the history
rmove freeimage lib

Log: rmove freeimage lib

Task: https://pms.uniontech.com/task-view-365161.html
  • Loading branch information
lzwind authored Nov 5, 2024
1 parent 9485bae commit b7fe661
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 1,634 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ _The **master** branch is current development branch, build dependencies may cha
* libxcb-util0-dev,
* libstartup-notification0-dev,
* libraw-dev,
* libfreeimage-dev,
* libqt5opengl5-dev,
* qtbase5-private-dev,
* qtmultimedia5-dev,
Expand Down Expand Up @@ -59,7 +58,7 @@ $ sudo apt-get build-dep image-editor
```
or
``` shell
$ sudo apt install cmake qtbase5-dev pkg-config libexif-dev libqt5svg5-dev libqt5x11extras5-dev libsqlite3-dev qttools5-dev-tools qttools5-dev libxcb-util0-dev libstartup-notification0-dev libraw-dev libfreeimage-dev libqt5opengl5-dev qtbase5-private-dev qtmultimedia5-dev x11proto-xext-dev libmtdev-dev libegl1-mesa-dev libudev-dev libfontconfig1-dev libfreetype6-dev libglib2.0-dev libxrender-dev libdtkwidget-dev libdtkwidget5-bin libdtkcore5-bin libgio-qt-dev libudisks2-qt5-dev libmediainfo-dev libopencv-dev libgstreamer1.0-dev
$ sudo apt install cmake qtbase5-dev pkg-config libexif-dev libqt5svg5-dev libqt5x11extras5-dev libsqlite3-dev qttools5-dev-tools qttools5-dev libxcb-util0-dev libstartup-notification0-dev libraw-dev libqt5opengl5-dev qtbase5-private-dev qtmultimedia5-dev x11proto-xext-dev libmtdev-dev libegl1-mesa-dev libudev-dev libfontconfig1-dev libfreetype6-dev libglib2.0-dev libxrender-dev libdtkwidget-dev libdtkwidget5-bin libdtkcore5-bin libgio-qt-dev libudisks2-qt5-dev libmediainfo-dev libopencv-dev libgstreamer1.0-dev
```

2. Build:
Expand Down
3 changes: 1 addition & 2 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ _**master**分支是当前开发分支,编译依赖可能在未更新README.md
* libxcb-util0-dev,
* libstartup-notification0-dev,
* libraw-dev,
* libfreeimage-dev,
* libqt5opengl5-dev,
* qtbase5-private-dev,
* qtmultimedia5-dev,
Expand Down Expand Up @@ -59,7 +58,7 @@ $ sudo apt-get build-dep image-editor
```
或者手动安装
``` shell
$ sudo apt install cmake qtbase5-dev pkg-config libexif-dev libqt5svg5-dev libqt5x11extras5-dev libsqlite3-dev qttools5-dev-tools qttools5-dev libxcb-util0-dev libstartup-notification0-dev libraw-dev libfreeimage-dev libqt5opengl5-dev qtbase5-private-dev qtmultimedia5-dev x11proto-xext-dev libmtdev-dev libegl1-mesa-dev libudev-dev libfontconfig1-dev libfreetype6-dev libglib2.0-dev libxrender-dev libdtkwidget-dev libdtkwidget5-bin libdtkcore5-bin libgio-qt-dev libudisks2-qt5-dev libmediainfo-dev libopencv-dev libgstreamer1.0-dev
$ sudo apt install cmake qtbase5-dev pkg-config libexif-dev libqt5svg5-dev libqt5x11extras5-dev libsqlite3-dev qttools5-dev-tools qttools5-dev libxcb-util0-dev libstartup-notification0-dev libraw-dev libqt5opengl5-dev qtbase5-private-dev qtmultimedia5-dev x11proto-xext-dev libmtdev-dev libegl1-mesa-dev libudev-dev libfontconfig1-dev libfreetype6-dev libglib2.0-dev libxrender-dev libdtkwidget-dev libdtkwidget5-bin libdtkcore5-bin libgio-qt-dev libudisks2-qt5-dev libmediainfo-dev libopencv-dev libgstreamer1.0-dev
```

2. 构建:
Expand Down
3 changes: 1 addition & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Build-Depends:
qttools5-dev,
libxcb-util0-dev,
libstartup-notification0-dev,
libraw-dev,
libfreeimage-dev,
libraw-dev,
libqt5opengl5-dev,
qtbase5-private-dev,
qtmultimedia5-dev,
Expand Down
5 changes: 1 addition & 4 deletions libimageviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ include_directories(${CMAKE_INCLUDE_CURRENT_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_definitions( -DLITE_DIV )
add_definitions( -DUSE_UNIONIMAGE )
add_definitions( -DCMAKE_BUILD )

#库目录
Expand Down Expand Up @@ -92,8 +91,6 @@ set(LINK_DIR /usr/lib/)
include_directories(${INC_DIR})
link_directories(${LINK_DIR})

link_libraries(freeimage)

set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)

file(GLOB TS LIST_DIRECTORIES false translations/libimageviewer*.ts)
Expand Down Expand Up @@ -122,7 +119,7 @@ set(${TARGET_NAME} ${CMAKE_INSTALL_LIBDIR})
set_target_properties(${TARGET_NAME} PROPERTIES VERSION 0.1.0 SOVERSION 0.1)

target_include_directories(${CMD_NAME} PUBLIC ${3rd_lib_INCLUDE_DIRS} ${TIFF_INCLUDE_DIRS} ${dfm-io_lib_INCLUDE_DIRS})
target_link_libraries(imageviewer ${3rd_lib_LIBRARIES} freeimage ${TIFF_LIBRARIES} ${dfm-io_lib_LIBRARIES} dl)
target_link_libraries(imageviewer ${3rd_lib_LIBRARIES} ${TIFF_LIBRARIES} ${dfm-io_lib_LIBRARIES} dl)

include(GNUInstallDirs)
configure_file(libimageviewer.pc.in ${PROJECT_BINARY_DIR}/libimageviewer.pc @ONLY)
Expand Down
2 changes: 0 additions & 2 deletions libimageviewer/libimageviewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ CONFIG += c++11 link_pkgconfig
PKGCONFIG += dtkwidget dtkcore
DEFINES += IMAGEVIEWER_LIBRARY

LIBS += -lfreeimage
DEFINES += LITE_DIV
DEFINES += USE_UNIONIMAGE

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
Expand Down
8 changes: 0 additions & 8 deletions libimageviewer/quickprint/printimageloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,6 @@ bool PrintImageLoader::loadImageData(PrintImageData::Ptr &imagePtr)

try {
if (s_SingleFrame == imagePtr->frame) {
QString errorMsg;
if (!LibUnionImage_NameSpace::loadStaticImageFromFile(imagePtr->filePath, imagePtr->data, errorMsg)) {
qWarning() << QString("Load image failed: %1").arg(errorMsg);
imagePtr->state = ContentError;
return false;
}
} else {
QImageReader reader(imagePtr->filePath);
// jumpToImage 可能返回 false, 但数据正常读取
reader.jumpToImage(imagePtr->frame);
Expand All @@ -284,7 +277,6 @@ bool PrintImageLoader::loadImageData(PrintImageData::Ptr &imagePtr)
return false;
}
}

} catch (const std::exception &e) {
// 图片读取,考虑未界定异常
qCritical() << qPrintable("Exception: load image failed!") << qPrintable(e.what());
Expand Down
20 changes: 0 additions & 20 deletions libimageviewer/unionimage/baseutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
#include <DDesktopServices>


#ifdef USE_UNIONIMAGE
#include "unionimage.h"
#endif
DWIDGET_USE_NAMESPACE

// 当前动态库使用的翻译QM翻译文件路径
Expand All @@ -53,22 +50,6 @@ const QString DATETIME_FORMAT_EXIF = "yyyy:MM:dd HH:mm:ss";

QPixmap renderSVG(const QString &filePath, const QSize &size)
{
/*lmh0724使用USE_UNIONIMAGE*/
#ifdef USE_UNIONIMAGE
QImage tImg(size, QImage::Format_ARGB32);
QString errMsg;
QSize realSize;
// if (!UnionImage_NameSpace::loadStaticImageFromFile(filePath, tImg, realSize, errMsg)) {
// qDebug() << errMsg;
// }
if (!LibUnionImage_NameSpace::loadStaticImageFromFile(filePath, tImg, errMsg)) {
qDebug() << errMsg;
}
QPixmap pixmap;
pixmap = QPixmap::fromImage(tImg);

return pixmap;
#else
QImageReader reader;
QPixmap pixmap;

Expand All @@ -84,7 +65,6 @@ QPixmap renderSVG(const QString &filePath, const QSize &size)
}

return pixmap;
#endif
}

//QString sizeToHuman(const qlonglong bytes)
Expand Down
Loading

0 comments on commit b7fe661

Please sign in to comment.