Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Collection of known problem fixes #233

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ int main(int argc, char *argv[])
emit fileControl->imageFileChanged(filePath, isMultiImage, isExist);
});

status.setFileControl(fileControl);

// 光标位置查询工具
CursorTool *cursorTool = new CursorTool();
engine.rootContext()->setContextProperty("cursorTool", cursorTool);
Expand Down
4 changes: 1 addition & 3 deletions src/qml/Control/Animation/SwitchViewAnimation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ Item {
} else if (switchType === Album.Types.FadeInOut) {
x = 0
switchPropertys = "opacity"

console.log("switchTypechanged:", switchType)
}
}

Expand Down Expand Up @@ -69,7 +67,7 @@ Item {
transitions:
Transition {
enabled: switchType !== Album.Types.HardCut
NumberAnimation{properties: switchPropertys; easing.type: Easing.OutExpo; duration: 400
NumberAnimation{properties: switchPropertys; easing.type: Easing.OutExpo; duration: GStatus.animationDuration
}
}
}
3 changes: 2 additions & 1 deletion src/qml/Control/BorderImageEx.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11

Image {
id: boerderImageEx
smooth: true
antialiasing: true
fillMode: Image.PreserveAspectCrop

property string url: ""
//border and shadow
Rectangle {
id: borderRect
Expand Down
9 changes: 9 additions & 0 deletions src/qml/Control/MonthImage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Rectangle {
width: monthImage.width
height: monthImage.height
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_1_" + paths[0]
url: paths[0]
}
}

Expand All @@ -49,6 +50,7 @@ Rectangle {
width: monthImage.width / 2
height: monthImage.height
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_1_" + modelData
url: modelData
}
}
}
Expand All @@ -63,6 +65,7 @@ Rectangle {
width: monthImage.width / 2
height: monthImage.height
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_1_" + paths[0]
url: paths[0]
}

Column {
Expand All @@ -73,6 +76,7 @@ Rectangle {
width: monthImage.width / 2
height: monthImage.height / 2
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_2_" + modelData
url: modelData
}
}
}
Expand All @@ -92,6 +96,7 @@ Rectangle {
width: monthImage.width / 2
height: monthImage.height / 2
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_2_" + modelData
url: modelData
}
}
}
Expand All @@ -106,6 +111,7 @@ Rectangle {
width: monthImage.width
height: monthImage.height * 0.618
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_3_" + paths[0]
url: paths[0]
}

Row {
Expand All @@ -116,6 +122,7 @@ Rectangle {
width: monthImage.width / 4
height: monthImage.height * (1 - 0.618)
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_4_" + modelData
url: modelData
}
}
}
Expand All @@ -131,6 +138,7 @@ Rectangle {
width: monthImage.width
height: monthImage.height * 0.618
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_3_" + paths[0]
url: paths[0]
}

