#include "SettingsWidget.h"
#include <QDebug>
-SettingsWidget::SettingsWidget(GUIInterface *parent) :
- QDialog(parent)
-{
- guiInterface = parent;
+SettingsWidget::SettingsWidget(GUIInterface *parent) : QDialog(parent) {
- setWindowTitle(tr("Settings"));
+guiInterface = parent;
- initalizeUI();
+/*
+#ifndef Q_WS_MAEMO_5
+
+ view= new QDeclarativeView();
+ view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/SettingsWidget.qml"));
+ view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ view->setAlignment(Qt::AlignCenter);
+ view->show();
+
+ mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(view);
+ setLayout(mainLayout);
+
+ QGraphicsObject *rootObject = view->rootObject();
+
+ // connect(this, SIGNAL(setUrl(QVariant)),
+ // rootObject, SLOT(setUrl(QVariant)));
+ view->setWindowTitle(tr("Settings"));
+#else
+// */
+ setWindowTitle(tr("Settings"));
+ initalizeUI();
setModal(true);
+//#endif
}
void SettingsWidget::initalizeUI() {
void SettingsWidget::showEvent(QShowEvent *e) {
+/*
+#ifndef Q_WS_MAEMO_5
+ QDialog::showEvent(e);
+#else
+//*/
#ifndef Q_WS_MAEMO_5
_save = false;
#endif
_changed = false;
QDialog::showEvent(e);
+//#endif
}
void SettingsWidget::hideEvent(QHideEvent *e) {
#include <QWidget>
#include <QtGui>
#include <QPushButton>
+#include <QDeclarativeView>
+
#include "../../include/GUIInterface.h"
#include "../../include/settings.h"
#include "SpinBox.h"
+
/*!
Shows settings that user can change.
It allows to change limit of searches and limit of history.
private:
void initalizeUI();
+
+ QVBoxLayout* mainLayout;
+ QDeclarativeView *view;
+
SpinBox* historySizeSpinBox;
SpinBox* searchResultSizeSpinBox;
QVBoxLayout* verticalLayout;
#ifndef Q_WS_MAEMO_5
view= new QDeclarativeView();
- view->setSource(QUrl("src/mdictionary/qml/TranslationView.qml"));
+ view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/TranslationView.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
view->setAlignment(Qt::AlignCenter);
view->show();
qml/FlickableWebView.qml \
qml/ScrollBar.qml \
qml/Checkbox.qml \
- qml/MySpinBox.qml
+ qml/MySpinBox.qml \
+ qml/SettingsWidget.qml
target.path = $$BIN_DIR
INSTALLS += target
meego {
qmls.path = $$DATA_DIR/qml
qmls.files += ./qml/WelcomeScreenWidget.qml
+ qmls.files += ./qml/Button.qml
+ qmls.files += ./qml/AboutWidget.qml
+ qmls.files += ./qml/SearchBarWidget.qml
+ qmls.files += ./qml/IconButton.qml
+ qmls.files += ./qml/MyTextLineEdit.qml
+ qmls.files += ./qml/ProgressBar.qml
+ qmls.files += ./qml/ElementsListView.qml
+ qmls.files += ./qml/DictTypeSelectDialog.qml
+ qmls.files += ./qml/DictManagerWidget.qml
+ qmls.files += ./qml/WordListWidget.qml
+ qmls.files += ./qml/TranslationView.qml
+ qmls.files += ./qml/FlickableWebView.qml
+ qmls.files += ./qml/ScrollBar.qml
+ qmls.files += ./qml/Checkbox.qml
+ qmls.files += ./qml/MySpinBox.qml
+ qmls.files += ./qml/SettingsWidget.qml
}
else:maemo5 {
qmls.path = $$DATA_DIR/qml
qmls.files += ./qml/ScrollBar.qml
qmls.files += ./qml/Checkbox.qml
qmls.files += ./qml/MySpinBox.qml
+ qmls.files += ./qml/SettingsWidget.qml
}
INSTALLS += desktop icon64 shared service css css_images qmls
onLinkActivated: linkClicked(link);
}
- MySpinBox {
+ /* MySpinBox {
id: test01
- y:50;
- x:100;
+ y:20;
+ x:20;
width: 40
height: 20;
}
-
+ */
}
property int minValue:0;
property alias value:text_input1.text
+ signal valueChange(int intiger);
+
+ function stringToInt(string){
+ var value=0;
+ var pow10=1;
+ for (var i=string.length-1;i>=0;i--){
+ value+=(string.charCodeAt(i)-48)*pow10;
+ pow10= pow10*10;
+ }
+ if(value>maxValue)
+ return maxValue;
+ if(value<minValue)
+ return minValue;
+ return value;
+ }
+
TextInput {
id: text_input1
x: 1
width: rectangle1.width-15
height: rectangle1.height*0.6;
- text: "0"
+ text: "123"
anchors.centerIn: parent
validator: IntValidator{bottom: 0; top: 500;}
transformOrigin: Item.Left
selectByMouse: true;
font.pixelSize: rectangle1.height * .5;
onCursorPositionChanged: moveCursorSelection(cursorPosition);
- focus: rectangle1.focus;
- /* Keys.onPressed: {
- if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
- rectangle1.enterPressed(text_input1.text)
+ //focus: rectangle1.focus;
+ onTextChanged: rectangle1.valueChange(stringToInt(text_input1.text));
+
+ }
+
+ Timer {
+ id:timerUp;
+ interval: 100;
+ running: false;
+ repeat: true
+ onTriggered:{
+ if(mouseAreaUp.pressedButtons==Qt.LeftButton)
+ text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+ else
+ running=false;
+ }
+ }
+
+ Timer {
+ id:timerDown;
+ interval: 100;
+ running: false;
+ repeat: true
+ onTriggered:{
+ if(mouseAreaDown.pressedButtons==Qt.LeftButton)
+ text_input1.text=((stringToInt(text_input1.text)-1)<minValue)?(minValue):(stringToInt(text_input1.text)-1);
+ else
+ running=false;
}
-*/
}
Rectangle {
id: shadeDisable
+ width: parent.width;
+ height: parent.height;
anchors.centerIn: parent;
radius: parent.radius
color: "grey";
opacity: 0
- width: parent.width;
- height: parent.height;
}
Image {
id: imageUp
z:4;
+ width: 11;
+ height: 6;
anchors.right: parent.right
anchors.top: parent.top
anchors.rightMargin: 2
anchors.topMargin: 2
- width: 11;
- height: 6;
-
source: "qrc:/button/up_enable.png";
}
MouseArea {
id: mouseAreaUp
+ z:5
+ width: 13;
+ height: rectangle1.height/2;
anchors.right: parent.right
anchors.top: parent.top
- anchors.rightMargin: 2
- anchors.topMargin: 2
- width: 11;
- height: rectangle1/2;
- onClicked: {
- console.log("t1");
- //rectangle.clicked();
+ onClicked: text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+ onPressAndHold:{
+ timerUp.restart;
+ timerUp.running=true;
}
}
MouseArea {
id: mouseAreaDown
+ z:5
+ width: 13;
+ height: rectangle1.height/2;
anchors.right: parent.right
- anchors.top: parent.top
- anchors.rightMargin: 2
- anchors.topMargin: 2
- width: 11;
- height: rectangle1/2;
- onClicked: {
- console.log("t2");
- //rectangle.clicked();
+ anchors.bottom: parent.bottom
+ onClicked: text_input1.text=((stringToInt(text_input1.text)-1)<minValue)?(minValue):(stringToInt(text_input1.text)-1);
+ onPressAndHold:{
+ timerDown.restart;
+ timerDown.running=true;
}
-
}
- states: [
+ /* states: [
State {
name: "DisableState"; when: rectangle1.enabled==false;
PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
}
]
+ */
}
--- /dev/null
+import Qt 4.7
+
+Rectangle {
+ width: 500
+ height:500
+
+ Text {
+ id: text1
+ x: 36
+ y: 11
+ width: 80
+ height: 20
+ text: "Search result size"
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: text2
+ x: 36
+ y: 83
+ width: 80
+ height: 20
+ text: "History size"
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: text3
+ x: 36
+ y: 131
+ width: 80
+ height: 20
+ text: "Search in:"
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: text4
+ x: 94
+ y: 150
+ width: 80
+ height: 20
+ text: "Bookmarks"
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: text5
+ x: 94
+ y: 177
+ width: 80
+ height: 20
+ text: "Dictionaries"
+ font.pixelSize: 12
+ }
+
+ MySpinBox {
+ id: myspinbox1
+ width: 40
+ height: 20;
+ x: 152
+ y: 9
+ }
+
+ MySpinBox {
+ id: myspinbox2
+ width: 40
+ height: 20;
+ x: 152
+ y: 81
+ }
+
+ Checkbox {
+ id: checkbox1
+ width: 20
+ x: 36
+ y: 157
+ }
+
+ Checkbox {
+ id: checkbox2
+ width: 20
+ x: 36
+ y: 177
+ }
+}