Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b4b4186
Showing
44 changed files
with
3,361 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# ============================================================================== | ||
# This file is generated by make and should not be modified by the user | ||
# Name : .make.cache | ||
# Part of : | ||
# Description : This file is used to cache last build target for | ||
# make sis target. | ||
# Version : | ||
# ============================================================================== | ||
QT_SIS_TARGET ?= RELEASE-armv5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#include "Base.h" | ||
|
||
Base::Base(QWidget *parent) : | ||
QWidget(parent) | ||
{ | ||
imageCount = 0; | ||
|
||
QCoreApplication::setApplicationName("ImageViewer"); | ||
QCoreApplication::setOrganizationName("Matoking"); | ||
//viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); | ||
qmlRegisterType<MediakeyCaptureItem>("Mediakey", 1, 0, "MediakeyCapture"); | ||
viewer.setMainQmlFile(QLatin1String("qml/ImageViewer/main.qml")); | ||
viewer.showExpanded(); | ||
viewer.rootContext()->setContextProperty("base", this); | ||
|
||
checkedDirectory = ""; | ||
|
||
settings = new QSettings(this); | ||
checkSettings(); | ||
} | ||
|
||
void Base::checkSettings() | ||
{ | ||
if (settings->contains("main/imageFolder") == false) | ||
{ | ||
settings->setValue("main/imageFolder", QString("nothing")); | ||
settings->setValue("main/resizeToFit", true); | ||
|
||
settings->sync(); | ||
} | ||
else { | ||
QString folderString = QString("file:///%1").arg(settings->value("main/imageFolder").toString()); | ||
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())); | ||
checkDirectory(); | ||
} | ||
return; | ||
} | ||
|
||
void Base::changeDirectory(QString folderName) | ||
{ | ||
settings->setValue("main/imageFolder", folderName); | ||
settings->sync(); | ||
checkSettings(); | ||
} | ||
|
||
void Base::selectFolder() | ||
{ | ||
QString folder = QFileDialog::getExistingDirectory(this, | ||
QString("Open File"), settings->value("main/imageFolder").toString()); | ||
if (folder.isNull()) folder = "C:/"; | ||
folder.remove(folder.length() - 1, 1); | ||
settings->setValue("main/imageFolder", folder); | ||
settings->sync(); | ||
qDebug("Set folder to " + folder.toAscii()); | ||
checkSettings(); | ||
} | ||
|
||
void Base::changeFitToScreen(bool fitToScreen) | ||
{ | ||
settings->setValue("main/resizeToFit", fitToScreen); | ||
settings->sync(); | ||
checkSettings(); | ||
} | ||
|
||
void Base::nextImage(QString imageName) | ||
{ | ||
int count = 1; | ||
int index; | ||
|
||
while(true) | ||
{ | ||
if (images[count].isNull()) break; | ||
if (images[count] == imageName) | ||
{ | ||
index = count; | ||
break; | ||
} | ||
else { | ||
count++; | ||
} | ||
} | ||
|
||
QString fileName = images[count+1]; | ||
int nextIndex = index + 1; | ||
|
||
if (fileName.isEmpty()) return; | ||
|
||
QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, nextIndex)); | ||
} | ||
|
||
void Base::previousImage(QString imageName) | ||
{ | ||
int count = 1; | ||
int index; | ||
|
||
while(true) | ||
{ | ||
if (images[count].isNull()) break; | ||
if (images[count] == imageName) | ||
{ | ||
index = count; | ||
break; | ||
} | ||
else { | ||
count++; | ||
} | ||
} | ||
|
||
QString fileName = images[count-1]; | ||
int nextIndex = index - 1; | ||
|
||
if (fileName.isEmpty()) return; | ||
|
||
QMetaObject::invokeMethod(viewer.rootObject(), "showImage", Q_ARG(QVariant, fileName), Q_ARG(QVariant, nextIndex)); | ||
} | ||
|
||
void Base::checkDirectory() | ||
{ | ||
if (checkedDirectory == settings->value("main/imageFolder").toString()) return; | ||
qDebug("Checking directory " + settings->value("main/imageFolder").toString().toAscii()); | ||
QDir dir; | ||
QString path = settings->value("main/imageFolder").toString(); | ||
QStringList fileFilters; | ||
fileFilters << "*.png" << "*.jpg" << "*.gif" << "*.jpeg"; | ||
|
||
images.clear(); | ||
|
||
dir.setPath(path); | ||
dir.setFilter(QDir::Files); | ||
dir.setSorting(QDir::Name); | ||
dir.setNameFilters(fileFilters); | ||
|
||
QFileInfoList list = dir.entryInfoList(); | ||
|
||
int count = 1; | ||
|
||
for (int i = 0; i < list.size(); ++i) { | ||
QFileInfo fileInfo = list.at(i); | ||
|
||
images[count] = QString("file:///%1").arg(fileInfo.absoluteFilePath()); | ||
count++; | ||
|
||
qDebug("ADDED " + fileInfo.absoluteFilePath().toAscii()); | ||
} | ||
|
||
checkedDirectory = settings->value("main/imageFolder").toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef BASE_H | ||
#define BASE_H | ||
|
||
#include <QWidget> | ||
#include <qmlapplicationviewer.h> | ||
#include <QMetaObject> | ||
#include <QSettings> | ||
#include <QCoreApplication> | ||
#include <QtDeclarative> | ||
#include <QDeclarativeItem> | ||
#include <QDir> | ||
#include <QFileInfo> | ||
#include <QFileInfoList> | ||
#include <QStringList> | ||
#include <QFileDialog> | ||
#include <MediakeyCaptureItem.h> | ||
|
||
class Base : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit Base(QWidget *parent = 0); | ||
|
||
QmlApplicationViewer viewer; | ||
|
||
int imageCount; | ||
|
||
QSettings *settings; | ||
|
||
QString checkedDirectory; | ||
|
||
QMap<int, QString> images; | ||
|
||
signals: | ||
|
||
public slots: | ||
void checkSettings(); | ||
|
||
void nextImage(QString); | ||
void previousImage(QString); | ||
|
||
void checkDirectory(); | ||
void changeDirectory(QString); | ||
|
||
void selectFolder(); | ||
|
||
void changeFitToScreen(bool); | ||
}; | ||
|
||
#endif // BASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Desktop Entry] | ||
Encoding=UTF-8 | ||
Version=1.0 | ||
Type=Application | ||
Terminal=false | ||
Name=ImageViewer | ||
Exec=/opt/ImageViewer/bin/ImageViewer | ||
Icon=ImageViewer | ||
X-Window-Icon= | ||
X-HildonDesk-ShowInToolbar=true | ||
X-Osso-Type=application/x-executable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// ============================================================================ | ||
// * Generated by qmake (2.01a) (Qt 4.7.3) on: 2011-09-02T10:05:24 | ||
// * This file is generated by qmake and should not be modified by the | ||
// * user. | ||
// ============================================================================ | ||
|
||
#ifdef LANGUAGE_SC | ||
#define STRING_r_short_caption "ImageViewer" | ||
#define STRING_r_caption "ImageViewer" | ||
#else | ||
#define STRING_r_short_caption "ImageViewer" | ||
#define STRING_r_caption "ImageViewer" | ||
#endif |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Add more folders to ship with the application, here | ||
folder_01.source = qml/ImageViewer | ||
folder_01.target = qml | ||
DEPLOYMENTFOLDERS = folder_01 | ||
|
||
# Additional import path used to resolve QML modules in Creator's code model | ||
QML_IMPORT_PATH = | ||
|
||
symbian{ | ||
TARGET.UID3 = 0xE6A3EA2D | ||
INCLUDEPATH += MW_LAYER_SYSTEMINCLUDE // Not sure if this is needed... | ||
LIBS += -L\epoc32\release\armv5\lib -lremconcoreapi | ||
LIBS += -L\epoc32\release\armv5\lib -lremconinterfacebase | ||
} | ||
|
||
ICON = ImageViewer.svg | ||
TARGET = Image Viewer | ||
VERSION = 0.90 | ||
|
||
CONFIG += qt-components | ||
|
||
# Smart Installer package's UID | ||
# This UID is from the protected range and therefore the package will | ||
# fail to install if self-signed. By default qmake uses the unprotected | ||
# range value if unprotected UID is defined for the application and | ||
# 0x2002CCCF value if protected UID is given to the application | ||
#symbian:DEPLOYMENT.installer_header = 0x2002CCCF | ||
|
||
# Allow network access on Symbian | ||
symbian { | ||
TARGET.CAPABILITY += NetworkServices | ||
INCLUDEPATH += MW_LAYER_SYSTEMINCLUDE // Not sure if this is needed... | ||
LIBS += -L\epoc32\release\armv5\lib -lremconcoreapi | ||
LIBS += -L\epoc32\release\armv5\lib -lremconinterfacebase | ||
} | ||
|
||
# If your application uses the Qt Mobility libraries, uncomment the following | ||
# lines and add the respective components to the MOBILITY variable. | ||
# CONFIG += mobility | ||
# MOBILITY += | ||
|
||
# The .cpp file which was generated for your project. Feel free to hack it. | ||
SOURCES += main.cpp \ | ||
Base.cpp \ | ||
MediakeyCaptureItem.cpp | ||
|
||
# Please do not modify the following two lines. Required for deployment. | ||
include(qmlapplicationviewer/qmlapplicationviewer.pri) | ||
qtcAddDeployment() | ||
|
||
OTHER_FILES += \ | ||
qtc_packaging/debian_harmattan/rules \ | ||
qtc_packaging/debian_harmattan/README \ | ||
qtc_packaging/debian_harmattan/copyright \ | ||
qtc_packaging/debian_harmattan/control \ | ||
qtc_packaging/debian_harmattan/compat \ | ||
qtc_packaging/debian_harmattan/changelog | ||
|
||
HEADERS += \ | ||
Base.h \ | ||
MediakeyCaptureItem.h |
Oops, something went wrong.