From: Cuong Le Date: Sun, 28 Aug 2011 05:43:05 +0000 (+0700) Subject: Added global controller andalso filebrowser qml X-Git-Tag: v1.0.2-4~1^2~1 X-Git-Url: http://git.maemo.org/git/?p=lichviet;a=commitdiff_plain;h=bebe39d38728cb4fcc9600bd65298fbef84ee7ee Added global controller andalso filebrowser qml --- diff --git a/LichViet.pro b/LichViet.pro index ab80377..4fc68cc 100644 --- a/LichViet.pro +++ b/LichViet.pro @@ -30,7 +30,8 @@ QT += dbus # The .cpp file which was generated for your project. Feel free to hack it. SOURCES += main.cpp \ - lunarcalendar.cpp + lunarcalendar.cpp \ + controller.cpp # Please do not modify the following two lines. Required for deployment. include(qmlapplicationviewer/qmlapplicationviewer.pri) @@ -40,7 +41,8 @@ RESOURCES += \ lichviet.qrc HEADERS += \ - lunarcalendar.h + lunarcalendar.h \ + controller.h OTHER_FILES += \ debian/changelog \ @@ -59,7 +61,6 @@ OTHER_FILES += \ qml/LichViet/TitleBar.qml \ qml/LichViet/Switch.qml \ qml/LichViet/OptionsScreen.qml \ - qml/LichViet/NoFeatureDialog.qml \ qml/LichViet/MultiTitleBar.qml \ qml/LichViet/MenuScreen.qml \ qml/LichViet/main.qml \ @@ -71,4 +72,7 @@ OTHER_FILES += \ qml/LichViet/AmDateTimeDialog.qml \ qml/LichViet/xemngaytotxau.js \ qml/LichViet/CacNgayLeTrongNam.js \ - qml/LichViet/ChangeTheme.qml + qml/LichViet/ChangeTheme.qml \ + qml/LichViet/MenuButton.qml \ + qml/LichViet/ScrollBar.qml \ + qml/LichViet/FileBrowser.qml diff --git a/Makefile b/Makefile index 2f5b216..e71dc73 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: LichViet -# Generated by qmake (2.01a) (Qt 4.7.3) on: Fri Aug 26 14:38:18 2011 +# Generated by qmake (2.01a) (Qt 4.7.3) on: Sun Aug 28 12:42:23 2011 # Project: LichViet.pro # Template: app # Command: /opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake -spec /opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/linux-g++-64 -o Makefile LichViet.pro @@ -45,14 +45,18 @@ OBJECTS_DIR = ./ SOURCES = main.cpp \ lunarcalendar.cpp \ + controller.cpp \ qmlapplicationviewer/qmlapplicationviewer.cpp moc_qmlapplicationviewer.cpp \ moc_lunarcalendar.cpp \ + moc_controller.cpp \ qrc_lichviet.cpp OBJECTS = main.o \ lunarcalendar.o \ + controller.o \ qmlapplicationviewer.o \ moc_qmlapplicationviewer.o \ moc_lunarcalendar.o \ + moc_controller.o \ qrc_lichviet.o DIST = /opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/common/g++.conf \ /opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/common/unix.conf \ @@ -161,7 +165,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) .tmp/LichViet1.0.2 || $(MKDIR) .tmp/LichViet1.0.2 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents qmlapplicationviewer/qmlapplicationviewer.h lunarcalendar.h .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents lichviet.qrc .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents main.cpp lunarcalendar.cpp qmlapplicationviewer/qmlapplicationviewer.cpp .tmp/LichViet1.0.2/ && (cd `dirname .tmp/LichViet1.0.2` && $(TAR) LichViet1.0.2.tar LichViet1.0.2 && $(COMPRESS) LichViet1.0.2.tar) && $(MOVE) `dirname .tmp/LichViet1.0.2`/LichViet1.0.2.tar.gz . && $(DEL_FILE) -r .tmp/LichViet1.0.2 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents qmlapplicationviewer/qmlapplicationviewer.h lunarcalendar.h controller.h .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents lichviet.qrc .tmp/LichViet1.0.2/ && $(COPY_FILE) --parents main.cpp lunarcalendar.cpp controller.cpp qmlapplicationviewer/qmlapplicationviewer.cpp .tmp/LichViet1.0.2/ && (cd `dirname .tmp/LichViet1.0.2` && $(TAR) LichViet1.0.2.tar LichViet1.0.2 && $(COMPRESS) LichViet1.0.2.tar) && $(MOVE) `dirname .tmp/LichViet1.0.2`/LichViet1.0.2.tar.gz . && $(DEL_FILE) -r .tmp/LichViet1.0.2 clean:compiler_clean @@ -187,15 +191,18 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all -compiler_moc_header_make_all: moc_qmlapplicationviewer.cpp moc_lunarcalendar.cpp +compiler_moc_header_make_all: moc_qmlapplicationviewer.cpp moc_lunarcalendar.cpp moc_controller.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_qmlapplicationviewer.cpp moc_lunarcalendar.cpp + -$(DEL_FILE) moc_qmlapplicationviewer.cpp moc_lunarcalendar.cpp moc_controller.cpp moc_qmlapplicationviewer.cpp: qmlapplicationviewer/qmlapplicationviewer.h /opt/QtSDK/Desktop/Qt/473/gcc/bin/moc $(DEFINES) $(INCPATH) qmlapplicationviewer/qmlapplicationviewer.h -o moc_qmlapplicationviewer.cpp moc_lunarcalendar.cpp: lunarcalendar.h /opt/QtSDK/Desktop/Qt/473/gcc/bin/moc $(DEFINES) $(INCPATH) lunarcalendar.h -o moc_lunarcalendar.cpp +moc_controller.cpp: controller.h + /opt/QtSDK/Desktop/Qt/473/gcc/bin/moc $(DEFINES) $(INCPATH) controller.h -o moc_controller.cpp + compiler_dbus_interface_source_make_all: compiler_dbus_interface_source_clean: compiler_dbus_adaptor_source_make_all: @@ -210,22 +217,24 @@ qrc_lichviet.cpp: lichviet.qrc \ qml/LichViet/OptionsScreen.qml \ qml/LichViet/Settings.js \ qml/LichViet/amlich-hnd.js \ - qml/LichViet/NoFeatureDialog.qml \ qml/LichViet/FullMonth.qml \ qml/LichViet/ToolBarSingle.qml \ qml/LichViet/CacNgayLeTrongNam.js \ qml/LichViet/Switch.qml \ qml/LichViet/amlich-aa98.js \ qml/LichViet/XemNgayTotXauHoangDao.qml \ + qml/LichViet/MenuButton.qml \ qml/LichViet/Themes.js \ qml/LichViet/AmDateTimeDialog.qml \ qml/LichViet/ToolBar.qml \ qml/LichViet/MultiTitleBar.qml \ + qml/LichViet/FileBrowser.qml \ qml/LichViet/main.qml \ qml/LichViet/MenuScreen.qml \ qml/LichViet/Button.qml \ qml/LichViet/xemngaytotxau.js \ qml/LichViet/TitleBar.qml \ + qml/LichViet/ScrollBar.qml \ qml/LichViet/ChangeTheme.qml \ qml/DatePicker/component/Reel.qml \ qml/DatePicker/component/Button.qml \ @@ -257,12 +266,16 @@ compiler_clean: compiler_moc_header_clean compiler_rcc_clean ####### Compile -main.o: main.cpp lunarcalendar.h +main.o: main.cpp lunarcalendar.h \ + controller.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp lunarcalendar.o: lunarcalendar.cpp lunarcalendar.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o lunarcalendar.o lunarcalendar.cpp +controller.o: controller.cpp controller.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o controller.o controller.cpp + qmlapplicationviewer.o: qmlapplicationviewer/qmlapplicationviewer.cpp qmlapplicationviewer/qmlapplicationviewer.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qmlapplicationviewer.o qmlapplicationviewer/qmlapplicationviewer.cpp @@ -272,6 +285,9 @@ moc_qmlapplicationviewer.o: moc_qmlapplicationviewer.cpp moc_lunarcalendar.o: moc_lunarcalendar.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_lunarcalendar.o moc_lunarcalendar.cpp +moc_controller.o: moc_controller.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_controller.o moc_controller.cpp + qrc_lichviet.o: qrc_lichviet.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_lichviet.o qrc_lichviet.cpp diff --git a/controller.cpp b/controller.cpp new file mode 100644 index 0000000..209e0f8 --- /dev/null +++ b/controller.cpp @@ -0,0 +1,33 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "controller.h" + +#include + +Controller::Controller(QObject *parent) : + QObject(parent) +{ +} + + +bool Controller::pathExists(const QString &path) { + QDir dir(path); + return dir.exists(); +} + + diff --git a/controller.h b/controller.h new file mode 100644 index 0000000..9c3629c --- /dev/null +++ b/controller.h @@ -0,0 +1,35 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef CONTROLLER_H +#define CONTROLLER_H + +#include + +class Controller : public QObject +{ + Q_OBJECT +public: + explicit Controller(QObject *parent = 0); + +signals: + +public slots: + bool pathExists(const QString &path); +}; + +#endif // CONTROLLER_H diff --git a/lichviet.qrc b/lichviet.qrc index 5b42758..4acb97c 100644 --- a/lichviet.qrc +++ b/lichviet.qrc @@ -16,8 +16,10 @@ qml/LichViet/XemNgayTotXauHoangDao.qml qml/LichViet/DateTimeDialog.qml qml/LichViet/AmDateTimeDialog.qmls - qml/LichViet/NoFeatureDialog.qml qml/LichViet/ChangeTheme.qml + qml/LichViet/MenuButton.qml + qml/LichViet/ScrollBar.qml + qml/LichViet/FileBrowser.qml qml/DatePicker/component/Button.qml qml/DatePicker/component/DateReel.qml qml/DatePicker/component/Reel.qml diff --git a/main.cpp b/main.cpp index 59e8d84..436a4c8 100644 --- a/main.cpp +++ b/main.cpp @@ -21,7 +21,9 @@ along with this program. If not, see #include #include "qmlapplicationviewer.h" + #include "lunarcalendar.h" +#include "controller.h" #ifdef Q_WS_MAEMO_5 #include @@ -35,9 +37,11 @@ int main(int argc, char *argv[]) app.setApplicationVersion(APP_VERSION); LunarCalendar lc; + Controller ctrller; viewer.rootContext()->setContextProperty("ROOT", &viewer); viewer.rootContext()->setContextProperty("LC", &lc); + viewer.rootContext()->setContextProperty("Controller", &ctrller); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setSource(QUrl("qrc:/qml/LichViet/main.qml")); diff --git a/qml/LichViet/About.qml b/qml/LichViet/About.qml index 4d4751a..af36f5b 100644 --- a/qml/LichViet/About.qml +++ b/qml/LichViet/About.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,7 +14,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ - import QtQuick 1.0 Item{ @@ -94,7 +93,4 @@ wrapMode: Text.NoWrap } } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] } diff --git a/qml/LichViet/AmDateTimeDialog.qml b/qml/LichViet/AmDateTimeDialog.qml index d7d9a09..63890b7 100644 --- a/qml/LichViet/AmDateTimeDialog.qml +++ b/qml/LichViet/AmDateTimeDialog.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -495,10 +495,6 @@ Item{ } ] - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 100; easing.type: Easing.InOutBack } } - ] - function reset(){ var acs = AmLich.getYearInfo(screen.curYear) var a=AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear) @@ -512,7 +508,7 @@ Item{ if (aaa){ for (var i=0;i<=12;i++){ var l=acs[i].month - if (t==l && a.leap==0){ + if (t==l && a.leap===0){ if (a.month>i){ finalmonth = finalmonth+1; break; diff --git a/qml/LichViet/Button.qml b/qml/LichViet/Button.qml index 5f9f4da..c1a24d7 100644 --- a/qml/LichViet/Button.qml +++ b/qml/LichViet/Button.qml @@ -1,3 +1,19 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ import QtQuick 1.0 diff --git a/qml/LichViet/CacNgayLeTrongNam.js b/qml/LichViet/CacNgayLeTrongNam.js index 8717ede..0af4c81 100644 --- a/qml/LichViet/CacNgayLeTrongNam.js +++ b/qml/LichViet/CacNgayLeTrongNam.js @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/qml/LichViet/ChangeTheme.qml b/qml/LichViet/ChangeTheme.qml index 7f7aa5a..181fc1e 100644 --- a/qml/LichViet/ChangeTheme.qml +++ b/qml/LichViet/ChangeTheme.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -19,13 +19,57 @@ import QtQuick 1.0 import "Themes.js" as Themes Item{ + id:change_theme Rectangle { id: rectangle1 anchors.fill: parent; anchors.bottomMargin: 0 visible: true opacity:0.9 - color:"black" + color:"white" + + Component { + id: listDelegate + Rectangle { + height:65 + MenuButton { + y: 3; width: parent.parent.width; height: 60 + onClicked: { + listModel.select(index) + } + text: name + tip: title + selected:is_selected + } + } + } + + ListModel { + id: listModel + + Component.onCompleted: { + Themes.init(Controller, listModel); + } + + ListElement { + idm:1;name: "DEFAULT";title:"Theme mặc định, không thể xóa";can_be_deleted:false;is_selected:true + } + + function select(idx){ + for(var i=0;i This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,7 +14,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see */ - import QtQuick 1.0 import "../DatePicker/component" as Comp @@ -83,7 +82,4 @@ Item{ dateReel.year_reset() } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] } diff --git a/qml/LichViet/FileBrowser.qml b/qml/LichViet/FileBrowser.qml new file mode 100644 index 0000000..f67bf63 --- /dev/null +++ b/qml/LichViet/FileBrowser.qml @@ -0,0 +1,44 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +import QtQuick 1.0 + +Item{ + +Rectangle { + id: rectangle1 + anchors.fill: parent; anchors.bottomMargin: 0 + visible: true + opacity:0.9 + color:"white" +} + +ToolBar { id: toolBar; height: 50; + y: screen.height-78 + width: parent.width; + button1Label: "Đồng Ý" + button2Label: "Hủy Bỏ" + onButton1Clicked: + { + screen.state="menuscreen" + } + onButton2Clicked: { + screen.state="menuscreen" + } +} + +} diff --git a/qml/LichViet/FullMonth.qml b/qml/LichViet/FullMonth.qml index 992ddf8..331b3f7 100644 --- a/qml/LichViet/FullMonth.qml +++ b/qml/LichViet/FullMonth.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -29,7 +29,6 @@ Item{ Rectangle{ id: fullmonthREC anchors.fill: parent; anchors.bottomMargin: 0 - visible: true opacity:0.9 Component { @@ -200,10 +199,6 @@ onCanceled:{ } } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] - states: [ State { name: "xemtheothang" diff --git a/qml/LichViet/MenuButton.qml b/qml/LichViet/MenuButton.qml new file mode 100644 index 0000000..f07330c --- /dev/null +++ b/qml/LichViet/MenuButton.qml @@ -0,0 +1,70 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ +import QtQuick 1.0 + +Item { + id:menubutton + property string text + property string tip + property bool selected + + signal clicked + + Rectangle{ + id:menurectangle + color: selected ? "#000000":"#a7bfe8" + anchors.fill:parent + radius: 8 + border.color: "#ca8282" + + Text { + id: text1 + x: 20 + y: 8 + text:menubutton.text + font.bold: true + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 22 + color:"#404040" + } + + Text { + id: text2 + x: 20 + y: 33 + text:menubutton.tip + font.bold: true + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 16 + color:"grey" + } + } + + MouseArea { + id: mouseRegion + anchors.fill: menurectangle + onClicked: { menubutton.clicked(); } + } + + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: menurectangle; color:"white" } + } + ] +} diff --git a/qml/LichViet/MenuScreen.qml b/qml/LichViet/MenuScreen.qml index ae0c5bd..c654e55 100644 --- a/qml/LichViet/MenuScreen.qml +++ b/qml/LichViet/MenuScreen.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -18,9 +18,12 @@ along with this program. If not, see import QtQuick 1.0 Item{ + + id:menuscreen + Rectangle { id: rectangle1 - anchors.fill: parent; anchors.bottomMargin: 0 + anchors.fill: parent; anchors.bottomMargin: 16 visible: true opacity:0.9 @@ -28,15 +31,13 @@ Item{ id: listDelegate Rectangle { height:65 - Button { - id: button1 + MenuButton { y: 3; width: parent.parent.width; height: 60 onClicked: { getText(idm) } - - focus:true text: name + tip: title } } } @@ -45,31 +46,34 @@ Item{ id: listModel ListElement { - idm:1;name: "Hôm Nay"; + idm:1;name: "Hôm Nay";title:"Chuyển nhanh đến ngày hôm nay" + } + ListElement { + idm:2; name: "Tới Ngày Âm Lịch";title:"Chọn ngày tháng năm Âm Lịch để chuyển tới" } ListElement { - idm:2; name: "Tới Ngày Âm"; + idm:3;name: "Tới Ngày Dương Lịch";title:"Chọn ngày tháng năm Dương lịch để chuyến tới" } ListElement { - idm:3;name: "Tới Ngày Dương"; + idm:4; name: "Xem Ngày Tốt/Xấu, Hoàng Đạo ...";title:"Giờ hòang đạo, sao tốt, sao xấu, nhị thập bát tú, ..." } ListElement { - idm:4; name: "Xem Ngày Tốt/Xấu, Hoàng Đạo ..."; + idm:5; name: "Xem Theo Tháng";title:"Xem ngày Dương Lịch/Âm Lịch dưới dạng tháng" } ListElement { - idm:5; name: "Xem Theo Tháng"; + idm:7; name: "Đổi Theme";title:"Thay đổi theme, hình nền, ..." } - /*ListElement { - idm:7; name: "Đổi Theme"; - }*/ ListElement { - idm:6; name: "Giới Thiệu"; + idm:8; name: "Đổi Hình Nền";title:"/opt/bar/load.jpg" + } + ListElement { + idm:6; name: "Giới Thiệu";title:"..." } } ListView { id: listView - anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5; + anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5;anchors.bottomMargin: 12 model: listModel delegate: listDelegate focus: true @@ -77,7 +81,8 @@ Item{ } - ToolBarSingle { id: toolBar; height: 50; + ToolBarSingle { + id: toolBar; height: 50; y: screen.height-78 width: parent.width; button1Label: "Quay Về" @@ -96,13 +101,18 @@ Item{ case 5: screen.state="xemtheothang";break; case 6: screen.state="aboutdialog";break; case 7: screen.state="changetheme";break; - default: - screen.state="nofeaturedialog";break; + case 8: screen.state="filebrowser";break; } } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] + FileBrowser{ + id: fileBrowser + state:"filebrowser" + anchors.verticalCenter: parent.verticalCenter + width: parent.width; height: parent.height-60; + x: -(screen.width * 1.5) + } + + } diff --git a/qml/LichViet/MultiTitleBar.qml b/qml/LichViet/MultiTitleBar.qml index a484ba4..b571804 100644 --- a/qml/LichViet/MultiTitleBar.qml +++ b/qml/LichViet/MultiTitleBar.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/qml/LichViet/NoFeatureDialog.qml b/qml/LichViet/NoFeatureDialog.qml deleted file mode 100644 index 02fdde5..0000000 --- a/qml/LichViet/NoFeatureDialog.qml +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright (C) 2011 by Cuong Le - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -import QtQuick 1.0 - -Item{ - id: item1 - - Rectangle { - id: rectangle1 - x: 0 - y: -16 - anchors.centerIn: parent - width:344 - height: 234 - radius: 4 - gradient: Gradient { - GradientStop { - position: 0 - color: "#ffffff" - } - - GradientStop { - position: 0.97 - color: "#ffffff" - } - - GradientStop { - position: 0.04 - color: "#aca4c6" - } - } - border.color: "#f3e3e8" - visible: true - opacity:0.9 - - Button { - id: button2 - x: 102 - anchors.right: parent.right; anchors.rightMargin: 102; y: 185; width: 140; height: 40 - text: "OK" - onClicked: {screen.state="mainscreen"} - } - - Button { - id: button3 - x: 298 - y: 6 - width: 39 - height: 40 - text: "X" - anchors.rightMargin: 56 - onClicked: {screen.state="mainscreen"} - } - - Text { - id: text1 - x: 132 - y: 100 - width: 80 - height: 20 - color: "#12347e" - text: "Chức năng này hiện chưa có !" - font.strikeout: false - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 22 - - } - } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] -} diff --git a/qml/LichViet/OptionsScreen.qml b/qml/LichViet/OptionsScreen.qml index 2ea89a3..fdf9bda 100644 --- a/qml/LichViet/OptionsScreen.qml +++ b/qml/LichViet/OptionsScreen.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -22,7 +22,7 @@ Item{ Rectangle { id: rectangle1 - anchors.fill: parent; anchors.bottomMargin: 0 + anchors.fill: parent; anchors.bottomMargin: 16 visible: true opacity:0.9 @@ -100,7 +100,4 @@ Item{ } } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] } diff --git a/qml/LichViet/ScrollBar.qml b/qml/LichViet/ScrollBar.qml new file mode 100644 index 0000000..63dd0bd --- /dev/null +++ b/qml/LichViet/ScrollBar.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: scrollBar + + // The properties that define the scrollbar's state. + // position and pageSize are in the range 0.0 - 1.0. They are relative to the + // height of the page, i.e. a pageSize of 0.5 means that you can see 50% + // of the height of the view. + // orientation can be either Qt.Vertical or Qt.Horizontal + property real position + property real pageSize + property variant orientation : Qt.Vertical + + // A light, semi-transparent background + Rectangle { + id: background + anchors.fill: parent + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) + color: "white" + opacity: 0.3 + } + + // Size the bar to the required size, depending upon the orientation. + Rectangle { + x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == Qt.Vertical ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) + color: "black" + opacity: 0.7 + } +} diff --git a/qml/LichViet/Settings.js b/qml/LichViet/Settings.js index 0477324..242c91d 100644 --- a/qml/LichViet/Settings.js +++ b/qml/LichViet/Settings.js @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/qml/LichViet/Switch.qml b/qml/LichViet/Switch.qml index 4e6ab7c..0942912 100644 --- a/qml/LichViet/Switch.qml +++ b/qml/LichViet/Switch.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/qml/LichViet/Themes.js b/qml/LichViet/Themes.js index 80d73de..8690364 100644 --- a/qml/LichViet/Themes.js +++ b/qml/LichViet/Themes.js @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -22,3 +22,9 @@ var root_dir = "/opt/usr/share/LichViet/"; function default_theme(){ return "file:"+root_dir+"themes/default/default.qml"; } + +function init(Controller, Model){ + if(Controller.pathExists(root_dir)){ + Model.append({idm:2,name: "BLACK",title:"",can_be_deleted:false,is_selected:false}) + } +} diff --git a/qml/LichViet/ToolBarSingle.qml b/qml/LichViet/ToolBarSingle.qml index bba117e..0225060 100644 --- a/qml/LichViet/ToolBarSingle.qml +++ b/qml/LichViet/ToolBarSingle.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/qml/LichViet/TopBar.qml b/qml/LichViet/TopBar.qml index 82a6d84..fc1dd1c 100644 --- a/qml/LichViet/TopBar.qml +++ b/qml/LichViet/TopBar.qml @@ -1,3 +1,20 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + import QtQuick 1.0 Rectangle{ @@ -8,7 +25,7 @@ Rectangle{ Image { id: topbar_container_image - source: "./img/topbar.jpg" + source: theme_manager.theme.titlebar.sci width:parent.width height:50 } diff --git a/qml/LichViet/XemNgayTotXauHoangDao.qml b/qml/LichViet/XemNgayTotXauHoangDao.qml index f15f01c..c305e12 100644 --- a/qml/LichViet/XemNgayTotXauHoangDao.qml +++ b/qml/LichViet/XemNgayTotXauHoangDao.qml @@ -44,6 +44,7 @@ Item{ visible: true opacity:0.9 + Component { id: listDelegate @@ -73,9 +74,9 @@ Item{ } } - } + ListModel { id: listModel @@ -163,7 +164,4 @@ Item{ main_item.huong_xuat_hanh = NTX.huong_xuat_hanh(screen.lunarDayCanChi); } - transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } - ] } diff --git a/qml/LichViet/main.qml b/qml/LichViet/main.qml index 1c7eb47..338f9a1 100644 --- a/qml/LichViet/main.qml +++ b/qml/LichViet/main.qml @@ -3,7 +3,7 @@ Copyright (C) 2011 by Cuong Le This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or +the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -25,8 +25,8 @@ import "CacNgayLeTrongNam.js" as CNLTN Item { id: screen - width: 480 - height: 800 + width: 800 + height: 480 property int curDay: LC.curDay() property int curMonth: LC.curMonth() @@ -100,9 +100,10 @@ Item { width: 80 height: 20 color: "#29d999" - text: "Tháng "+screen.curMonth+" Năm "+screen.curYear + textFormat: Text.RichText + text: "Tháng "+screen.curMonth+" Năm "+screen.curYear+"" anchors.horizontalCenter: parent.horizontalCenter - font.bold: true + font.bold: false font.family: "Tahoma" smooth: true horizontalAlignment: Text.AlignHCenter @@ -120,6 +121,7 @@ Item { property int index: 0 onIndexChanged: txtDATEpv.currentIndex = reelx.index color: "transparent" + Component { id: delegate Column { @@ -145,7 +147,7 @@ Item { } } else - return theme_manager.theme.markdate.otherday; + return "transparent";//theme_manager.theme.markdate.otherday; } } } @@ -214,10 +216,6 @@ Item { } function init(){ - while(maindatemodel.count>0){ - try{maindatemodel.remove(maindatemodel.count-1)}catch(e){} - } - for(var i=1;i<=LC.calDays(screen.curMonth,screen.curYear);i++) append({name:i}) @@ -226,9 +224,6 @@ Item { } //------------------------------------------------- - Component.onCompleted: { - maindatemodel.init() - } Text { id: txtTHU @@ -333,18 +328,17 @@ Item { x: -(screen.width * 1.5) } - NoFeatureDialog{ - id: nofeatureDialog - state:"nofeaturedialog" + About{ + id: aboutDialog + state:"aboutdialog" anchors.verticalCenter: parent.verticalCenter width: parent.width; height: parent.height-60; x: -(screen.width * 1.5) } - - About{ - id: aboutDialog - state:"aboutdialog" + FileBrowser{ + id: fileBrowser + state:"filebrowser" anchors.verticalCenter: parent.verticalCenter width: parent.width; height: parent.height-60; x: -(screen.width * 1.5) @@ -383,6 +377,12 @@ Item { PropertyChanges { target: mouseareaMM;enabled:false } }, + State{ + name:"filebrowser" + PropertyChanges { target: fileBrowser; x: 0; focus:true; visible:true;} + PropertyChanges { target: toolBar; y: screen.height } + PropertyChanges { target: toolBar } + }, State { name: "optionsscreen"; PropertyChanges { target: optionsScreen; x: 0; focus:true} @@ -396,12 +396,13 @@ Item { PropertyChanges { target: changeTheme; x: 0; focus:true} PropertyChanges { target: toolBar; y: screen.height } PropertyChanges { target: toolBar } - PropertyChanges { target: mouseareaMM;enabled:false } + PropertyChanges { target: reelx;enabled:false } + PropertyChanges { target: mouseareaMM;enabled:false } }, State { name: "xemngaytotxauhoangdao"; - PropertyChanges { target: xntxhdScreen; x: 0; focus:true} + PropertyChanges { target: xntxhdScreen; x: 0; focus:true;visible:true;} PropertyChanges { target: toolBar; y: screen.height } PropertyChanges { target: toolBar } PropertyChanges { target: mouseareaMM;enabled:false } @@ -440,23 +441,15 @@ Item { } }, State { - name: "nofeaturedialog"; - PropertyChanges { target: nofeatureDialog; x: 0; focus:true} - PropertyChanges { target: toolBar; y: screen.height } - PropertyChanges { target: toolBar } - PropertyChanges { target: mouseareaMM;enabled:false } - PropertyChanges { target: reelx;enabled:false } - }, - State { name: "aboutdialog"; - PropertyChanges { target: aboutDialog; x: 0; focus:true} + PropertyChanges { target: aboutDialog; x: 0; focus:true; visible:true;} PropertyChanges { target: toolBar; y: screen.height } PropertyChanges { target: toolBar } PropertyChanges { target: mouseareaMM;enabled:false } }, State { name: "xemtheothang"; - PropertyChanges { target: fullmonthDialog; x: 0; focus:true} + PropertyChanges { target: fullmonthDialog; x: 0; focus:true; visible:true;} PropertyChanges { target: toolBar; y: screen.height } PropertyChanges { target: toolBar } StateChangeScript { @@ -469,7 +462,8 @@ Item { ] transitions: [ - Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } } + //normally i used InOutBack + Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } } ] @@ -507,6 +501,8 @@ Item { } Component.onCompleted: { - + amdatetimeDialog.reset() + maindatemodel.init() } + } diff --git a/qmlapplicationviewer/qmlapplicationviewer.cpp b/qmlapplicationviewer/qmlapplicationviewer.cpp index d3901bd..eef9cf7 100644 --- a/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -21,6 +21,9 @@ #include #include +#include +#include + #if defined(QMLJSDEBUGGER) #include #endif diff --git a/qmlapplicationviewer/qmlapplicationviewer.h b/qmlapplicationviewer/qmlapplicationviewer.h index e22f909..2ea192a 100644 --- a/qmlapplicationviewer/qmlapplicationviewer.h +++ b/qmlapplicationviewer/qmlapplicationviewer.h @@ -35,6 +35,10 @@ public: Q_INVOKABLE void initScreenOrientation(int); Q_INVOKABLE void minimize(); +signals: + +public slots: + private: class QmlApplicationViewerPrivate *m_d; };