Row {
Expand All @@ -141,6 +149,7 @@ Rectangle {
width: monthImage.width / 5
height: monthImage.height * (1 - 0.618)
source: "image://collectionPublisher/" + monthImage.displayFlushHelper.toString() + "_M_5_" + modelData
url: modelData
}
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/qml/PreviewImageViewer/ImageViewer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,22 @@ Rectangle {
duration: GStatus.animationDuration
easing.type: Easing.OutExpo
}

NumberAnimation {
target: imageviewr
property: "opacity"
from: 0
to: 1
duration: GStatus.animationDuration
easing.type: Easing.OutExpo
}
NumberAnimation {
target: view
property: "opacity"
from: 0
to: 1
duration: GStatus.animationDuration
easing.type: Easing.OutExpo
}
NumberAnimation {
target: view
properties: "y"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ BaseView {
return

if (index === 0) {
yearCollection.flushModel()
if (yearCollection.x < 0)
yearCollection.x = rollingWidth
} else if (index === 1) {
monthCollection.flushModel()
if (monthCollection.x < 0)
monthCollection.x = rollingWidth
} else if (index === 2) {
Expand Down
14 changes: 12 additions & 2 deletions src/qml/ThumbnailImageView/CollecttionView/MonthCollection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ SwitchViewAnimation {

signal monthClicked(string year, string month)

property int itemHeight: theView.width * 4 / 7
function scrollToYear(year) {
//搜索index
for(var i = 0;i !== theModel.count;++i) {
var index = 0;
for(var i = 0;i !== theModel.count; i++) {
if(theModel.get(i).year === year) {
index = i
break
}
}

//计算偏移
theView.contentY = (theView.height / 3 * 2 + theView.spacing) * i
var yValue = (itemHeight + theView.spacing) * index
theView.contentY = 0
theView.contentY = yValue
}

onVisibleChanged: {
if (visible)
flushModel()
}

function flushModel() {
Expand Down
6 changes: 6 additions & 0 deletions src/qml/ThumbnailImageView/CollecttionView/YearCollection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ SwitchViewAnimation {

signal yearClicked(string year)

onVisibleChanged: {
if (visible)
flushModel()
}

function flushModel() {
if (!visible)
return
Expand Down Expand Up @@ -64,6 +69,7 @@ SwitchViewAnimation {
width: theView.width
height: theView.width * 4 / 7

property string yearPath: albumControl.getYearCoverPath(year)
Image {
id: image

Expand Down
2 changes: 2 additions & 0 deletions src/qml/ThumbnailImageView/ThumbnailImage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Item {
Connections {
target: titleAlubmRect
function onCollectionBtnClicked(index) {
if (GStatus.currentCollecttionViewIndex === index)
return
// 点击按钮,动画切换类型设定为翻页滚动
GStatus.currentSwitchType = Album.Types.FlipScroll
collecttionView.setIndex(index)
Expand Down
8 changes: 8 additions & 0 deletions src/src/albumControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,14 @@

}

QString AlbumControl::getYearCoverPath(const QString &year)

Check warning on line 2508 in src/src/albumControl.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'getYearCoverPath' is never used.
{
auto paths = DBManager::instance()->getYearPaths(year, 1);
if (paths.isEmpty())
return "";
return paths[0];
}

//获取指定日期的照片路径
QStringList AlbumControl::getDayPaths(const QString &day)
{
Expand Down
3 changes: 3 additions & 0 deletions src/src/albumControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ class AlbumControl : public QObject
//手机照片导入 0为已导入,1-n为自定义相册
Q_INVOKABLE void importFromMountDevice(const QStringList &paths, const int &index = 0);

//获取年封面图片路径
Q_INVOKABLE QString getYearCoverPath(const QString &year);

//获取指定日期的照片路径
Q_INVOKABLE QStringList getDayPaths(const QString &day);

Expand Down
2 changes: 2 additions & 0 deletions src/src/configsetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ void LibConfigSetter::loadConfig(imageViewerSpace::ImgViewerType type)
setValue("", "loadDayView", 1);
if (!contains("", "loadImport"))
setValue("", "loadImport", 1);
if (!contains("","animationDuration"))
setValue("", "animationDuration", 400);
}

// if (imageViewerSpace::ImgViewerTypeAlbum == m_viewType) {
Expand Down
11 changes: 9 additions & 2 deletions src/src/globalstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
static const int sc_RectSelScrollStep = 30; // 框选滚动步进
static const int sc_ThumbnailListRightMargin = 10; // 框选滚动步进
static const int sc_ThumbnialListCellSpace = 4; // 框选滚动步进
static const int sc_AnimationDuration = 400; // 动画持续时间
/**
@class GlobalStatus
@brief QML单例类,维护全局状态,同步不同组件间的状态信息
Expand Down Expand Up @@ -300,9 +299,17 @@
void GlobalStatus::setFileControl(FileControl *fc)
{
m_fileControl = fc;

if (!m_fileControl)
return;

bool bRet = false;
m_nAnimationDuration = m_fileControl->getConfigValue("", "animationDuration", 400).toInt(&bRet);
if (!bRet)
m_nAnimationDuration = 400;
}

int GlobalStatus::rightMenuSeparatorHeight() const

Check warning on line 312 in src/src/globalstatus.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'rightMenuSeparatorHeight' is never used.
{
return sc_RightMenuSeparatorHeight;
}
Expand Down Expand Up @@ -352,12 +359,12 @@
return sc_NeedHideSideBarWidth;
}

int GlobalStatus::animationDuration() const

Check warning on line 362 in src/src/globalstatus.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'animationDuration' is never used.
{
return sc_AnimationDuration;
return m_nAnimationDuration;
}

qreal GlobalStatus::sideBarX() const

Check warning on line 367 in src/src/globalstatus.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'sideBarX' is never used.
{
return m_sideBar_X;
}
Expand Down
1 change: 1 addition & 0 deletions src/src/globalstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class GlobalStatus : public QObject
bool m_bWindowDisactived = false; // 窗口是否激活标记
bool m_bLoading = true; // 记录相册界面是否处于加载状态

int m_nAnimationDuration = 400; // 动画持续时间
FileControl* m_fileControl { nullptr };
};

Expand Down
Loading