Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a bunch of stuff

  • Loading branch information...
commit 7f4d1112ecdcfd69fa8ffc7372a60b4c6c1715da 1 parent 46cdf9b
@Matoking authored
View
59 ImageViewer/Base.cpp
@@ -19,12 +19,21 @@ Base::Base(QWidget *parent) :
checkSettings();
}
+void Base::quitApplication()
+{
+ settings->sync();
+
+ QApplication::quit();
+}
+
void Base::checkSettings()
{
if (settings->contains("main/imageFolder") == false)
{
settings->setValue("main/imageFolder", QString("nothing"));
settings->setValue("main/resizeToFit", true);
+ settings->setValue("main/showScrollIndicators", false);
+ settings->setValue("main/backgroundColor", "black");
settings->sync();
}
@@ -33,6 +42,9 @@ void Base::checkSettings()
QMetaObject::invokeMethod(viewer.rootObject(), "selectFolder", Q_ARG(QVariant, folderString));
QMetaObject::invokeMethod(viewer.rootObject(), "selectSettingsFolder", Q_ARG(QVariant, settings->value("main/imageFolder").toString()));
QMetaObject::invokeMethod(viewer.rootObject(), "selectResizeToFit", Q_ARG(QVariant, settings->value("main/resizeToFit").toBool()));
+ QMetaObject::invokeMethod(viewer.rootObject(), "showScrollIndicators", Q_ARG(QVariant, settings->value("main/showScrollIndicators").toBool()));
+ QMetaObject::invokeMethod(viewer.rootObject(), "setBGColor", Q_ARG(QVariant, settings->value("main/backgroundColor").toString()));
+
checkDirectory();
}
return;
@@ -64,6 +76,20 @@ void Base::changeFitToScreen(bool fitToScreen)
checkSettings();
}
+void Base::changeScrollIndicators(bool showScrollIndicators)
+{
+ settings->setValue("main/showScrollIndicators", showScrollIndicators);
+ settings->sync();
+ checkSettings();
+}
+
+void Base::changeBGColor(QString bgColor)
+{
+ settings->setValue("main/backgroundColor", bgColor);
+ settings->sync();
+ checkSettings();
+}
+
void Base::getImageID(QString imageName)
{
int count = 1;
@@ -92,7 +118,9 @@ void Base::nextImage(QString imageName)
while(true)
{
- if (images[count].isNull()) break;
+ if (images[count].isNull()) {
+ break;
+ }
if (images[count] == imageName)
{
index = count;
@@ -106,6 +134,13 @@ void Base::nextImage(QString imageName)
QString fileName = images[count+1];
int nextIndex = index + 1;
+ if (images[count] == imageName && images[count+1].isNull())
+ {
+ nextIndex = 1;
+ fileName = images[1];
+ QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, nextIndex));
+ return;
+ }
if (fileName.isEmpty()) return;
QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, nextIndex));
@@ -130,11 +165,29 @@ void Base::previousImage(QString imageName)
}
QString fileName = images[count-1];
- int nextIndex = index - 1;
+ int previousIndex = index - 1;
+ if (previousIndex < 1)
+ {
+ count = images.size();
+ while (true)
+ {
+ if (images[count].isNull())
+ {
+ count--;
+ }
+ else {
+ break;
+ }
+ }
+ previousIndex = count;
+ fileName = images[previousIndex];
+ QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, previousIndex));
+ return;
+ }
if (fileName.isEmpty()) return;
- QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, nextIndex));
+ QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, previousIndex));
}
void Base::checkDirectory()
View
4 ImageViewer/Base.h
@@ -34,6 +34,8 @@ class Base : public QWidget
signals:
public slots:
+ void quitApplication();
+
void checkSettings();
void nextImage(QString);
@@ -45,6 +47,8 @@ public slots:
void selectFolder();
void changeFitToScreen(bool);
+ void changeScrollIndicators(bool);
+ void changeBGColor(QString);
void getImageID(QString);
};
View
2  ImageViewer/ImageViewer.loc
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T21:55:39
+// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-12T16:43:29
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
View
2  ImageViewer/ImageViewer.pro
@@ -59,3 +59,5 @@ OTHER_FILES += \
HEADERS += \
Base.h \
MediakeyCaptureItem.h
+
+
View
22 ImageViewer/ImageViewer.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.3.0, 2011-09-04T11:12:05. -->
+<!-- Written by Qt Creator 2.3.0, 2011-11-12T17:42:34. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -91,7 +91,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">Qt4ProjectManager.ToolChain.Maemo:d:/qtsdk/madde/targets/harmattan-platform-api/bin/gcc.unknown-unknown-unknown-unknown-unknown.D:/QtSDK/pythongdb/python_2.7based/gdb-arm-none-linux-gnueabi.exe</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -137,11 +137,11 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/QtSDK/Projects/ImageViewer</value>
- <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">41</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">-1</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">Qt4ProjectManager.ToolChain.Maemo:d:/qtsdk/madde/targets/harmattan-platform-api/bin/gcc.unknown-unknown-unknown-unknown-unknown.D:/QtSDK/pythongdb/python_2.7based/gdb-arm-none-linux-gnueabi.exe</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -187,7 +187,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/QtSDK/Projects/ImageViewer</value>
- <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">41</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">-1</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
@@ -309,7 +309,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Msvc:d:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat::</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -359,7 +359,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Msvc:d:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat::</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -409,7 +409,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Mingw:D:/QtSDK/mingw/bin/g++.exe.x86-windows-msys-pe-32bit.D:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -459,7 +459,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
- <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Mingw:D:/QtSDK/mingw/bin/g++.exe.x86-windows-msys-pe-32bit.D:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe</value>
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
@@ -772,7 +772,7 @@
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
- <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
@@ -840,7 +840,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.S60DeployConfiguration</value>
<value type="int" key="Qt4ProjectManager.S60DeployConfiguration.CommunicationChannel">1</value>
- <value type="QString" key="Qt4ProjectManager.S60DeployConfiguration.DeviceAddress">169.254.233.75</value>
+ <value type="QString" key="Qt4ProjectManager.S60DeployConfiguration.DeviceAddress">192.168.1.36</value>
<value type="QString" key="Qt4ProjectManager.S60DeployConfiguration.DevicePort">1534</value>
<value type="QChar" key="Qt4ProjectManager.S60DeployConfiguration.InstallationDriveLetter">C</value>
<value type="QString" key="Qt4ProjectManager.S60DeployConfiguration.SerialPortName"></value>
View
2  ImageViewer/ImageViewer.rss
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T21:55:39
+// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-12T16:43:29
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
View
2  ImageViewer/ImageViewer_exe.mmp
@@ -1,5 +1,5 @@
// ==============================================================================
-// Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T21:55:39
+// Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-12T16:43:29
// This file is generated by qmake and should not be modified by the
// user.
// Name : ImageViewer_exe.mmp
View
2  ImageViewer/ImageViewer_installer.pkg
@@ -1,4 +1,4 @@
-; D:/QtSDK/Projects/ImageViewer//ImageViewer_installer.pkg generated by qmake at 2011-09-02T21:55:39
+; D:/QtSDK/Projects/ImageViewer//ImageViewer_installer.pkg generated by qmake at 2011-11-12T16:43:29
; This file is generated by qmake and should not be modified by the user
;
View
2  ImageViewer/ImageViewer_reg.rss
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T21:55:39
+// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-12T16:43:29
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
View
3  ImageViewer/ImageViewer_stub.pkg
@@ -1,4 +1,4 @@
-; D:/QtSDK/Projects/ImageViewer//ImageViewer_stub.pkg generated by qmake at 2011-09-02T21:55:39
+; D:/QtSDK/Projects/ImageViewer//ImageViewer_stub.pkg generated by qmake at 2011-11-12T16:43:29
; This file is generated by qmake and should not be modified by the user
;
@@ -30,6 +30,7 @@
"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\arrow_left.png"
"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\arrow_right.png"
"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\back_to_grid.png"
+"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\information.png"
"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\zoom_down.png"
"" - "z:\private\e6a3ea2d\qml\ImageViewer\gfx\zoom_up.png"
"" - "z:\private\e6a3ea2d\qml\ImageViewer\GridList.qml"
View
3  ImageViewer/ImageViewer_template.pkg
@@ -1,4 +1,4 @@
-; D:/QtSDK/Projects/ImageViewer//ImageViewer_template.pkg generated by qmake at 2011-09-02T21:55:39
+; D:/QtSDK/Projects/ImageViewer//ImageViewer_template.pkg generated by qmake at 2011-11-12T16:43:29
; This file is generated by qmake and should not be modified by the user
;
@@ -34,6 +34,7 @@
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/arrow_left.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\arrow_left.png"
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/arrow_right.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\arrow_right.png"
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/back_to_grid.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\back_to_grid.png"
+"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/information.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\information.png"
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/zoom_down.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\zoom_down.png"
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/zoom_up.png" - "!:\private\e6a3ea2d\qml\ImageViewer\gfx\zoom_up.png"
"D:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/GridList.qml" - "!:\private\e6a3ea2d\qml\ImageViewer\GridList.qml"
View
2  ImageViewer/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: ImageViewer
-# Generated by qmake (2.01a) (Qt 4.7.3) on: pe 2. syys 21:55:39 2011
+# Generated by qmake (2.01a) (Qt 4.7.3) on: la 12. marras 16:43:29 2011
# Project: ImageViewer.pro
# Template: app
# Command: d:\qtsdk\symbian\sdks\symbian3qt473\bin\qmake.exe -spec ..\..\Symbian\SDKs\Symbian3Qt473\mkspecs\symbian-sbsv2 CONFIG+=release -after OBJECTS_DIR=obj MOC_DIR=moc UI_DIR=ui RCC_DIR=rcc -o bld.inf ImageViewer.pro
View
10 ImageViewer/bld.inf
@@ -1,6 +1,6 @@
// ============================================================================
// * Makefile for building: ImageViewer
-// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T21:55:39
+// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-11-12T16:43:29
// * This file is generated by qmake and should not be modified by the
// * user.
// * Project: ImageViewer.pro
@@ -51,6 +51,10 @@ OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/back_to_g
OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/winscw/c/private/e6a3ea2d/qml/ImageViewer/gfx/back_to_grid.png
END
START EXTENSION qt/qmake_emulator_deployment
+OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/information.png
+OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/winscw/c/private/e6a3ea2d/qml/ImageViewer/gfx/information.png
+END
+START EXTENSION qt/qmake_emulator_deployment
OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/zoom_down.png
OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/winscw/c/private/e6a3ea2d/qml/ImageViewer/gfx/zoom_down.png
END
@@ -88,6 +92,10 @@ OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/back_to_g
OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/back_to_grid.png
END
START EXTENSION qt/qmake_emulator_deployment
+OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/information.png
+OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/information.png
+END
+START EXTENSION qt/qmake_emulator_deployment
OPTION DEPLOY_SOURCE d:/QtSDK/Projects/ImageViewer/qml/ImageViewer/gfx/zoom_down.png
OPTION DEPLOY_TARGET d:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/data/z/private/e6a3ea2d/qml/ImageViewer/gfx/zoom_down.png
END
View
5 ImageViewer/qml/ImageViewer/GridList.qml
@@ -29,6 +29,11 @@ Page {
highlightFollowsCurrentItem: true
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: gridView
+ }
+
FolderListModel {
id: folderModel
nameFilters: ["*.jpg", "*.png", "*.gif", "*.jpeg"]
View
136 ImageViewer/qml/ImageViewer/ImageView.qml
@@ -24,6 +24,8 @@ Page {
property int totalImages;
+ property bool detailsVisible: false;
+
signal back();
signal goForward(string source);
@@ -42,6 +44,32 @@ Page {
onHeightChanged: adjustImage();
onWidthChanged: adjustImage();
+ Rectangle {
+ id: rectangle
+
+ color: "black"
+
+ x:-1000
+ y:-1000
+ width:6000
+ height:6000
+ }
+
+ Flickable {
+ id: flickableOut
+
+ x: -5000
+ y: -5000
+
+ height: 1
+ width: 1
+ }
+
+ ScrollDecorator {
+ id: scrollDecorator
+ flickableItem: flickable
+ }
+
Image {
id: currentImage
@@ -91,6 +119,22 @@ Page {
}
MouseArea {
+ id: areaInfo
+ x: page.width - 80 + flickable.contentX
+ y: 0 + flickable.contentY
+ width: 80
+ height: 80
+ onClicked: showInfo();
+ Image {
+ id: infoIcon
+ opacity: 0.5
+ source: "gfx/information.png"
+ anchors.centerIn: parent
+ visible: false
+ }
+ }
+
+ MouseArea {
id: areaZoomUp
x: page.width - 80 + flickable.contentX
y: page.height - 80 + flickable.contentY
@@ -155,6 +199,46 @@ Page {
height: 100
width: 100
}
+
+ Rectangle {
+ id: detailsRectangle
+
+ color: "gainsboro"
+ opacity: 0.5
+
+ scale: 1.05
+
+ visible: false
+
+ anchors {
+ top: detailsText.top
+ bottom: detailsText.bottom
+ left: detailsText.left
+ right: detailsText.right
+ }
+
+ }
+
+ Text {
+ id: detailsText
+ visible: false
+ color: "white"
+
+ font.pointSize: 6
+
+ anchors {
+ centerIn: parent
+ }
+
+ text: "File name:\nsomething.jpg"
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ style: Text.Outline
+ styleColor: "black"
+ }
+
Text {
id: errorText
visible: false
@@ -186,6 +270,8 @@ Page {
right: parent.right
}
+ font.pointSize: 5
+
text: "100 %"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
@@ -206,6 +292,8 @@ Page {
right: parent.right
}
+ font.pointSize: 5
+
text: "0/1"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
@@ -224,6 +312,19 @@ Page {
}
}
+ function showScrollIndicators(scrollBarsEnabled) {
+ if (scrollBarsEnabled === true)
+ scrollDecorator.flickableItem = flickable;
+ else if (scrollBarsEnabled === false)
+ scrollDecorator.flickableItem = flickableOut;
+ }
+
+ function pinched() {
+ setZoomText();
+ centerIn();
+ resize();
+ }
+
function flicked() {
imageHandled = true;
imageFlicked = true;
@@ -249,6 +350,7 @@ Page {
centerIn();
setZoomText();
}
+ imageHandled = true;
}
function setZoomText() {
@@ -306,6 +408,7 @@ Page {
resize();
showIcons();
+ flickable.returnToBounds();
}
function centerOnZoom() {
@@ -329,6 +432,7 @@ Page {
setTotalText();
currentImage.scale = 1;
currentImage.source = string;
+
resize();
}
@@ -352,6 +456,12 @@ Page {
}
if (resizeToFit == true) fitToScreen();
setZoomText();
+ var fileName;
+ var filePath = String(currentImage.source);
+
+ var separatorID = filePath.lastIndexOf("/");
+ fileName = filePath.substring(separatorID+1);
+ detailsText.text = "File name:\n" + fileName + "\n\nSize:\n"+originalHeight+"x"+originalWidth;
return;
}
if (currentImage.status == Image.Error) {
@@ -413,6 +523,11 @@ Page {
back();
}
+ function showInfo() {
+ detailsVisible = !detailsVisible;
+ showIcons();
+ }
+
function addListItem(imageFileName) {
listID++;
console.log("Added " + imageFileName);
@@ -426,20 +541,39 @@ Page {
zoomDownIcon.visible = true;
zoomUpIcon.visible = true;
backToGrid.visible = true;
- setZoomText();
+ infoIcon.visible = true;
zoomText.visible = true;
totalText.visible = true;
+ setZoomText();
+
+ if (detailsVisible === false) {
+ detailsText.visible = false;
+ detailsRectangle.visible = false;
+ }
+ else {
+ detailsText.visible = true;
+ detailsRectangle.visible = true;
+ }
+
timer.restart();
}
+ function setBGColor(newColor)
+ {
+ rectangle.color = newColor;
+ }
+
function hideIcons() {
arrowRight.visible = false;
arrowLeft.visible = false;
zoomDownIcon.visible = false;
zoomUpIcon.visible = false;
backToGrid.visible = false;
+ infoIcon.visible = false;
zoomText.visible = false;
totalText.visible = false;
+ detailsText.visible = false;
+ detailsRectangle.visible = false;
}
function nextImage(sourceImage) {
View
84 ImageViewer/qml/ImageViewer/Settings.qml
@@ -6,7 +6,9 @@ Page {
signal openFolderBrowser();
- signal resizeToFitChanged(bool value);
+ signal resizeToFitChanged(bool resizeToFit);
+ signal showScrollBarChanged(bool scrollBarChanged);
+ signal bgColorChanged(string bgColor);
function selectFolder(folderLocation) {
folderTextfield.text = folderLocation;
@@ -16,14 +18,26 @@ Page {
generalListModel.setProperty(0, "selected", resizeToFit);
}
- anchors.fill: parent
+ function setScrollIndicators(scrollBarsEnabled) {
+ generalListModel.setProperty(1, "selected", scrollBarsEnabled);
+ }
+
+ function setBGColor(bgColor)
+ {
+ colorSelection.subTitle = bgColor;
+ }
+
+ anchors {
+ top: parent.top
+ bottom: parent.bottom
+ }
Flickable {
id: flickable
anchors.fill: parent
- contentHeight: folderSelectButton.y + folderSelectButton.height
+ contentHeight: colorSelection.y + colorSelection.height + 50
clip: true
@@ -66,31 +80,85 @@ Page {
ListView {
id: generalListView
+
+ interactive: false
+
anchors {
top: folderTitle.bottom
topMargin: 60
+ bottom: parent.bottom
left: parent.left
right: parent.right
}
-
model: generalListModel
delegate: generalListDelegate
}
- ListModel {
- id: generalListModel
+ SelectionListItem {
+ id: colorSelection
+ title: "Background color"
+ subTitle: colorDialog.selectedIndex >= 0
+ ? colorDialog.model.get(colorDialog.selectedIndex).name
+ : "Please select"
- function changeSelection(id, value) {
- if (id === 0) resizeToFitChanged(value);
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ y: 235
+
+ onClicked: colorDialog.open();
+
+ SelectionDialog {
+ id: colorDialog
+ titleText: "Select one of the colors"
+ selectedIndex: -1
+ model: ListModel {
+ ListElement { name: "black" }
+ ListElement { name: "white" }
+ ListElement { name: "blue" }
+ ListElement { name: "darkblue" }
+ ListElement { name: "lightblue" }
+ ListElement { name: "red" }
+ ListElement { name: "pink" }
+ ListElement { name: "darkred" }
+ ListElement { name: "green" }
+ ListElement { name: "darkgreen" }
+ ListElement { name: "red" }
+ ListElement { name: "darkred" }
+ ListElement { name: "pink" }
+ ListElement { name: "gray" }
+ ListElement { name: "lightgray" }
+ ListElement { name: "darkgray" }
+ }
+
+ onSelectedIndexChanged: bgColorChanged(colorDialog.model.get(colorDialog.selectedIndex).name)
}
+ }
+
+ ListModel {
+ id: generalListModel
ListElement {
name: "Resize to fit"
role: "Title"
selected: true
}
+
+ ListElement {
+ name: "Show scroll indicators"
+ role: "Title"
+ selected: false
+ }
+
+ function changeSelection(id, value) {
+ if (id === 0) resizeToFitChanged(value);
+ if (id === 1) showScrollBarChanged(value);
+ }
+
}
}
Component {
View
BIN  ImageViewer/qml/ImageViewer/gfx/information.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
21 ImageViewer/qml/ImageViewer/main.qml
@@ -73,10 +73,12 @@ Window {
anchors.fill: parent
onOpenFolderBrowser: base.selectFolder();
- onResizeToFitChanged: base.changeFitToScreen(value);
+ onResizeToFitChanged: base.changeFitToScreen(resizeToFit);
+ onShowScrollBarChanged: base.changeScrollIndicators(scrollBarChanged);
+ onBgColorChanged: base.changeBGColor(bgColor);
}
- }
+ }
ToolBar {
id: toolBar
@@ -109,7 +111,7 @@ Window {
}
function setCurrentID(id) {
- gridList.setIndex(id);
+ gridList.setIndex(id-1);
imageView.currentID = id;
}
@@ -127,6 +129,17 @@ Window {
settings.setResizeToFit(resizeToFit);
}
+ function showScrollIndicators(scrollBarsEnabled) {
+ imageView.showScrollIndicators(scrollBarsEnabled);
+ settings.setScrollIndicators(scrollBarsEnabled);
+ }
+
+ function setBGColor(newColor)
+ {
+ settings.setBGColor(newColor);
+ imageView.setBGColor(newColor);
+ }
+
function showGrid() {
toolBar.visible = true;
toolBar.opacity = 0.5;
@@ -156,7 +169,7 @@ Window {
function back() {
if (settingsOpen == false) {
- Qt.quit();
+ base.quitApplication ();
return;
}
else {
Please sign in to comment.
Something went wrong with that request. Please try again.