<file>button/up_enable.png</file>
<file>button/down_enable.png</file>
<file>button/revert.png</file>
+ <file>button/checkboxCheckedDis.png</file>
+ <file>button/checkboxDis.png</file>
+ <file>button/buttonCenterFocus.png</file>
+ <file>button/buttonLeftFocus.png</file>
+ <file>button/buttonRFocus.png</file>
</qresource>
</RCC>
roles[ContentRole] = "content";
roles[NumberRole] = "number";
setRoleNames(roles);
-
setContents(contents);
}
SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
- qDebug()<<"test1";
+
+ completerModel = new QStringList;
+ lineEditCompleter = new QCompleter(this);
+ lineEditCompleter->setModel(new QStringListModel(*completerModel));
+ lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+ lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
+
#ifndef Q_WS_MAEMO_5
this->setMaximumHeight(50);
busyTimer=new QTimer;
progressBar->hide();
view= new QDeclarativeView();
+ ctxt = view->rootContext();
+ ctxt->setContextProperty("focusss",true);
+
view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/SearchBarWidget.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
view->setAlignment(Qt::AlignCenter);
this, SIGNAL(historyPrev()));
connect(rootObject, SIGNAL(historyShowToolButtonClicked()),
this, SLOT(showHistoryButtonClicked()));
+ connect(rootObject, SIGNAL(textChange(QString)),
+ this, SLOT(textChange(QString)));
+ connect(rootObject, SIGNAL(nextCompleter()),
+ this, SLOT(nextCompleter()));
+ connect(rootObject, SIGNAL(prevCompleter()),
+ this, SLOT(prevCompleter()));
+ connect(rootObject, SIGNAL(checkFocus()),
+ this, SLOT(checkFocus()));
+ connect(rootObject, SIGNAL(nextFocus()),
+ this, SLOT(nextFocus()));
connect(this, SIGNAL(progresSetMax(QVariant)),
rootObject2, SLOT(setMax(QVariant)));
connect(this, SIGNAL(setLineEditEnables(QVariant)),
rootObject, SLOT(setEnableLineEdit(QVariant)));
+ connect(this, SIGNAL(setCompleterText(QVariant)),
+ rootObject, SLOT(setCompleterText(QVariant)));
+ connect(this, SIGNAL(focusOff()),
+ rootObject, SLOT(focusOff()));
+
connect(busyTimer, SIGNAL(timeout()),
this, SLOT(updateBusyTimer()));
emit setEnableHistoryShow(false);
emit setEnableHistoryPrev(false);
- completerModel = new QStringListModel(this);
connect(&delayTimer, SIGNAL(timeout()),
this, SLOT(delaySearchTimeout()));
- view->setFocus();
-
#else
initializeUI();
connect(searchPushButton, SIGNAL(clicked()),
connect(&delayTimer, SIGNAL(timeout()),
this, SLOT(delaySearchTimeout()));
-
searchWordLineEdit->setFocus();
#endif
-
+ setFocus();
busy = false;
setEnabled(true);
updateHistoryButtons(false,false,false);
}
+void SearchBarWidget::checkFocus(){
+ if(focusWidget()!=QApplication::focusWidget())
+ emit focusOff();
+}
+
+void SearchBarWidget::nextFocus(){
+ parentWidget()->nextInFocusChain()->setFocus();
+}
+
+void SearchBarWidget::textChange(QString text){
+ QLineEdit line;
+ QString toSend="";
+ QString tempString;
+ actualString=text;
+ completerActualList.clear();
+
+ line.setCompleter(lineEditCompleter);
+ line.completer()->setCompletionPrefix(text);
+ for (int i = 0; lineEditCompleter->setCurrentRow(i); i++)
+ completerActualList.append(lineEditCompleter->currentCompletion());
+
+ completerActualList.sort();
+ if(completerActualList.contains(preferedCompliter)){
+ tempString = preferedCompliter;
+ toSend = tempString.remove(0,text.size());
+ emit setCompleterText(toSend);
+ }
+ else if(completerActualList.size()>0 && text.size()>0){
+ toSend = completerActualList.at(0);
+ preferedCompliter= toSend;
+ toSend=toSend.remove(0,text.size());
+ if(toSend.size()>0)
+ emit setCompleterText(toSend);
+ else if(completerActualList.size()>1){
+ toSend = completerActualList.at(1);
+ preferedCompliter= toSend;
+ toSend=toSend.remove(0,text.size());
+ emit setCompleterText(toSend);
+ }
+ }
+ else{
+ preferedCompliter="";
+ emit setCompleterText(toSend);
+ }
+}
+
+void SearchBarWidget::prevCompleter(){
+ QString tempString;
+ if(!preferedCompliter.isEmpty()){
+ int index = completerActualList.indexOf(preferedCompliter);
+ if(index!=-1 && completerActualList.size()>index+1){
+ preferedCompliter = completerActualList.at(index+1);
+ tempString=preferedCompliter;
+ QString toSend = tempString.remove(0,actualString.size());
+ emit setCompleterText(toSend);
+ }
+ }
+}
+
+void SearchBarWidget::nextCompleter(){
+ QString tempString;
+ if(!preferedCompliter.isEmpty()){
+ int index = completerActualList.indexOf(preferedCompliter);
+ if(index>0){
+ preferedCompliter = completerActualList.at(index-1);
+ tempString=preferedCompliter;
+ QString toSend = tempString.remove(0,actualString.size());
+ emit setCompleterText(toSend);
+ }
+ }
+}
+
+
QIcon SearchBarWidget::generateIcon(QIcon original, qreal rotation) {
- qDebug()<<"test2";
QPixmap p = original.pixmap(64);
if(rotation != 0) {
}
void SearchBarWidget::setFocus() {
- qDebug()<<"test3";
#ifndef Q_WS_MAEMO_5
view->setFocus();
#else
}
void SearchBarWidget::initializeUI() {
- qDebug()<<"test4";
#ifdef Q_WS_MAEMO_5
setMaximumHeight(150);
searchWordLineEdit = new QLineEdit;
searchWordLineEdit->setMinimumWidth(250);
- completerModel = new QStringListModel(this);
-
- lineEditCompleter = new QCompleter(searchWordLineEdit);
- lineEditCompleter->setModel(completerModel);
- lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
- lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
searchWordLineEdit->setCompleter(lineEditCompleter);
#ifndef Q_WS_MAEMO_5
}
void SearchBarWidget::searchButtonClicked(QString text) {
- qDebug()<<"test5";
if(busy)
Q_EMIT stopSearching();
else
}
void SearchBarWidget::searchPushButtonClicked() {
- qDebug()<<"test6";
#ifdef Q_WS_MAEMO_5
if(busy) {
Q_EMIT stopSearching();
}
void SearchBarWidget::search(QString word) {
- qDebug()<<"test7";
- qDebug()<<word;
if(!busy && !word.isEmpty()) {
- completerModel->insertRow(completerModel->rowCount());
- QModelIndex index=completerModel->index(completerModel->rowCount() -1);
- completerModel->setData(index, word);
-
+ while(word.lastIndexOf(" ")==word.size()-1 && word.size()>0)
+ word=word.remove(word.size()-1,1);
+ if(!completerModel->contains(word))
+ completerModel->append(word);
+ QAbstractItemModel *temp=lineEditCompleter->model();
+ lineEditCompleter->setModel(new QStringListModel(*completerModel));
+ delete temp;
#ifndef Q_WS_MAEMO_5
emit setLineEditText(word);
#else
}
void SearchBarWidget::searchDelay(QString word) {
- qDebug()<<"test8";
if(!busy && !word.isEmpty()) {
#ifndef Q_WS_MAEMO_5
emit setLineEditText(word);
}
void SearchBarWidget::delaySearchTimeout() {
- qDebug()<<"test9";
delayTimer.stop();
if(!busy) {
Q_EMIT searchForTranslations(delayString);
}
void SearchBarWidget::setEnabled(bool enabled) {
- qDebug()<<"test10";
#ifndef Q_WS_MAEMO_5
emit setLineEditEnables(enabled);
if(!enabled) {
- qDebug()<<"tu???";
emit setEnableHistoryNext(false);
emit setEnableHistoryShow(false);
emit setEnableHistoryPrev(false);
historyShowToolButton->setEnabled(false);
}
#endif
-qDebug()<<"tu2???";
}
void SearchBarWidget::setBusy() {
- qDebug()<<"test11";
if(busy) return;
#ifndef Q_WS_MAEMO_5
}
void SearchBarWidget::updateBusyTimer(){
- qDebug()<<"test12";
if(progressMax==true){
emit progresSetValue2(0);
progressMax=false;
}
void SearchBarWidget::setIdle() {
- qDebug()<<"test13";
if(!busy) return;
#ifndef Q_WS_MAEMO_5
progressBar->hide();
void SearchBarWidget::clearSearchWordToolButtonClicked() {
- qDebug()<<"test14";
#ifdef Q_WS_MAEMO_5
searchWordLineEdit->clear();
#endif
void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
- qDebug()<<"test15";
if(!busy) {
#ifndef Q_WS_MAEMO_5
emit setEnableHistoryNext(next);
}
void SearchBarWidget::showHistoryButtonClicked() {
- qDebug()<<"test16";
#ifndef Q_WS_MAEMO_5
QPoint p=view->pos(); // = historyShowToolButton->pos();
p=mapToGlobal(p);
void progresSetMin(QVariant);
void progresSetValue(QVariant);
void progresSetValue2(QVariant);
+ void setCompleterText(QVariant);
+ void focusOff();
//! Requests to search for a list of words matching a word passed as
//! a parameter
void updateHistoryButtons(bool prev, bool next, bool list);
void setFocus();
+ void nextFocus();
+ void checkFocus();
private Q_SLOTS:
//! Clears search word line edit
//! shows history
void showHistoryButtonClicked();
+ void textChange(QString text);
+
+ void nextCompleter();
+
+ void prevCompleter();
+
private:
QDeclarativeView *progressBar;
QTimer *busyTimer;
bool progressMax;
+ QDeclarativeContext *ctxt;
+ QStringList* completerModel;
+ QCompleter* lineEditCompleter;
+ QString preferedCompliter;
+ QString actualString;
+ QStringList completerActualList;
QLineEdit* searchWordLineEdit;
- QCompleter* lineEditCompleter;
- QStringListModel* completerModel;
QToolButton* clearSearchWordToolButton;
QPushButton* searchPushButton;
QToolButton* historyPrevToolButton;
#ifndef Q_WS_MAEMO_5
void SettingsWidget::save() {
_save = true;
+ qDebug()<<"tuuu";
hide();
}
#endif
connect(this, SIGNAL(setUrl(QVariant)),
rootObject, SLOT(setUrl(QVariant)));
+ emit setUrl(QDir::homePath() + "/.mdictionary/" + "html.html");
+
#else
realParent = qobject_cast<TranslationWidget*>(parent);
connect(searchSelectedAction, SIGNAL(triggered()),
this, SIGNAL(search()));
- connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
+ connect(page(), SIGNAL(selectionChanged()),
+ this, SLOT(selection()));
#endif
}
anchors.horizontalCenterOffset: 0
onLinkActivated: linkClicked(link);
}
-
- /* MySpinBox {
- id: test01
- y:20;
- x:20;
- width: 40
- height: 20;
- }
- */
}
import Qt 4.7
-BorderImage {
+Rectangle {
id: button
property alias textInButton: buttonText.text
- signal clicked
- opacity: 1
+ property bool checkable: false
+ property bool checked: false
+
+ height: 20;
+ width: 60;
+
+ signal clicked;
+ signal changeCheck;
function setText(string) { textInButton = qsTr(string); }
- border { left: 10; top: 10; right: 10; bottom: 10 }
+ function press() { mouseArea.pressed }
+
+ Keys.onReturnPressed: {
+ button.clicked();
+ if(checkable){
+ button.checked=!button.checked;
+ button.changeCheck();
+ }
+ }
MouseArea {
id: mouseArea
height: parent.height;
onClicked: {
button.clicked();
+ if(checkable){
+ button.checked=!button.checked;
+ button.changeCheck();
+ }
}
}
Text {
z:1
id: buttonText
+ width: parent.width;
anchors.centerIn: parent;
+ horizontalAlignment: Text.AlignHCenter
font.pixelSize: parent.height * .5
+ elide: Text.ElideRight;
style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
}
Image {
id: image1
- width: (35*parent.height)/107 +1
+ width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1
height: parent.height
anchors.left: parent.left
source: "qrc:/button/buttonLeft.png"
anchors.left: image1.right
anchors.leftMargin: -1
source: "qrc:/button/buttonCenter.png"
- fillMode:Image.Stretch
+ //fillMode:Image.Stretch
+ fillMode: Image.TileHorizontally
+
}
Image {
id: image2
smooth: true
- width: (35*parent.height)/107 +1
+ width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1
height: parent.height
anchors.right: parent.right
source: "qrc:/button/buttonR.png"
states: [
State {
name: "pressed";
- when: (mouseArea.pressed == true && button.enabled == true);
+ when: ((button.enabled) && (mouseArea.pressed || (button.checkable && button.checked) ) )
PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
PropertyChanges { target: image1; source: "qrc:/button/buttonLeftDisabled.png" }
PropertyChanges { target: image3; source: "qrc:/button/buttonCenterDisabled.png" }
PropertyChanges { target: image2; source: "qrc:/button/buttonRightDisabled.png" }
+ },
+ State {
+ name: "focused";
+ when: (button.enabled && !mouseArea.pressed && button.focus)
+
+ PropertyChanges { target: image1; source: "qrc:/button/buttonLeftFocus.png" }
+ PropertyChanges { target: image3; source: "qrc:/button/buttonCenterFocus.png" }
+ PropertyChanges { target: image2; source: "qrc:/button/buttonRFocus.png" }
}
+
]
}
property bool selected
property string pathToCheckedImage: "qrc:/button/checkboxChecked.png"
property string pathToUncheckedImage: "qrc:/button/checkbox.png"
+ property string pathToCheckedDicImage: "qrc:/button/checkboxCheckedDis.png"
+ property string pathToUncheckedDicImage: "qrc:/button/checkboxDis.png"
signal changed
+
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Space)
+ selected=!selected
+ }
+
height: {
var aspectRatio = sourceSize.height / sourceSize.width
return checkbox.width * aspectRatio
smooth: true
states: [
State {
- name: "checked";
- when: (checkbox.selected == true);
+ name: "checkeEn";
+ when: (checkbox.selected && checkbox.enabled);
PropertyChanges { target: checkbox; source: pathToCheckedImage }
},
State {
- name: "unchecked";
- when: (checkbox.selected == false);
+ name: "uncheckeEn";
+ when: ( !checkbox.selected && checkbox.enabled);
PropertyChanges { target: checkbox; source: pathToUncheckedImage }
+ },
+ State {
+ name: "checkeDi";
+ when: (checkbox.selected && !checkbox.enabled);
+
+ PropertyChanges { target: checkbox; source: pathToCheckedDicImage }
+ },
+ State {
+ name: "uncheckeDi";
+ when: ( !checkbox.selected && !checkbox.enabled);
+
+ PropertyChanges { target: checkbox; source: pathToUncheckedDicImage }
}
]
MouseArea{
id: area
anchors.fill: parent
onClicked: {
- checkbox.selected = !checkbox.selected
- changed()
+ if(checkbox.enabled){
+ checkbox.selected = !checkbox.selected
+ changed()
+ }
}
}
+
+ Rectangle{
+ id: focusRectangle
+ color: "#000000"
+ border.color: "#000000"
+ opacity: 0;
+ radius: 1
+ anchors.centerIn: parent
+ z:1;
+ }
+
+ onFocusChanged: {
+ if(focus)
+ focusRectangle.opacity=0.5;
+ else
+ focusRectangle.opacity=0;
+ }
}
property int expandedHeight
property int basicHeight
property string startValue
- height: basicHeight
+ height: 20
+
+ property variant parentField : rectangle1
function show(Boolean){
expanded = Boolean
signal valueSelected(string selected);
+ /* Keys.onPressed: {
+ console.log("tu ----");
+ if (event.key == Qt.Key_Escape)
+ rectangle1.expanded=false;
+ else if (event.key == Qt.Key_Space)
+ rectangle1.expanded=true;
+ else if (event.key == Qt.Key_Return){
+ rectangle1.expanded=false;
+ console.log("tu enter "+list1.content);
+ }
+ }
+ */
+
Text {
id: text1
width: rectangle1.width-15
anchors.centerIn: parent
font.pixelSize: rectangle1.height * .5;
onTextChanged: { rectangle1.valueSelected(text) }
+ z: expanded?0:1;
}
Rectangle {
ElementsListView{
id: list1
- width: parent.width
visible: false
- z: 0
property string selected: rectangle1.startValue
function selectedValue(nr, value) {
rectangle1.show(false)
}
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- highlightResizeSpeed: 1000
+ anchors.rightMargin: 5
+ anchors.leftMargin: 5
+ anchors.bottomMargin: 10
+ anchors.topMargin: 10
+ anchors.fill: parent
+ highlightResizeSpeed: 1000
delegate: Component{
id: list1Delegate
Item {
id: contentText
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 5
+ elide: Text.ElideRight;
text: content
}
}
when: (rectangle1.expanded == true && rectangle1.disabled == false)
PropertyChanges { target: list1; z: 10; visible: true }
PropertyChanges { target: text1; z: 10; visible: false }
- PropertyChanges { target: rectangle1; border.width: 0}
+ PropertyChanges { target: rectangle1; border.width: 1}
PropertyChanges { target: rectangle1; height: rectangle1.expandedHeight}
PropertyChanges { target: imageDown; height: 0.5 * rectangle1.basicHeight}
PropertyChanges { target: shadeDisable; visible: false; z: -1}
+ PropertyChanges { target: rectangle1; anchors.fill: parentField}
},
State {
name: "disabled";
model: dictModel
}
- //buttons
Item {
id: buttonsBox
contentsScale: 1
pressGrabTime: 0
- Keys.onRightPressed: {
- console.log("test");
- }
-
function doZoom(zoom,centerX,centerY)
{
var tempX = flickable.width/2 - parent.x*zoom;
signal saveButtonClicked(string langFrom, string langTo);
+
+ id:rectangle1
height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
width: 200
+ color : myPalette.window;
- id:rectangle1
+ SystemPalette {
+ id: myPalette;
+ colorGroup:SystemPalette.Active
+ }
+
+ Item {
+ id: comboField
+ anchors.bottomMargin: 6
+ anchors.rightMargin: 0
+ anchors.left: fromLabel.right
+ anchors.right: revertButton.left
+ anchors.bottom: saveButton.top
+ anchors.top: parent.top
+ anchors.leftMargin: 2
+ z:2;
+ }
+
+ Text {
+ id: infoLabel
+ height: paintedHeight+5;
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.top: parent.top
+ wrapMode: Text.Wrap;
+ transformOrigin: Item.Left
+ font.pixelSize: 12
+ }
+
+
+ Text {
+ id: fromLabel
+ text: qsTr("From: ")
+ height: paintedHeight+5;
+ anchors.top: infoLabel.bottom
+ anchors.left: parent.left
+ wrapMode: Text.Wrap;
+ transformOrigin: Item.Left
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: toLabel
+ text: qsTr("To: ")
+ anchors.topMargin: 3
+ height: paintedHeight+5;
+ anchors.top: fromLabel.bottom
+ anchors.left: parent.left
+ wrapMode: Text.Wrap;
+ transformOrigin: Item.Left
+ font.pixelSize: 12
+ }
+
+ ComboBox{
+ id: comboFrom
+ model: comboBoxModel
+ anchors.right: revertButton.left
+ anchors.rightMargin: 5
+ anchors.left: fromLabel.right
+ anchors.leftMargin: 10
+ anchors.verticalCenter: fromLabel.verticalCenter
+
+ parentField: comboField
+ expanded: false
+ basicHeight: fromLabel.height
+ onExpandedChanged: {
+ if(expanded==true)
+ z=2;
+ else
+ z=0;
+ }
+ }
+
+ ComboBox{
+ id: comboTo
+ model: comboBoxModel
+ anchors.right: revertButton.left
+ anchors.rightMargin: 5
+ anchors.left: fromLabel.right
+ anchors.leftMargin: 10
+ anchors.verticalCenter: toLabel.verticalCenter
+
+ parentField: comboField;
+ expanded: false
+ basicHeight: fromLabel.height
+
+ onExpandedChanged: {
+ if(expanded==true)
+ z=2;
+ else
+ z=0;
+ }
+ }
+
+ IconButton{
+ id: revertButton
+ width: height
+ height: fromLabel.height
+ anchors.top: fromLabel.bottom
+ anchors.topMargin: -8
+ anchors.right: parent.right
+ pathToIcon: "qrc:/button/revert.png"
+ onClicked: { rectangle1.revertLang() }
+ }
+
+ Button {
+ id: saveButton
+ height: 30
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: parent.left
+ onClicked: {
+ rectangle1.saveButtonClicked(comboFrom.value, comboTo.value);
+ }
+ }
+
+ MouseArea {
+ id: mouse_area1
+ anchors.fill: parent
+ z:-1
+ onClicked: {
+ comboTo.expanded=false;
+ comboFrom.expanded=false;
+ }
+ }
+
+
+
+ states: [
+ State {
+ name: "new"
+ when: newPlugin==true
+ PropertyChanges { target: saveButton; textInButton: qsTr("Add") }
+ },
+ State {
+ name: "edit"
+ when: newPlugin==false
+ PropertyChanges { target: saveButton; textInButton: qsTr("Save settings") }
+ }
+ ]
+}
+
+
+/*
+Rectangle{
+ property bool newPlugin:false;
+
+ function setInfo(string){
+ infoLabel.text = string;
+ }
+ function setStartValues(startFrom, startTo, startFromIndex, startToIndex){
+ comboFrom.setStartValue(startFrom, startFromIndex)
+ comboTo.setStartValue(startTo, startToIndex)
+ }
+ function revertLang(){
+ var tmpidx = comboFrom.index
+ comboFrom.index = comboTo.index
+ comboTo.index = tmpidx
+ var tmpval = comboFrom.value
+ comboFrom.value = comboTo.value
+ comboTo.value = tmpval
+ }
+ function setNew(bool){
+ newPlugin=bool;
+ }
+
+ signal saveButtonClicked(string langFrom, string langTo);
+
+
+ id:rectangle1
+ height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
+ width: 200
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
color : myPalette.window;
}
ComboBox{
+ //parentField: rectangle1
+
id: comboFrom
model: comboBoxModel
anchors.left: parent.left
}
ComboBox{
+ //parentField: rectangle1;
id: comboTo
model: comboBoxModel
anchors.left: parent.left
}
]
}
+*/
id: rectangle
property alias pathToIcon: image.source;
- property int iconWidth:rectangle.width;
- property int iconHeight:rectangle.height;
+ property int iconWidth:rectangle.width-8;
+ property int iconHeight:rectangle.height-8;
signal clicked;
+ function press() { mouseArea.pressed }
+
radius: 50
MouseArea {
Image {
id: image1
- z: 1
smooth: true
- width: (35*parent.height)/107 +1
+ width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1 //(35*parent.height)/107 +1
height: parent.height
anchors.left: parent.left
source: "qrc:/button/buttonLeft.png"
+ fillMode:Image.Stretch
}
Image {
id: image3
- z: 1
smooth: true
height: parent.height
anchors.right: image2.left
anchors.left: image1.right
anchors.leftMargin: -1
source: "qrc:/button/buttonCenter.png"
+ fillMode:Image.Stretch
+ //fillMode: Image.TileHorizontally
}
Image {
id: image2
- z: 1
smooth: true
- width: (35*parent.height)/107 +1
+ width: (image1.sourceSize.width*parent.height)/image1.sourceSize.height +1//(35*parent.height)/107 +1
height: parent.height
anchors.right: parent.right
source: "qrc:/button/buttonR.png"
+ fillMode:Image.Stretch
}
PropertyChanges { target: image1; source: "qrc:/button/buttonLeftPushed.png" }
PropertyChanges { target: image3; source: "qrc:/button/buttonCenterPushed.png" }
PropertyChanges { target: image2; source: "qrc:/button/buttonRightPushed.png" }
+ },
+ State {
+ name: "focused";
+ when: (rectangle.enabled && !mouseArea.pressed && rectangle.focus)
+
+ PropertyChanges { target: image1; source: "qrc:/button/buttonLeftFocus.png" }
+ PropertyChanges { target: image3; source: "qrc:/button/buttonCenterFocus.png" }
+ PropertyChanges { target: image2; source: "qrc:/button/buttonRFocus.png" }
}
]
}
property int maxValue:500;
property int minValue:0;
property alias value:text_input1.text
+ property bool isTextInMinValue:true;
+ property string textInMinValue:"inf";
+ property int singleStep: 2;
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(isTextInMinValue && textInMinValue==string)
+ value=minValue;
+ else
+ 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 value;
}
+ function setFocus(){
+ text_input1.focus=true;
+ }
+
TextInput {
id: text_input1
x: 1
selectByMouse: true;
font.pixelSize: rectangle1.height * .5;
onCursorPositionChanged: moveCursorSelection(cursorPosition);
- onTextChanged: rectangle1.valueChange(stringToInt(text_input1.text));
+ onTextChanged:{
+ if(isTextInMinValue && text_input1.text!="" && stringToInt(text_input1.text)==minValue)
+ text_input1.text=textInMinValue;
+
+ rectangle1.valueChange(stringToInt(text_input1.text));
+ }
onFocusChanged: {
if(focus==false)
text=stringToInt(text);
}
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Up)
+ text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
+ else if (event.key == Qt.Key_Down){
+ text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+ if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+ text_input1.text=textInMinValue
+ }
+ }
}
Timer {
repeat: true
onTriggered:{
if(mouseAreaUp.pressedButtons==Qt.LeftButton)
- text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+ text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
else
running=false;
}
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);
+ if(mouseAreaDown.pressedButtons==Qt.LeftButton){
+ text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+ if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+ text_input1.text=textInMinValue
+ }
else
running=false;
}
height: rectangle1.height/2;
anchors.right: parent.right
anchors.top: parent.top
- onClicked: text_input1.text=((stringToInt(text_input1.text)+1)>maxValue)?(maxValue):(stringToInt(text_input1.text)+1);
+ onClicked: text_input1.text=((stringToInt(text_input1.text)+singleStep)>maxValue)?(maxValue):(stringToInt(text_input1.text)+singleStep);
onPressAndHold:{
timerUp.restart;
timerUp.running=true;
height: rectangle1.height/2;
anchors.right: parent.right
anchors.bottom: parent.bottom
- onClicked: text_input1.text=((stringToInt(text_input1.text)-1)<minValue)?(minValue):(stringToInt(text_input1.text)-1);
+ onClicked:{
+ text_input1.text=((stringToInt(text_input1.text)-singleStep)<minValue)?(minValue):(stringToInt(text_input1.text)-singleStep);
+ if(isTextInMinValue && stringToInt(text_input1.text)==minValue)
+ text_input1.text=textInMinValue
+ }
onPressAndHold:{
timerDown.restart;
timerDown.running=true;
}
}
-
- /* states: [
+ states: [
State {
- name: "DisableState"; when: rectangle1.enabled==false;
- PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
+ name: "focusState"; when: text_input1.focus && rectangle1.enabled;
+ PropertyChanges { target: rectangle1; border.width: 2 }
}
]
- */
}
radius: 10
border.color: "#000666";
property alias textInLineEdit:text_input1.text
+ property bool useCompleter:false
signal enterPressed(string text);
+ signal textChange(string text);
+
+ signal nextCompleter();
+ signal prevCompleter();
+
+ signal isFocused();
+ signal checkFocus();
function setText(string) { textInLineEdit = string; }
+ function setCompleter(string) { completerItemText.text=string; }
+ function hideCompleter() { completerItem.visible=false; }
+
+ function addOneChar(){
+ if(completerItemText.text.length>0)
+ text_input1.text=text_input1.text+completerItemText.text.charAt(0);
+ }
+
+ function addAllChars(){
+ text_input1.text=text_input1.text+completerItemText.text;
+ completerItemText.text="";
+ }
+
+ function setFocus(){
+ if(rectangle1.enabled){
+ text_input1.focus=true;
+ isFocused();
+ }
+ }
TextInput {
id: text_input1
anchors.centerIn: parent
selectByMouse: true;
font.pixelSize: rectangle1.height * .5;
- onCursorPositionChanged: moveCursorSelection(cursorPosition);
- focus: rectangle1.focus;
+ onCursorPositionChanged: {
+ moveCursorSelection(cursorPosition);
+ if(cursorPosition==text.length && useCompleter)
+ completerItem.visible=true;
+ else
+ completerItem.visible=false;
+ }
+ Keys.priority : Keys.AfterItem
Keys.onPressed: {
- if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
+ if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)){
rectangle1.enterPressed(text_input1.text)
+ completerItem.visible=false;
+ }
+ if(useCompleter){
+ if (event.key == Qt.Key_Up)
+ rectangle1.nextCompleter();
+ if (event.key == Qt.Key_Down)
+ rectangle1.prevCompleter();
+ if ((event.key == Qt.Key_Right) && (cursorPosition==text.length))
+ addOneChar();
+ if(Qt.ControlModifier){
+ if (event.key == Qt.Key_Space){
+ if(completerItem.visible=false)
+ completerItem.visible=true
+ else
+ addAllChars()
+ }
+ }
+ if(event.key == Qt.Key_Escape)
+ completerItem.visible=false;
+ }
+ }
+ onTextChanged: rectangle1.textChange(text);
+ onFocusChanged: if(focus) isFocused();
+ onActiveFocusChanged: rectangle1.checkFocus();
+ }
+
+
+ Rectangle {
+ id: completerItem
+ x: text_input1.x + text_input1.positionToRectangle(text_input1.cursorPosition).x +1
+ y: text_input1.y
+ width: completerItemText.paintedWidth;
+ visible: false;
+ height: text_input1.height
+ color: (completerItemText.text.length>0)?"#5e71fb":"#FFFFFF"
+ opacity: 0.5
+ Text {
+ id: completerItemText
+ anchors.fill: parent
+ text:""
+ font.pixelSize: text_input1.font.pixelSize;
}
}
states: [
State {
- name: "FokusState"; when: text_input1.focus==true && rectangle1.enabled==true;
+ name: "FokusState"; when: text_input1.focus && rectangle1.enabled;
PropertyChanges {
target: rectangle1
border.width: 3
}
},
State {
- name: "DisableState"; when: rectangle1.enabled==false;
+ name: "DisableState"; when: !rectangle1.enabled;
PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
}
]
Behavior on position {
SequentialAnimation{
+ id: infinite_animaction;
loops: (value>-1)?0:Animation.Infinite
SmoothedAnimation { velocity:450 ; to: progressBar.width - 96}
SmoothedAnimation { velocity: 450 ; to: 6 }
color : myPalette.window;
property alias enableLineEdit: inputSearchText.enabled;
+ property int focusIndex:-1;
+
function setButtonText(string) { searchButton.setText(string) }
function setEnableHistoryPrev(Boolean) { historyPrevToolButton.enabled = Boolean }
function setEnableHistoryNext(Boolean) { historyNextToolButton.enabled = Boolean }
function setEnableHistoryShow(Boolean) { historyShowToolButton.enabled = Boolean }
function setEnableLineEdit(Boolean) { enableLineEdit = Boolean }
- function setLineEditText(string) { inputSearchText.setText(string) }
function clear() { inputSearchText.setText("") }
+ function setLineEditText(string) { inputSearchText.setText(string) }
+ function setCompleterText(string) { inputSearchText.setCompleter(string) }
+
+ function setFocus(){
+ if(focusIndex==0){
+ inputSearchText.setFocus();
+ if(!inputSearchText.enabled)
+ focusIndex++;
+ }
+ if(focusIndex==1)
+ clearButton.focus=true;
+
+ if(focusIndex==2){
+ searchButton.focus = true
+ if(!searchButton.enabled)
+ focusIndex++;
+ }
+
+ if(focusIndex==3){
+ historyPrevToolButton.focus = true
+ if(!historyPrevToolButton.enabled)
+ focusIndex++;
+ }
+
+ if(focusIndex==4){
+ historyShowToolButton.focus = true
+ if(!historyShowToolButton.enabled)
+ focusIndex++;
+ }
+
+ if(focusIndex==5){
+ historyNextToolButton.focus = true
+ if(!historyNextToolButton.enabled)
+ focusIndex++;
+ }
+
+ if (focusIndex>5){
+ nextFocus();
+ focusIndex=-1;
+ focus=true;
+ }
+ }
+
+ function focusOff(){ focus=true; focusIndex=-1;}
+
+ signal nextFocus();
+ signal checkFocus();
signal searchButtonClicked(string text);
signal historyNextToolButtonClicked;
signal historyShowToolButtonClicked;
signal historyPrevToolButtonClicked;
+ signal textChange(string text);
+ signal nextCompleter();
+ signal prevCompleter();
+
+ Keys.onTabPressed: {
+ focusIndex++;
+ setFocus();
+ }
MyTextLineEdit{
id: inputSearchText
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
onEnterPressed: searchBarWidget.searchButtonClicked(text);
- focus: searchBarWidget.focus
+ useCompleter: true;
IconButton {
id: clearButton;
width: inputSearchText.height-6;
enabled: true;
pathToIcon: "qrc:/button/go-clear.png";
onClicked: clear();
+ onActiveFocusChanged:searchBarWidget.checkFocus();
}
+ onTextChange: searchBarWidget.textChange(text)
+ onNextCompleter: searchBarWidget.nextCompleter();
+ onPrevCompleter: searchBarWidget.prevCompleter();
+ onIsFocused: searchBarWidget.focusIndex=0;
+ onCheckFocus: searchBarWidget.checkFocus();
}
Item {
anchors.right: historyPrevToolButton.left
anchors.verticalCenter: parent.verticalCenter
textInButton: qsTr("Search")
- onClicked: searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
+ onClicked:{
+ searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
+ inputSearchText.hideCompleter();
+ }
+ onActiveFocusChanged:searchBarWidget.checkFocus();
}
IconButton {
enabled: true;
pathToIcon: "qrc:/button/go-next.png";
onClicked: searchBarWidget.historyNextToolButtonClicked();
+ onActiveFocusChanged:searchBarWidget.checkFocus();
}
IconButton {
enabled: true;
pathToIcon: "qrc:/button/go-show.png";
onClicked: searchBarWidget.historyShowToolButtonClicked();
+ onActiveFocusChanged:searchBarWidget.checkFocus();
}
IconButton {
enabled: true;
pathToIcon: "qrc:/button/go-previous.png";
onClicked: searchBarWidget.historyPrevToolButtonClicked();
+ onActiveFocusChanged:searchBarWidget.checkFocus();
}
}
}
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
color : myPalette.window;
+ focus: true;
+ property int focusIndex:-1;
+
signal historySizeValueChanged(int intiger);
signal searchResulValueChanged(int intiger);
function setCheckedDictionaries(bool){
dictionariesCheckBox.selected=bool;
}
+ function setFocus(){
+ if(focusIndex==0){
+ searchSpinbox.setFocus();
+ if(!searchSpinbox.enabled)
+ focusIndex++;
+ }
+ if(focusIndex==1){
+ historySpinbox.setFocus();
+ if(!historySpinbox.enabled)
+ focusIndex++;
+ }
+ if(focusIndex==2){
+ bookmarkCheckBox.focus = true
+ if(!bookmarkCheckBox.enabled)
+ focusIndex++;
+ }
+ if(focusIndex==3){
+ dictionariesCheckBox.focus = true
+ if(!dictionariesCheckBox.enabled)
+ focusIndex++;
+ }
+ if(focusIndex==4){
+ saveButton.focus = true
+ if(!saveButton.enabled)
+ focusIndex++;
+ }
+ if(focusIndex>4){
+ focusIndex=-1;
+ focus=true;
+ }
+ }
+
+ Keys.onTabPressed: {
+ focusIndex++;
+ setFocus();
+ }
Text {
id: textSearch
anchors.left: textSearch.right
anchors.leftMargin: 20
onValueChange: rectangle1.searchResulValueChanged(intiger);
+ onFocusChanged: if(focus) focusIndex=0;
}
MySpinBox {
anchors.top: searchSpinbox.bottom
anchors.topMargin: 10
onValueChange: rectangle1.historySizeValueChanged(intiger);
+ onFocusChanged: if(focus) focusIndex=1;
}
Checkbox {
anchors.top: textSearchIn.bottom
anchors.topMargin: 0
onChanged: rectangle1.bookmarksCheckBoxChanged(selected);
+ onFocusChanged: if(focus) focusIndex=2;
}
Checkbox {
anchors.top: bookmarkCheckBox.bottom
anchors.topMargin: 3
onChanged: rectangle1.dictionariesCheckBoxChanged(selected);
+ onFocusChanged: if(focus) focusIndex=3;
}
Button {
anchors.rightMargin: 5
textInButton: qsTr("Save")
onClicked: rectangle1.saveButtonClicked();
+ onFocusChanged: if(focus) focusIndex=4;
}
}
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
color : myPalette.window;
-
Text {
id: textInfo
text: "Tekst: "
anchors.fill: parent
signal dictLink(string link);
+ signal fromChange(string value);
+ signal toChange(string value)
- ScrollBar2 {
- id: horizontalScrollBar1
- z:2;
- width: parent.width-12;
- windowHeight: parent.height
- anchors.left: parent.left
- orientation: Qt.Horizontal
- position: 100
+
+ function setFromStartValues(startFrom, startTo, startFromIndex, startToIndex){
+ comboFrom.setStartValue(startFrom, startFromIndex)
+ comboTo.setStartValue(startTo, startToIndex)
+ }
+
+ function setToStartValues(startFrom, startTo, startFromIndex, startToIndex){
+ comboFrom.setStartValue(startFrom, startFromIndex)
+ comboTo.setStartValue(startTo, startToIndex)
}
- ScrollBar2 {
- id: horizontalScrollBar2
- z:2;
- width: parent.width-12;
- windowHeight: parent.height
- anchors.left: horizontalScrollBar1.left
- anchors.leftMargin: horizontalScrollBar1.position
- orientation: Qt.Horizontal
- position: 100
+
+ MouseArea {
+ id: mouse_area1
+ anchors.fill: parent
+ z:-1
+ onClicked: {
+ comboTo.expanded=false;
+ comboFrom.expanded=false;
+ }
}
- ScrollBar2 {
- id: horizontalScrollBar3
- z:2;
- width: parent.width-12;
- windowHeight: parent.height
- anchors.left: horizontalScrollBar2.left
- anchors.leftMargin: horizontalScrollBar2.position
- orientation: Qt.Horizontal
- position: 100
+
+ ComboBox {
+ id: comboFrom
+ model: fromModell
+ anchors.right: comboFromField.right
+ anchors.left: comboFromField.left
+ parentField: comboFromField
+ expanded: false
+ height: 20
+ basicHeight:20
+ index: 1
+ onExpandedChanged: {
+ if(expanded==true){
+ z=2;
+ mouse_area1.z=1;
+ }
+ else{
+ z=0;
+ mouse_area1.z=-1;
+ }
+ }
+ onValueSelected: rectangle1.fromChange(value)
}
- ElementsListView{
- id: dictList
- width: rectangle1.width
+ ComboBox {
+ id: comboTo
+ model: fromModell
+ anchors.right: comboToField.right
+ anchors.left: comboToField.left
+ parentField: comboToField
+ expanded: false
+ height: 20
+ basicHeight:20
+ index: 1
+ onExpandedChanged: {
+ if(expanded==true){
+ z=2;
+ mouse_area1.z=1;
+ }
+ else{
+ z=0;
+ mouse_area1.z=-1;
+ }
+ }
+ onValueSelected: rectangle1.toChange(value)
+ }
+
+ Item {
+ id: comboFromField
+ width: 120
+ anchors.left: fromLabel.right
+ anchors.leftMargin: 5
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 10
anchors.top: parent.top
+ }
+
+ Item {
+ id: comboToField
+ width: 120
+ anchors.left: toLabel.right
+ anchors.leftMargin: 5
anchors.bottom: parent.bottom
- highlightResizeSpeed: 1000
-
- header: Component{
- id: dictListHeader
- Item {
- width: rectangle1.width
- height: 20
- Row {
- anchors.fill: parent
- Rectangle {
- id: fromRecHeader
- width: horizontalScrollBar1.position
- height: parent.height
- radius: 1
- gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+ anchors.bottomMargin: 10
+ anchors.top: parent.top
+ }
- Text {
- id: fromTextHeader
- text: qsTr("From");
- elide: Text.ElideRight
- font.pixelSize: 12
- anchors.centerIn: parent
+ Text {
+ id: fromLabel
+ text: qsTr("From: ");
+ anchors.top: parent.top
+ anchors.topMargin: 3
+ font.pixelSize: 12
+ }
+
+ Text {
+ id: toLabel
+ text: qsTr("To: ");
+ anchors.left: comboFrom.right
+ anchors.leftMargin: 15
+ anchors.verticalCenterOffset: 0
+ anchors.verticalCenter: fromLabel.verticalCenter
+ font.pixelSize: 12
+ }
+
+ Item {
+ id: item1
+ anchors.topMargin: 30
+ anchors.fill: parent
+ ScrollBar2 {
+ id: horizontalScrollBar1
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: parent.left
+ orientation: Qt.Horizontal
+ position: 100
+ }
+ ScrollBar2 {
+ id: horizontalScrollBar2
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: horizontalScrollBar1.left
+ anchors.leftMargin: horizontalScrollBar1.position
+ orientation: Qt.Horizontal
+ position: 100
+ }
+ ScrollBar2 {
+ id: horizontalScrollBar3
+ z:2;
+ width: parent.width-12;
+ windowHeight: parent.height
+ anchors.left: horizontalScrollBar2.left
+ anchors.leftMargin: horizontalScrollBar2.position
+ orientation: Qt.Horizontal
+ position: 100
+ }
+
+ ElementsListView{
+ id: dictList
+ width: rectangle1.width
+ anchors.topMargin: 0
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ highlightResizeSpeed: 1000
+
+ header: Component{
+ id: dictListHeader
+ Item {
+ width: rectangle1.width
+ height: 20
+ Row {
+ anchors.fill: parent
+ Rectangle {
+ id: fromRecHeader
+ width: horizontalScrollBar1.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+
+ Text {
+ id: fromTextHeader
+ text: qsTr("From");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
}
- }
- Rectangle {
- id: toRecHeader
- width: horizontalScrollBar2.position
- height: parent.height
- radius: 1
- gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+ Rectangle {
+ id: toRecHeader
+ width: horizontalScrollBar2.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
- Text {
- id: toTextHeader
- text: qsTr("To");
- elide: Text.ElideRight
- font.pixelSize: 12
- anchors.centerIn: parent
+ Text {
+ id: toTextHeader
+ text: qsTr("To");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
}
- }
- Rectangle {
- id: nameRecHeader
- width: horizontalScrollBar3.position
- height: parent.height
- radius: 1
- gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+ Rectangle {
+ id: nameRecHeader
+ width: horizontalScrollBar3.position
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
- Text {
- id: nameTextHeader
- text: qsTr("Title");
- elide: Text.ElideRight
- font.pixelSize: 12
- anchors.centerIn: parent
+ Text {
+ id: nameTextHeader
+ text: qsTr("Title");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
}
- }
- Rectangle {
- id: sizeRecHeader
- width: 100;
- height: parent.height
- radius: 1
- gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
+ Rectangle {
+ id: sizeRecHeader
+ width: 100;
+ height: parent.height
+ radius: 1
+ gradient: Gradient { GradientStop { position: 0.3; color: "#a0cbec" } GradientStop { position: 0.99; color: "#35a0f1" } }
- Text {
- id: sizeTextHeader
- text: qsTr("Size");
- elide: Text.ElideRight
- font.pixelSize: 12
- anchors.centerIn: parent
+ Text {
+ id: sizeTextHeader
+ text: qsTr("Size");
+ elide: Text.ElideRight
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
}
}
}
}
- }
- delegate: Component{
- id: dictListDelegate
- Item {
- width: rectangle1.width
- height:nameText.height
- MouseArea{
- anchors.fill: parent
- onClicked: {
- dictList.currentIndex = index
- }
- onDoubleClicked: {
- rectangle1.dictLink(link)
- }
- }
- Row {
- anchors.fill: parent
- Text {
- id: fromText
- text: " "+from+" ";
- width: horizontalScrollBar1.position
- elide: Text.ElideRight
+ delegate: Component{
+ id: dictListDelegate
+ Item {
+ width: rectangle1.width
+ height:nameText.height
+ MouseArea{
+ anchors.fill: parent
+ onClicked: {
+ dictList.currentIndex = index
+ }
+ onDoubleClicked: {
+ rectangle1.dictLink(link)
+ }
}
+ Row {
+ anchors.fill: parent
+ Text {
+ id: fromText
+ text: " "+from+" ";
+ width: horizontalScrollBar1.position
+ elide: Text.ElideRight
+ }
- Text {
- id: toText
- text: " "+to+" ";
- width: horizontalScrollBar2.position
- elide: Text.ElideRight
- }
+ Text {
+ id: toText
+ text: " "+to+" ";
+ width: horizontalScrollBar2.position
+ elide: Text.ElideRight
+ }
- Text {
- id: nameText
- text: " "+name+" ";
- width: horizontalScrollBar3.position
- elide: Text.ElideRight
- }
- Text {
- id: sizeText
- text: " "+size+" ";
- width: 100
- elide: Text.ElideRight
+ Text {
+ id: nameText
+ text: " "+name+" ";
+ width: horizontalScrollBar3.position
+ elide: Text.ElideRight
+ }
+ Text {
+ id: sizeText
+ text: " "+size+" ";
+ width: 100
+ elide: Text.ElideRight
+ }
}
}
}
+ model: dictModel
}
- model: dictModel
}
}
id: webView
width:parent.width
height:parent.height
+ url:"file:///home/jakub/test.html";
anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom }
}
import Qt 4.7
Rectangle {
+ id: rectangle1
+ color: myPalette.base
+ anchors.fill: parent
function changeWordState(nr, state) {
console.log("LOOOOOL")
}
signal wordSelected(string word);
+ signal checkFocus();
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
- id: rectangle1
- color: myPalette.base
- anchors.fill: parent
-
ElementsListView{
id: wordList
width: rectangle1.width
delegate: Component{
id: wordListDelegate
Item {
+ onActiveFocusChanged: rectangle1.checkFocus();
+
width: rectangle1.width
height: {
if (wordText.height + 4 > check.height)
else
return check.height;
}
-
MouseArea{
anchors.fill: parent
- onClicked: {
- wordList.currentIndex = index// number
+ onClicked: wordList.currentIndex = index
+ onDoubleClicked: {
+ wordList.currentIndex = number
rectangle1.wordSelected(word)
}
}
pathToUncheckedImage: UncheckedPath
anchors.right: parent.right
anchors.rightMargin: 5
-
+ pathToCheckedDicImage: CheckedPath
+ pathToUncheckedDicImage: UncheckedPath
anchors.verticalCenter: parent.verticalCenter
onChanged: rectangle1.changeWordState(number, selected)
}
-
}
-
}
Text {
}
]
}
+
+ states: [
+ State {
+ name: "noFocus";
+ when: ((!wordList.focus) && (!rectangle1.focus))
+ PropertyChanges { target: wordList.highlightItem; opacity:0}
+ }
+ ]
}
Text {
id: textInfo
width: rectangle1.width
- height: paintedHeight+5;
+ height: (paintedHeight+5)>150?150:paintedHeight+5;
text: ": "
wrapMode: Text.Wrap;
anchors.top: textDescription.bottom
font.pixelSize: 12
}
+
+ Rectangle {
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.bottom: saveButton.bottom
+ anchors.top: optimalizeCheckbox.top
+
+ id: rectangle2
+ color: myPalette.window
+ anchors.topMargin: -2
+ }
+
Checkbox {
id: optimalizeCheckbox
width: 20
height: 20
+ anchors.bottom: stripCheckbox.top
+ anchors.bottomMargin: 5
anchors.left: parent.left
anchors.leftMargin: 5
- anchors.top: textInfo.bottom
onChanged: rectangle1.optimalizeCheckboxChanged(selected);
}
id: stripCheckbox
width: 20
height: 20
- anchors.top: optimalizeCheckbox.bottom
- anchors.topMargin: 5
+ anchors.bottom: saveButton.top
+ anchors.bottomMargin: 15
anchors.horizontalCenter: optimalizeCheckbox.horizontalCenter
onChanged: rectangle1.stripCheckboxChanged(selected);
}
Button {
id: saveButton
height: 30
+ anchors.bottom: parent.bottom
textInButton: qsTr("Save")
- anchors.top: stripCheckbox.bottom
- anchors.topMargin: 10
anchors.right: parent.right
anchors.left: parent.left
onClicked: rectangle1.saveButtonClicked();
onClicked: rectangle1.downloadButtonClicked();
}
+
states: [
State {
name: "Stan1"
XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
QDialog(parent) {
-qDebug()<<"etap 01";
#ifndef Q_WS_MAEMO_5
view= new QDeclarativeView();
view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/XdxfDictDownloader.qml"));
void XdxfDictDownloadProgressDialog::show() {
-qDebug()<<"etap 02";
#ifndef Q_WS_MAEMO_5
emit setMaximumValue(0);
maximumValue=0;
void XdxfDictDownloadProgressDialog::setText(QString text) {
-qDebug()<<"etap 03";
-
#ifndef Q_WS_MAEMO_5
emit setTextt(text);
#else
void XdxfDictDownloadProgressDialog::updateProgress(float progress) {
-qDebug()<<"etap 04";
#ifndef Q_WS_MAEMO_5
if(maximumValue == 0) {
emit setMaximumValue(100);
void XdxfDictDownloadProgressDialog::reject() {
-qDebug()<<"etap 05";
+ qDebug("tu");
#ifndef Q_WS_MAEMO_5
- Q_EMIT cancelDownloading();
+ emit cancelDownloading();
+ emit setValue(-1);
#else
return;
#endif
this, SLOT(breakDownloading()));
connect(this, SIGNAL(downloadProgress(float)),
progressDialog, SLOT(updateProgress(float)));
-
- qDebug()<<"etam 3.1";
progressDialog->setText(tr("Downloading dictionaries list"));
progressDialog->show();
}
//if user cancel downloading we kill all running processes, hide progress dialog and set flag that user cancel downloading.
aborted = true;
http.kill();
-
if(progressDialog && progressDialog->isVisible()) {
progressDialog->accept();
}
QWidget *parent) :
QDialog(parent) {
-
setWindowTitle(tr("Select dictionary"));
-
//here removing already added dictionary
for (int i = 0; i < dicts.size(); i++){
if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
#ifndef Q_WS_MAEMO_5
model2 = new DictsListModel(dicts, this);
proxyModel2 = new DictsProxyListModel;
- proxyModel2->setSourceModel(model2);
- proxyModel2->setTo("Polish");
+ proxyModel2->setSourceModel(model2);;
view= new QDeclarativeView();
QDeclarativeContext* ctxt=view->rootContext();
ctxt->setContextProperty("dictModel", proxyModel2);
+
+ QSet<QString> languagesFrom;
+ for(int i=0; i < model2->rowCount(QModelIndex()); i++)
+ languagesFrom.insert(model2->data(model2->index(i, 0),DictsListModel::FromRole).toString());
+ languagesFrom.remove(QString());
+ QStringList langFromList = languagesFrom.toList();
+ qSort(langFromList);
+ QList<QString> langListFrom;
+ langListFrom.append(tr("Any"));
+ foreach(QString lang,langFromList)
+ langListFrom.append(lang);
+ fromModel = new ComboBoxModel(langListFrom);
+ ctxt->setContextProperty("fromModell", fromModel);
+
+ QSet<QString> languagesTo;
+ for(int i=0; i < model2->rowCount(QModelIndex()); i++)
+ languagesTo.insert(model2->data(model2->index(i, 0),DictsListModel::ToRole).toString());
+ languagesTo.remove(QString());
+ QStringList langToList = languagesTo.toList();
+ qSort(langToList);
+ QList<QString> langListTo;
+ langListTo.append(tr("Any"));
+ foreach(QString lang,langToList)
+ langListTo.append(lang);
+ toModel = new ComboBoxModel(langListTo);
+ ctxt->setContextProperty("toModell", toModel);
+
view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/TableWidget.qml"));
view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
view->setAlignment(Qt::AlignCenter);
mainLayout = new QVBoxLayout;
mainLayout->addWidget(view);
this->setLayout(mainLayout);
- proxyModel2->setTo("English");
QGraphicsObject *rootObject = view->rootObject();
connect(rootObject,SIGNAL(dictLink(QString)),
this,SLOT(itemClicked(QString)));
+ connect(rootObject,SIGNAL(fromChange(QString)),
+ this,SLOT(fromChange(QString)));
+ connect(rootObject,SIGNAL(toChange(QString)),
+ this,SLOT(toChange(QString)));
+
#else
layout = new QVBoxLayout;
#endif
}
+void XdxfDictSelectDialog::toChange(QString lang){
+ if(lang!=tr("Any"))
+ proxyModel2->setTo(lang);
+ else
+ proxyModel2->setTo("");
+}
+
+void XdxfDictSelectDialog::fromChange(QString lang){
+ if(lang!=tr("Any"))
+ proxyModel2->setFrom(lang);
+ else
+ proxyModel2->setFrom("");
+}
void XdxfDictSelectDialog::initializeDicts() {
//scan of all languages of dictionaries, using QSet to get only distinct languages
}
void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
-#ifdef Q_WS_MAEMO_5
+#ifndef Q_WS_MAEMO_5
+ index;
+#else
_link = index.model()->data(index, Qt::UserRole).toString();
accept();
#endif
#include <QDir>
#include <QDeclarativeView>
#include <QDeclarativeContext>
+#include <QList>
#include "DownloadDict.h"
#include "DictsListModel.h"
#include "DictsModel.h"
#include "DictsProxyModel.h"
#include "DictsProxyListModel.h"
+#include "../../include/ComboBoxModel.h"
/*!
void itemClicked(QString link);
+ void toChange(QString lang);
+ void fromChange(QString lang);
+
private:
QVBoxLayout* mainLayout;
QDeclarativeView *view;
DictsListModel* model2;
DictsProxyListModel *proxyModel2;
+ ComboBoxModel *fromModel;
+ ComboBoxModel *toModel;
QTreeView* treeView;
DictsModel* model;
XdxfDictDownloadProgressDialog.cpp \
DictsModel.cpp \
HttpDownloader.cpp \
- DictsListModel.cpp
+ DictsListModel.cpp \
+ ../../include/ComboBoxModel.cpp
HEADERS += xdxfplugin.h \
TranslationXdxf.h \
../../include/translation.h \
../../include/settings.h \
../../include/CommonDictInterface.h \
+ ../../include/ComboBoxModel.h \
XdxfCachingDialog.h \
XdxfDialog.h \
XdxfDictDownloader.h \
<div id="webContainer">
<div id="topBar">
<img src="images/mLogo_ie24.png" style="float:left;"></img>
- <!-- <div class="installs">
+<!-- <div class="installs">
INSTALL:
<a href="files/mdictionary.install"
class="install" style="margin-top:4px;"
</div>
</div>
<div id="contentContainer">
-
-
<h1>Developer's HOWTO:<br />making Your own plugin</h1>
The manual is available <a href="files/doc-plugin.1.0.4.odt">here</a>
<div class="code">dbus_data = ws_dbus_create ("mDictionaryGui", "v1.0");</div>
<p>
-Then You configure the remote and local addresses, by using <span class="code">ws_dbus_config</span>. The settings should be the same as in the example, below:
</p>
<div class="code">ws_dbus_config( dbus_data,
<div id="webContainer">
<div id="topBar">
<img src="images/mLogo_ie24.png" style="float:left;"></img>
+<<<<<<< HEAD
+ <div class="installs">
+=======
<!-- <div class="installs">
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
INSTALL:
<a href="files/mdictionary.install"
class="install" style="margin-top:4px;"
</a>
<span style="clear:both;text-align:center;display:block;font-size:9px;"><a href="howto.html" style="font-size:9px;text-decoration:none;">(read How To... first)</a></span>
</div>
+<<<<<<< HEAD
+ <div style="display:block;height:100px;">
+=======
--> <div style="display:block;height:100px;">
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
<p class="title">
mDictionary
</p>
<div class="faq_switcher" onClick="javascript:faq_switcher(this);"></div>
Combobox
<div class="qml_answer">
+<<<<<<< HEAD
+ <p> text </p>
+=======
<p> ComboBox component allows to select one text item from the dropdown list, In the non-expanded state displays the currently selected item, when you expand it is possible to return without selecting a new element by clicking arrow at the component's right edge. You can use any set of text elements as a data model, as well as the change in size (it can be extended to the width). </p>
<img src="images/qml/cb01.png" ></img>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
</div>
</div>
<div class="faq_question">
<div class="faq_switcher" onClick="javascript:faq_switcher(this);"></div>
WebView
<div class="qml_answer">
+<<<<<<< HEAD
+ <p> text </p>
+=======
<p> This component uses a WebView from QtQuick. It is responsible for displaying html pages formatted using CSS. It has a zoom option, available by two buttons at the bottom right corner. The screen is also movable, the user by touch is able to move screen in all directions </p>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
<img src="images/qml/wv01.png" width="460"></img>
</div>
</div>
<img src="images/qml/w02.png"></img>
<img src="images/qml/w04.png"></img>
<img src="images/qml/w06.png"></img>
+<<<<<<< HEAD
+=======
<img src="images/qml/w07.png"></img>
+>>>>>>> 21a14d392f44458d749c76552e971f33625705ea
<img src="images/qml/widget01.png"></img>
<img src="images/qml/widget02.png" width="460"></img>
</div>