summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/gettingStarted/parts/part5
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/tutorials/gettingStarted/parts/part5')
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml12
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml2
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml2
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml2
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml8
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp6
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h2
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp22
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h30
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h12
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro12
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject4
12 files changed, 57 insertions, 57 deletions
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml
index 7c63d752..da54a552 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml
@@ -46,7 +46,7 @@ Rectangle {
width: 1000; height: 1000
property int partition: height/3
state: "DRAWER_CLOSED"
-
+
//Item 1: MenuBar on the top portion of the screen
MenuBar{
id:menuBar
@@ -59,7 +59,7 @@ Rectangle {
y:drawer.height
color: "#3F3F3F"
fontColor: "#DCDCCC"
- height: partition*2; width:parent.width
+ height: partition*2; width:parent.width
}
//Item 3: The drawer handle
Rectangle{
@@ -78,10 +78,10 @@ Rectangle {
id: arrowIcon
source: "images/arrow.png"
anchors.horizontalCenter: parent.horizontalCenter
-
+
Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }}
}
-
+
MouseArea{
id: drawerMouseArea
anchors.fill:parent
@@ -105,14 +105,14 @@ Rectangle {
PropertyChanges { target: menuBar; y: 0}
PropertyChanges { target: textArea; y: partition + drawer.height}
PropertyChanges { target: drawer; y: partition}
- PropertyChanges { target: arrowIcon; rotation: 180}
+ PropertyChanges { target: arrowIcon; rotation: 180}
},
State{
name: "DRAWER_CLOSED"
PropertyChanges { target: menuBar; y:-height; }
PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height}
PropertyChanges { target: drawer; y: 0}
- PropertyChanges { target: arrowIcon; rotation: 0}
+ PropertyChanges { target: arrowIcon; rotation: 0}
}
]
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml
index aaf619b5..8f1488d1 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml
@@ -80,7 +80,7 @@ Rectangle {
signal buttonClick()
//define the clickable area to be the whole rectangle
- MouseArea {
+ MouseArea {
id: buttonMouseArea
anchors.fill: parent //stretch the area to the parent's dimension
onClicked: buttonClick()
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml
index 9f50c73f..b4bf3e24 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml
@@ -71,7 +71,7 @@ Rectangle {
}
Text {
height: header.height; anchors.centerIn: header
- text: "files:"
+ text: "files:"
color: "lightblue"
font.weight: Font.Light
font.italic: true
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml
index b2a34b9b..494f8acb 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml
@@ -53,7 +53,7 @@ Rectangle {
//used to divide the screen into parts.
property real partition: 1/3
- color: "#6C646A"
+ color: "#6C646A"
gradient: Gradient {
GradientStop { position: 0.0; color: "#6C646A" }
GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") }
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml
index 49dc0e0d..78e85080 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml
@@ -67,7 +67,7 @@ Rectangle {
Text {
height: parent.height
anchors { right: labelRow.left ; verticalCenter: parent.bottom }
- text: "menu: "
+ text: "menu: "
color: "lightblue"
font { weight: Font.Light; italic: true }
smooth: true
@@ -97,13 +97,13 @@ Rectangle {
id: editButton
height: 20; width: 50
buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9)
- scale: menuListView.currentIndex == 1? 1.25: 1
+ scale: menuListView.currentIndex == 1? 1.25: 1
label: "Edit"
radius: 1
labelSize: menuListView.currentIndex == 1? 16:12
smooth:true
//on a button click, change the list's currently selected item to EditMenu
- onButtonClick: menuListView.currentIndex = 1
+ onButtonClick: menuListView.currentIndex = 1
gradient: Gradient {
GradientStop { position: 0.0; color: editColor }
GradientStop { position: 1.0; color: "#136F6F6F" }
@@ -123,7 +123,7 @@ Rectangle {
//control the movement of the menu switching
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
- boundsBehavior: Flickable.StopAtBounds
+ boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 5000
highlightFollowsCurrentItem: true
highlightMoveDuration:240
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp
index 452124f5..84ebdced 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp
@@ -44,11 +44,11 @@
#include <QtDeclarative/qdeclarative.h>
void DialogPlugin::registerTypes(const char *uri){
-
+
//register the class Directory into QML as a "Directory" element version 1.0
qmlRegisterType<Directory>(uri, 1, 0, "Directory");
qmlRegisterType<File>(uri,1,0,"File");
-
+
//qRegisterMetaType<QDeclarativeListProperty<QString> > ("QDeclarativeListProperty<QString>");
-
+
}
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h
index 68c6076e..0a5bc9ef 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h
@@ -51,7 +51,7 @@ class DialogPlugin : public QDeclarativeExtensionPlugin
public:
//registerTypes is inherited from QDeclarativeExtensionPlugin
void registerTypes(const char *uri);
-
+
};
#endif
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
index bdf450eb..dd4a5546 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
@@ -48,10 +48,10 @@ Initialize the saves directory and creates the file list
*/
Directory::Directory(QObject *parent) : QObject(parent)
{
-
+
m_dir.cd( QDir::currentPath());
-
+
//go to the saved directory. if not found, create save directory
m_saveDir = "saves";
if (m_dir.cd(m_saveDir) == 0){
@@ -144,7 +144,7 @@ void Directory::setFileContent(const QString &str){
if(str != m_fileContent){
m_fileContent = str;
emit fileContentChanged();
- }
+ }
}
/*
@@ -152,17 +152,17 @@ Called from QML to save the file using the filename and file content.
Saving makes sure that the file has a .txt extension.
*/
void Directory::saveFile(){
-
+
if(currentFile.name().size() == 0){
qWarning()<< "Empty filename. no save";
return;
}
-
+
QString extendedName = currentFile.name();
if(!currentFile.name().endsWith(".txt")){
extendedName.append(".txt");
}
-
+
QFile file( m_dir.filePath(extendedName) );
if (file.open(QFile::WriteOnly | QFile::Truncate)){
QTextStream outStream(&file);
@@ -184,11 +184,11 @@ void Directory::loadFile(){
if(!currentFile.name().endsWith(".txt")){
extendedName.append(".txt");
}
-
+
QFile file( m_dir.filePath(extendedName) );
if (file.open(QFile::ReadOnly )){
QTextStream inStream(&file);
-
+
QString line;
do{
line = inStream.read(75);
@@ -205,12 +205,12 @@ created files are added onto the list.
void Directory::refresh(){
m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name);
m_fileList.clear();
-
+
File * file;
for(int i = 0; i < m_dirFiles.size() ; i ++){
-
+
file = new File();
-
+
if(m_dirFiles.at(i).endsWith(".txt")){
QString name = m_dirFiles.at(i);
file->setName( name.remove(".txt",Qt::CaseSensitive));
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h
index b5a7bbe1..a8997ee2 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h
@@ -52,22 +52,22 @@
class Directory : public QObject{
Q_OBJECT
-
+
//number of files in the directory
Q_PROPERTY(int filesCount READ filesCount)
-
+
//list property containing file names as QString
Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT )
-
+
//file name of the text file to read/write
Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
-
+
//text content of the file
Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged)
-
+
public:
Directory(QObject *parent = 0);
-
+
//properties' read functions
int filesCount() const;
QString filename() const;
@@ -77,30 +77,30 @@ class Directory : public QObject{
//properties' write functions
void setFilename(const QString &str);
void setFileContent(const QString &str);
-
+
//accessible from QML
Q_INVOKABLE void saveFile();
Q_INVOKABLE void loadFile();
-
+
signals:
void directoryChanged();
void filenameChanged();
void fileContentChanged();
-
+
private:
QDir m_dir;
- QStringList m_dirFiles;
- File currentFile;
+ QStringList m_dirFiles;
+ File currentFile;
QString m_saveDir;
- QStringList m_filterList;
-
+ QStringList m_filterList;
+
//contains the file data in QString format
QString m_fileContent;
-
+
//Registered to QML in a plugin. Accessible from QML as a property of Directory
QList<File *> m_fileList;
- //refresh content of the directory
+ //refresh content of the directory
void refresh();
};
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h
index ef1551a3..f3afb6ff 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h
@@ -46,20 +46,20 @@
#include <QObject>
class File : public QObject{
-
+
Q_OBJECT
-
+
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-
+
public:
File(QObject *parent = 0);
-
+
QString name() const;
void setName(const QString &str);
-
+
signals:
void nameChanged();
-
+
private:
QString m_name;
};
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro
index f9229a3b..856221bc 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro
@@ -8,10 +8,10 @@ MOC_DIR = tmp
TARGET = FileDialog
-HEADERS += directory.h \
- file.h \
- dialogPlugin.h
+HEADERS += directory.h \
+ file.h \
+ dialogPlugin.h
-SOURCES += directory.cpp \
- file.cpp \
- dialogPlugin.cpp
+SOURCES += directory.cpp \
+ file.cpp \
+ dialogPlugin.cpp
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject
index ed034dff..30e9e1fe 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject
@@ -4,8 +4,8 @@ Project {
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
- directory: "core"
- directory: "filedialog"
+ directory: "core"
+ directory: "filedialog"
}
JavaScriptFiles {
directory: "."