├── .gitattributes ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .tx └── config ├── 3rdparty └── ssu │ └── org.nemo.ssu.xml ├── COPYING ├── ChangeLog.md ├── README.md ├── bar-descriptor.xml ├── data ├── baltimore.ca.pem ├── certum.ca.pem ├── certum.network.ca.pem ├── data.qrc ├── dst.x3.ca.pem ├── globalsign.r2.ca.pem ├── googletrust.r2.ca.pem └── langs │ ├── google.json │ ├── ms.json │ ├── yandex.dictionaries.json │ └── yandex.translate.json ├── harbour-taot.png ├── l10n ├── l10n.qrc ├── taot_ar.ts ├── taot_bg.ts ├── taot_ca.ts ├── taot_cs_CZ.ts ├── taot_da.ts ├── taot_de.ts ├── taot_el.ts ├── taot_en.ts ├── taot_es.ts ├── taot_fi.ts ├── taot_fr_FR.ts ├── taot_hu.ts ├── taot_it.ts ├── taot_nl_BE.ts ├── taot_nl_NL.ts ├── taot_pl.ts ├── taot_pt.ts ├── taot_ru.ts ├── taot_sv.ts ├── taot_tr.ts ├── taot_uk.ts └── taot_zh_CN.ts ├── qml ├── about.js ├── bb10 │ ├── AboutPage.qml │ ├── AppCover.qml │ ├── DictionaryDelegate.qml │ ├── ExpandableLabel.qml │ ├── MainPage.qml │ ├── PrivacyNoticePage.qml │ ├── SettingsPage.qml │ ├── SettingsSwitch.qml │ ├── icons │ │ ├── collapse.png │ │ ├── collapse_inverted.png │ │ ├── donate.png │ │ ├── expand.png │ │ ├── expand_inverted.png │ │ ├── ic_bbm.png │ │ ├── ic_clear.png │ │ ├── ic_clear_inverted.png │ │ ├── ic_copy.png │ │ ├── ic_edit_bookmarks.png │ │ ├── ic_feedback.png │ │ ├── ic_info.png │ │ ├── ic_paste.png │ │ ├── swap.png │ │ └── swap_inverted.png │ └── main.qml ├── harmattan │ ├── AboutPage.qml │ ├── DictionaryDelegate.qml │ ├── ExpandableLabel.qml │ ├── Header.qml │ ├── ListDelegate.qml │ ├── MainPage.qml │ ├── PrivacyNoticePage.qml │ ├── SettingsPage.qml │ ├── SettingsSwitch.qml │ ├── TranslationTextAreaPage.qml │ ├── UpdateCheckerPage.qml │ ├── constants.js │ ├── icons │ │ ├── empty.png │ │ ├── expand.png │ │ └── expand_inverted.png │ └── main.qml ├── privacy.js ├── sailfish │ ├── AboutPage.qml │ ├── AppCover.qml │ ├── DictionaryDelegate.qml │ ├── ExpandableLabel.qml │ ├── InfoBanner.qml │ ├── MainPage.qml │ ├── PickerPage.qml │ ├── PrivacyNoticePage.qml │ ├── SettingsPage.qml │ ├── icons │ │ ├── expand.png │ │ ├── icon.png │ │ └── swap.png │ └── main.qml └── symbian │ ├── AboutPage.qml │ ├── DictionaryDelegate.qml │ ├── ExpandableLabel.qml │ ├── Header.qml │ ├── ListDelegate.qml │ ├── MainPage.qml │ ├── PrivacyNoticePage.qml │ ├── SettingsPage.qml │ ├── SettingsSwitch.qml │ ├── TranslationTextAreaPage.qml │ ├── UpdateCheckerPage.qml │ ├── icons │ ├── close.svg │ ├── close_inverted.svg │ ├── empty.png │ ├── expand.png │ ├── expand_inverted.png │ ├── swap.png │ └── swap_inverted.png │ └── main.qml ├── qmlapplicationviewer ├── qmlapplicationviewer.cpp ├── qmlapplicationviewer.h └── qmlapplicationviewer.pri ├── qtc_packaging ├── debian_harmattan │ ├── README │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── manifest.aegis │ └── rules └── taot_harmattan.desktop ├── rpm ├── harbour-taot.changes ├── harbour-taot.desktop ├── harbour-taot.spec ├── harbour-taot.yaml ├── icons │ ├── 86 │ │ └── harbour-taot.png │ ├── 108 │ │ └── harbour-taot.png │ └── 128 │ │ └── harbour-taot.png └── lib │ ├── arm │ └── libQt5SystemInfo.so.5 │ └── i386 │ └── libQt5SystemInfo.so.5 ├── src ├── bb10 │ ├── clipboard.cpp │ ├── clipboard.h │ ├── dictionarymodel.cpp │ ├── dictionarymodel.h │ ├── languagechangelistener.cpp │ ├── languagechangelistener.h │ ├── repeater.cpp │ ├── repeater.h │ ├── reversetranslationsmodel.cpp │ └── reversetranslationsmodel.h ├── clipboard.cpp ├── clipboard.h ├── dictionarymodel.cpp ├── dictionarymodel.h ├── icon │ ├── AI │ │ ├── TAOT.bb10.ai │ │ ├── TAOT.harmattan.ai │ │ ├── TAOT.jolla.ai │ │ └── TAOT.symbian.ai │ ├── BlackBerry10.svg │ ├── Harmattan.svg │ ├── Jolla.svg │ ├── Symbian.svg │ └── base.svg ├── l10nmodel.cpp ├── l10nmodel.h ├── languagelistmodel.cpp ├── languagelistmodel.h ├── main.cpp ├── reversetranslationsmodel.cpp ├── reversetranslationsmodel.h ├── services │ ├── apikeys.h │ ├── googletranslate.cpp │ ├── googletranslate.h │ ├── jsontranslationservice.cpp │ ├── jsontranslationservice.h │ ├── microsofttranslator.cpp │ ├── microsofttranslator.h │ ├── yandexdictionaries.cpp │ ├── yandexdictionaries.h │ ├── yandextranslate.cpp │ ├── yandextranslate.h │ ├── yandextranslationservice.cpp │ └── yandextranslationservice.h ├── symbian │ ├── symbianapplication.cpp │ └── symbianapplication.h ├── translationinterface.cpp ├── translationinterface.h ├── translationservice.cpp ├── translationservice.h ├── translationservicesmodel.cpp ├── translationservicesmodel.h ├── updater.cpp └── updater.h ├── taot.pro ├── taot.svg ├── taot480.png └── taot80.png /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto export-subst 2 | *.ai binary 3 | *.ts text eol=lf 4 | *.spec text eol=lf 5 | qtc_packaging/debian_harmattan/* text eof=lf 6 | rpm/lib/*/*.so* filter=lfs diff=lfs merge=lfs -text 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /*.user* 2 | /*.loc 3 | /*.rss 4 | /*.sis 5 | /.make.cache 6 | /ABLD.BAT 7 | /Makefile* 8 | /bld.inf 9 | /debian/ 10 | /l10n/*.qm 11 | /moc/ 12 | /obj/ 13 | /rcc/ 14 | /taot 15 | /taot_* 16 | /tmp/ 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "3rdparty/qtinappanalytics"] 2 | path = 3rdparty/qtinappanalytics 3 | url = https://github.com/leppa/qtinappanalytics.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: gcc 3 | dist: trusty 4 | sudo: required 5 | cache: ccache 6 | 7 | env: 8 | - QT_SELECT=qt4 QMAKE_ARGS="" 9 | - QT_SELECT=qt4 QMAKE_ARGS="CONFIG+=analytics" 10 | - QT_SELECT=qt5 QMAKE_ARGS="" 11 | - QT_SELECT=qt5 QMAKE_ARGS="CONFIG+=analytics" 12 | 13 | install: 14 | - sudo apt-get update -qq 15 | - if [ "$QT_SELECT" = "qt4" ]; then sudo apt-get install -qq qt4-default; fi 16 | - if [ "$QT_SELECT" = "qt5" ]; then sudo apt-get install -qq qt5-default qttools5-dev-tools qtdeclarative5-dev qtsystems5-dev; fi 17 | 18 | script: 19 | - qmake $QMAKE_ARGS taot.pro 20 | - make 21 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [taot.en] 5 | file_filter = l10n/taot_.ts 6 | source_file = l10n/taot_en.ts 7 | source_lang = en 8 | type = QT 9 | 10 | -------------------------------------------------------------------------------- /3rdparty/ssu/org.nemo.ssu.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TAO Translator 2 | ============== 3 | 4 | Copyright (C) 2013-2018 *[Oleksii Serdiuk](https://oleksii.name/)*. 5 | 6 | **TAO Translator** uses online translation services to provide 7 | translations. 8 | 9 | Currently supported services: 10 | 11 | - **Google Translate** - supports translation, transliteration for most 12 | non-latin scripts, language detection, and dictionary with reverse 13 | translations for single words. 14 | - **Microsoft Translator** (a.k.a. **Bing Translator**) - supports 15 | translation and language detection. 16 | - **Yandex.Translate** - supports translation and language detection. 17 | - **Yandex.Dictionaries** - supports dictionary with transcription 18 | for some languages, synonyms, and reverse translations. 19 | 20 | More services might be added in future. 21 | 22 | 23 | What's New 24 | ---------- 25 | 26 | You can check the [ChangeLog](ChangeLog.md) (updated only on releases) 27 | and [what's changed since last release][changes]. 28 | 29 | 30 | Download 31 | -------- 32 | 33 | **TAO Translator** is available for **BlackBerry 10**, **Nokia N9**, 34 | **Nokia Symbian** (Symbian^3) and **Sailfish OS**: 35 | 36 | - **BlackBerry 10**: [BlackBerry World][bb10]. 37 | - **Nokia N9**: [OpenRepos.net][openrepos] (self-signed). 38 | - **Nokia Symbian**: [AppList][applist] (recommended, self-signed), 39 | [Opera Mobile Store][opera] (Smart Installer, self-signed). 40 | - **Sailfish OS**: search for `taot` in the Store. 41 | 42 | 43 | License 44 | ------- 45 | 46 | This program is free software; you can redistribute it and/or 47 | modify it under the terms of the GNU General Public License 48 | as published by the Free Software Foundation; either version 2 49 | of the License, or (at your option) any later version. 50 | 51 | This program is distributed in the hope that it will be useful, 52 | but WITHOUT ANY WARRANTY; without even the implied warranty of 53 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 54 | GNU General Public License for more details. 55 | 56 | You should have received a copy of the GNU General Public License 57 | along with this program. If not, see . 58 | 59 | 60 | Build Status 61 | ------------ 62 | 63 | Buld status of the `master` branch: [![Travis CI Build Status][tci]][Travis CI] 64 | 65 | 66 | Donate 67 | ------ 68 | 69 | Donations are always welcome. If you'd like to make a donation, please, 70 | refer to [Donate][] page for more information. 71 | 72 | 73 | [changes]: https://github.com/leppa/taot/compare/stable...master 74 | [openrepos]: https://openrepos.net/content/leppa/tao-translator-nokia-n9 75 | [applist]: http://applist.schumi1331.de/content/85 76 | [opera]: http://symbian.apps.opera.com/the_advanced_online_translator.html 77 | [bb10]: http://appworld.blackberry.com/webstore/content/21908039/ 78 | [Travis CI]: https://travis-ci.org/leppa/taot 79 | [tci]: https://travis-ci.org/leppa/taot.png?branch=master 80 | [Donate]: https://github.com/leppa/taot/wiki/Donate 81 | 82 | 83 | -------------------------------------------------------------------------------- /bar-descriptor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | name.oleksii.bb10.taot 4 | TAO Translator 5 | 1.3.5 6 | TAO Translator uses online translation services to provide translations. 7 | 8 | icon.png 9 | 10 | Oleksii Serdiuk 11 | gYAAgFEzqeGb8kgSIn13NIOmc_c 12 | (C) 2013-2018 Oleksii Serdiuk 13 | 14 | portrait 15 | true 16 | none 17 | false 18 | 19 | 20 | 21 | 22 | run_native 23 | access_internet 24 | access_device_model_name 25 | taot 26 | icon.png 27 | assets/about.js 28 | assets/privacy.js 29 | assets 30 | 31 | application 32 | TAO Translator 33 | 34 | bb.action.SHARE 35 | text/plain 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /data/baltimore.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ 3 | RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD 4 | VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX 5 | DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y 6 | ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy 7 | VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr 8 | mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr 9 | IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK 10 | mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu 11 | XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy 12 | dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye 13 | jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 14 | BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 15 | DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 16 | 9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx 17 | jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 18 | Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz 19 | ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS 20 | R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /data/certum.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBM 3 | MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD 4 | QTAeFw0wMjA2MTExMDQ2MzlaFw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBM 5 | MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD 6 | QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6xwS7TT3zNJc4YPk/E 7 | jG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdLkKWo 8 | ePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GI 9 | ULdtlkIJ89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapu 10 | Ob7kky/ZR6By6/qmW6/KUz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUg 11 | AKpoC6EahQGcxEZjgoi2IrHu/qpGWX7PNSzVttpd90gzFFS269lvzs2I1qsb2pY7 12 | HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEA 13 | uI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+GXYkHAQa 14 | TOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTg 15 | xSvgGrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1q 16 | CjqTE5s7FCMTY5w/0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5x 17 | O/fIR/RpbxXyEV6DHpx8Uq79AtoSqFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs 18 | 6GAqm4VKQPNriiTsBhYscw== 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /data/certum.network.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM 3 | MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D 4 | ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU 5 | cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 6 | WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg 7 | Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw 8 | IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B 9 | AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH 10 | UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM 11 | TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU 12 | BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM 13 | kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x 14 | AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV 15 | HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV 16 | HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y 17 | sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL 18 | I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 19 | J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY 20 | VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI 21 | 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /data/data.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | baltimore.ca.pem 4 | certum.ca.pem 5 | certum.network.ca.pem 6 | dst.x3.ca.pem 7 | globalsign.r2.ca.pem 8 | googletrust.r2.ca.pem 9 | 10 | 11 | langs/google.json 12 | langs/ms.json 13 | langs/yandex.dictionaries.json 14 | langs/yandex.translate.json 15 | 16 | 17 | -------------------------------------------------------------------------------- /data/dst.x3.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/ 3 | MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT 4 | DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow 5 | PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD 6 | Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB 7 | AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O 8 | rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq 9 | OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b 10 | xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw 11 | 7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD 12 | aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV 13 | HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG 14 | SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69 15 | ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr 16 | AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz 17 | R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5 18 | JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo 19 | Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /data/globalsign.r2.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G 3 | A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp 4 | Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 5 | MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG 6 | A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI 7 | hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL 8 | v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 9 | eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq 10 | tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd 11 | C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa 12 | zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB 13 | mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH 14 | V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n 15 | bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG 16 | 3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs 17 | J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO 18 | 291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS 19 | ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd 20 | AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 21 | TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /data/googletrust.r2.ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBH 3 | MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM 4 | QzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIy 5 | MDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNl 6 | cnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEB 7 | AQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv 8 | CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3Kg 9 | GjSY6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9Bu 10 | XvAuMC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOd 11 | re7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXu 12 | PuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1 13 | mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K 14 | 8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqj 15 | x5RWIr9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsR 16 | nTKaG73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0 17 | kzCqgc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9Ok 18 | twIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV 19 | HQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBALZp 20 | 8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT 21 | vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiT 22 | z9D2PGcDFWEJ+YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiA 23 | pJiS4wGWAqoC7o87xdFtCjMwc3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvb 24 | pxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3DaWsYDQvTtN6LwG1BUSw7YhN4ZKJmB 25 | R64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5rn/WkhLx3+WuXrD5R 26 | RaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56GtmwfuNmsk 27 | 0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC 28 | 5AwiWVIQ7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiF 29 | izoHCBy69Y9Vmhh1fuXsgWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLn 30 | yOd/xCxgXS/Dr55FBcOEArf9LAhST4Ldo/DUhgkC 31 | -----END CERTIFICATE----- 32 | -------------------------------------------------------------------------------- /data/langs/ms.json: -------------------------------------------------------------------------------- 1 | { 2 | "langs": [ 3 | "af", 4 | "ar", 5 | "bn", 6 | "bs-Latn", 7 | "bg", 8 | "ca", 9 | "zh-CHS", 10 | "zh-CHT", 11 | "yue", 12 | "hr", 13 | "cs", 14 | "da", 15 | "nl", 16 | "en", 17 | "et", 18 | "fj", 19 | "fil", 20 | "fi", 21 | "fr", 22 | "de", 23 | "el", 24 | "ht", 25 | "he", 26 | "hi", 27 | "mww", 28 | "hu", 29 | "is", 30 | "id", 31 | "it", 32 | "ja", 33 | "sw", 34 | "tlh", 35 | "tlh-Qaak", 36 | "ko", 37 | "lv", 38 | "lt", 39 | "mg", 40 | "ms", 41 | "mt", 42 | "yua", 43 | "no", 44 | "otq", 45 | "fa", 46 | "pl", 47 | "pt", 48 | "ro", 49 | "ru", 50 | "sm", 51 | "sr-Cyrl", 52 | "sr-Latn", 53 | "sk", 54 | "sl", 55 | "es", 56 | "sv", 57 | "ty", 58 | "ta", 59 | "th", 60 | "to", 61 | "tr", 62 | "uk", 63 | "ur", 64 | "vi", 65 | "cy" 66 | ], 67 | "langNames": [ 68 | "Afrikaans", 69 | "Arabic", 70 | "Bangla", 71 | "Bosnian (Latin)", 72 | "Bulgarian", 73 | "Catalan", 74 | "Chinese Simplified", 75 | "Chinese Traditional", 76 | "Cantonese (Traditional)", 77 | "Croatian", 78 | "Czech", 79 | "Danish", 80 | "Dutch", 81 | "English", 82 | "Estonian", 83 | "Fijian", 84 | "Filipino", 85 | "Finnish", 86 | "French", 87 | "German", 88 | "Greek", 89 | "Haitian Creole", 90 | "Hebrew", 91 | "Hindi", 92 | "Hmong Daw", 93 | "Hungarian", 94 | "Icelandic", 95 | "Indonesian", 96 | "Italian", 97 | "Japanese", 98 | "Kiswahili", 99 | "Klingon", 100 | "Klingon (pIqaD)", 101 | "Korean", 102 | "Latvian", 103 | "Lithuanian", 104 | "Malagasy", 105 | "Malay", 106 | "Maltese", 107 | "Yucatec Maya", 108 | "Norwegian Bokmål", 109 | "Querétaro Otomi", 110 | "Persian", 111 | "Polish", 112 | "Portuguese", 113 | "Romanian", 114 | "Russian", 115 | "Samoan", 116 | "Serbian (Cyrillic)", 117 | "Serbian (Latin)", 118 | "Slovak", 119 | "Slovenian", 120 | "Spanish", 121 | "Swedish", 122 | "Tahitian", 123 | "Tamil", 124 | "Thai", 125 | "Tongan", 126 | "Turkish", 127 | "Ukrainian", 128 | "Urdu", 129 | "Vietnamese", 130 | "Welsh" 131 | ] 132 | } 133 | -------------------------------------------------------------------------------- /data/langs/yandex.dictionaries.json: -------------------------------------------------------------------------------- 1 | { 2 | "dirs": [ 3 | "be-be", 4 | "be-ru", 5 | "bg-ru", 6 | "cs-en", 7 | "cs-ru", 8 | "da-en", 9 | "da-ru", 10 | "de-de", 11 | "de-en", 12 | "de-ru", 13 | "de-tr", 14 | "el-en", 15 | "el-ru", 16 | "en-cs", 17 | "en-da", 18 | "en-de", 19 | "en-el", 20 | "en-en", 21 | "en-es", 22 | "en-et", 23 | "en-fi", 24 | "en-fr", 25 | "en-it", 26 | "en-lt", 27 | "en-lv", 28 | "en-nl", 29 | "en-no", 30 | "en-pt", 31 | "en-ru", 32 | "en-sk", 33 | "en-sv", 34 | "en-tr", 35 | "en-uk", 36 | "es-en", 37 | "es-es", 38 | "es-ru", 39 | "et-en", 40 | "et-ru", 41 | "fi-en", 42 | "fi-ru", 43 | "fi-fi", 44 | "fr-fr", 45 | "fr-en", 46 | "fr-ru", 47 | "hu-hu", 48 | "hu-ru", 49 | "it-en", 50 | "it-it", 51 | "it-ru", 52 | "lt-en", 53 | "lt-lt", 54 | "lt-ru", 55 | "lv-en", 56 | "lv-ru", 57 | "mhr-ru", 58 | "mrj-ru", 59 | "nl-en", 60 | "nl-ru", 61 | "no-en", 62 | "no-ru", 63 | "pl-ru", 64 | "pt-en", 65 | "pt-ru", 66 | "ru-be", 67 | "ru-bg", 68 | "ru-cs", 69 | "ru-da", 70 | "ru-de", 71 | "ru-el", 72 | "ru-en", 73 | "ru-es", 74 | "ru-et", 75 | "ru-fi", 76 | "ru-fr", 77 | "ru-hu", 78 | "ru-it", 79 | "ru-lt", 80 | "ru-lv", 81 | "ru-mhr", 82 | "ru-mrj", 83 | "ru-nl", 84 | "ru-no", 85 | "ru-pl", 86 | "ru-pt", 87 | "ru-ru", 88 | "ru-sk", 89 | "ru-sv", 90 | "ru-tr", 91 | "ru-tt", 92 | "ru-uk", 93 | "sk-en", 94 | "sk-ru", 95 | "sv-en", 96 | "sv-ru", 97 | "tr-de", 98 | "tr-en", 99 | "tr-ru", 100 | "tt-ru", 101 | "uk-en", 102 | "uk-ru", 103 | "uk-uk" 104 | ], 105 | "langs": { 106 | "af": "Afrikaans", 107 | "ar": "Arabic", 108 | "az": "Azerbaijani", 109 | "ba": "Bashkir", 110 | "be": "Belarusian", 111 | "bg": "Bulgarian", 112 | "bn": "Bengali", 113 | "bs": "Bosnian", 114 | "ca": "Catalan", 115 | "ceb": "Cebuano", 116 | "cs": "Czech", 117 | "cy": "Welsh", 118 | "da": "Danish", 119 | "de": "German", 120 | "el": "Greek", 121 | "en": "English", 122 | "eo": "Esperanto", 123 | "es": "Spanish", 124 | "et": "Estonian", 125 | "eu": "Basque", 126 | "fa": "Persian", 127 | "fi": "Finnish", 128 | "fr": "French", 129 | "ga": "Irish", 130 | "gd": "Scottish Gaelic", 131 | "gl": "Galician", 132 | "gu": "Gujarati", 133 | "he": "Hebrew", 134 | "hi": "Hindi", 135 | "hr": "Croatian", 136 | "ht": "Haitian", 137 | "hu": "Hungarian", 138 | "hy": "Armenian", 139 | "id": "Indonesian", 140 | "is": "Icelandic", 141 | "it": "Italian", 142 | "ja": "Japanese", 143 | "jv": "Javanese", 144 | "ka": "Georgian", 145 | "kk": "Kazakh", 146 | "kn": "Kannada", 147 | "ko": "Korean", 148 | "ky": "Kirghiz", 149 | "la": "Latin", 150 | "lt": "Lithuanian", 151 | "lv": "Latvian", 152 | "mg": "Malagasy", 153 | "mi": "Maori", 154 | "mk": "Macedonian", 155 | "ml": "Malayalam", 156 | "mn": "Mongolian", 157 | "mr": "Marathi", 158 | "ms": "Malay", 159 | "mt": "Maltese", 160 | "ne": "Nepali", 161 | "nl": "Dutch", 162 | "no": "Norwegian", 163 | "pa": "Punjabi", 164 | "pl": "Polish", 165 | "pt": "Portuguese", 166 | "ro": "Romanian", 167 | "ru": "Russian", 168 | "si": "Sinhalese", 169 | "sk": "Slovak", 170 | "sl": "Slovenian", 171 | "sq": "Albanian", 172 | "sr": "Serbian", 173 | "su": "Sundanese", 174 | "sv": "Swedish", 175 | "sw": "Swahili", 176 | "ta": "Tamil", 177 | "te": "Telugu", 178 | "tg": "Tajik", 179 | "th": "Thai", 180 | "tl": "Tagalog", 181 | "tr": "Turkish", 182 | "tt": "Tatar", 183 | "udm": "Udmurt", 184 | "uk": "Ukrainian", 185 | "ur": "Urdu", 186 | "uz": "Uzbek", 187 | "vi": "Vietnamese", 188 | "yi": "Yiddish", 189 | "zh": "Chinese" 190 | } 191 | } -------------------------------------------------------------------------------- /harbour-taot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/harbour-taot.png -------------------------------------------------------------------------------- /l10n/l10n.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | taot_ar.qm 4 | taot_bg.qm 5 | taot_ca.qm 6 | taot_cs_CZ.qm 7 | taot_da.qm 8 | taot_de.qm 9 | taot_el.qm 10 | taot_en.qm 11 | taot_es.qm 12 | taot_fi.qm 13 | taot_fr_FR.qm 14 | taot_hu.qm 15 | taot_it.qm 16 | taot_nl_BE.qm 17 | taot_nl_NL.qm 18 | taot_pl.qm 19 | taot_pt.qm 20 | taot_ru.qm 21 | taot_sv.qm 22 | taot_tr.qm 23 | taot_uk.qm 24 | taot_zh_CN.qm 25 | 26 | 27 | -------------------------------------------------------------------------------- /qml/about.js: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | .pragma library 24 | 25 | // TODO: Clean up this mess! 26 | var aboutText = 27 | "

https://github.com/leppa/taot

" + 28 | "

Copyright © 2013-2018 Oleksii Serdiuk

" + 29 | "

 

" + 30 | "

" + qsTr("%1 is free software that I develop in my spare time. If you like it, I would appreciate a donation: Donate.").arg("TAO Translator").arg("https://github.com/leppa/taot/wiki/Donate") + "

" + 31 | "

 

" + 32 | "

" + 33 | qsTr("%1 contains the following contributed translations:").arg("TAO Translator") + " " + 34 | "Arabic by Sary AWAD (sary.1991) and OmarRi, " + 35 | "Bulgarian by Vassil (vakkov), " + 36 | "Catalan by Agustí Clara (fri666), " + 37 | "Chinese by gwmgdemj, 太空飞瓜 (finalmix), and YF (yfdyh000), " + 38 | "Czech by Jakub Kožíšek (nodevel), " + 39 | "Danish by Peter Jespersen (flywheeldk), " + 40 | "Dutch (Belgium) by Nathan Follens, " + 41 | "Dutch (Netherlands) by teunwinters and Heimen Stoffels (Vistaus), " + 42 | "Finnish by Timpaxi, " + 43 | "French by Jordi and lutinotmalin, " + 44 | "German by buschmann, DeadHorseRiding (Mee_Germany_Go), and R.G. Sidler (rgsidler), " + 45 | "Greek by Wasilis Mandratzis-Walz (beonex), and Dimitrios Glentadakis (dglent), " + 46 | "Hungarian by ViBE, " + 47 | "Italian by Francesco Vaccaro (ghostofasmile), and Alessandro Pra' (Watchmaker), " + 48 | "Polish by Maurycy and mp107, " + 49 | "Portuguese by Delson Lima (delsonlima), " + 50 | "Spanish by Carmen Fernández B., " + 51 | "Swedish by Åke Engelbrektson, " + 52 | "Turkish by Mehmet Ç. (fnldstntn) and Mesut Aktaş." + 53 | "

" + 54 | "

 

" + 55 | "

" + qsTr("If your language is missing, you can help translating %1 into your language.").arg("TAO Translator").arg("https://www.transifex.com/projects/p/taot/") + "

" + 56 | "

 

" + 57 | qsTr("

%1 uses online translation services to provide translations.

" + 58 | "

Currently supported services:

" + 59 | "
    " + 60 | "\t
  • Google Translate - supports translation, transliteration for most non-latin scripts, language detection, and dictionary with reverse translations for single words.
  • \n" + 61 | "\t
  • Microsoft Translator (a.k.a. Bing Translator) - supports translation and language detection.
  • \n" + 62 | "\t
  • Yandex.Translate - supports translation and language detection.
  • \n" + 63 | "\t
  • Yandex.Dictionaries - supports dictionary with transcription for some languages, synonyms, and reverse translations.
  • \n" + 64 | "
" + 65 | "

More services are possible in future.

").arg("TAO Translator") + " " + 66 | "

 

" + 67 | "

This program is free software; you can redistribute it and/or " + 68 | "modify it under the terms of the GNU General Public License " + 69 | "as published by the Free Software Foundation; either version 2 " + 70 | "of the License, or (at your option) any later version.

" + 71 | "

This program is distributed in the hope that it will be useful, " + 72 | "but WITHOUT ANY WARRANTY; without even the implied warranty of " + 73 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + 74 | "GNU General Public License for more details.

" + 75 | "

You should have received a copy of the GNU General Public License " + 76 | "along with this program. If not, see <http://www.gnu.org/licenses/>.

" 77 | -------------------------------------------------------------------------------- /qml/bb10/AboutPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import bb.cascades 1.0 24 | import "about.js" as About 25 | 26 | Page { 27 | id: root 28 | 29 | titleBar: TitleBar { 30 | title: "TAO Translator" 31 | } 32 | ScrollView { 33 | Container { 34 | property int padding: 20 35 | 36 | topPadding: padding 37 | leftPadding: padding 38 | bottomPadding: padding 39 | rightPadding: padding 40 | 41 | Label { 42 | text: qsTr("Version: %1").arg(translator.version) 43 | textStyle.base: SystemDefaults.TextStyles.PrimaryText 44 | textFormat: TextFormat.Html 45 | } 46 | Label { 47 | text: qsTr("You donated %n coins. Thank you!", 48 | "", 49 | donationManager.totalCoinCount) 50 | textFormat: TextFormat.Html 51 | multiline: true 52 | visible: donationManager.totalCoinCount > 0 53 | } 54 | Label { 55 | multiline: true 56 | text: About.aboutText 57 | textFormat: TextFormat.Html 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /qml/bb10/AppCover.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import bb.cascades 1.0 24 | 25 | Container { 26 | topPadding: 5 27 | leftPadding: 10 28 | bottomPadding: 5 29 | rightPadding: 10 30 | background: Application.themeSupport.theme.colorTheme.style === VisualStyle.Dark 31 | ? Color.Black 32 | : Color.White 33 | Container { 34 | layoutProperties: StackLayoutProperties { spaceQuota: 0.5 } 35 | Label { 36 | text: qsTr("From: %1").arg(translator.sourceLanguage.displayName) 37 | + Retranslate.onLocaleOrLanguageChanged 38 | bottomMargin: 0 39 | textFormat: TextFormat.Html 40 | textStyle { 41 | fontSize: FontSize.XXSmall 42 | } 43 | } 44 | Label { 45 | text: translator.sourceText 46 | topMargin: 0 47 | bottomMargin: 0 48 | multiline: true 49 | textFormat: TextFormat.Plain 50 | textStyle { 51 | fontSize: FontSize.XSmall 52 | } 53 | } 54 | } 55 | Divider { 56 | topMargin: 5 57 | bottomMargin: 5 58 | } 59 | Container { 60 | layoutProperties: StackLayoutProperties { spaceQuota: 0.5 } 61 | Label { 62 | text: qsTr("To: %1").arg(translator.targetLanguage.displayName) 63 | + Retranslate.onLocaleOrLanguageChanged 64 | bottomMargin: 0 65 | textFormat: TextFormat.Html 66 | textStyle { 67 | fontSize: FontSize.XXSmall 68 | } 69 | } 70 | Label { 71 | text: translator.translatedText 72 | topMargin: 0 73 | multiline: true 74 | textFormat: TextFormat.Plain 75 | textStyle { 76 | fontSize: FontSize.XSmall 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /qml/bb10/DictionaryDelegate.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import bb.cascades 1.0 24 | import taot 1.0 25 | 26 | Container { 27 | property bool expanded: false 28 | 29 | bottomMargin: expanded ? 15 : 0 30 | 31 | Label { 32 | text: pos 33 | topMargin: 0 34 | bottomMargin: 0 35 | } 36 | Label { 37 | text: translations 38 | multiline: !expanded 39 | topMargin: 0 40 | bottomMargin: 0 41 | textStyle { 42 | base: SystemDefaults.TextStyles.PrimaryText 43 | } 44 | } 45 | Repeater { 46 | model: reverseTranslations 47 | 48 | Container { 49 | visible: expanded 50 | layout: StackLayout { orientation: LayoutOrientation.LeftToRight } 51 | 52 | Container { 53 | topPadding: 12 54 | layoutProperties: StackLayoutProperties { spaceQuota: 1 } 55 | 56 | Label { 57 | text: term + (synonyms.length > 0 ? "\n(" + synonyms + ")" : "") 58 | multiline: true 59 | topMargin: 0 60 | bottomMargin: 0 61 | horizontalAlignment: HorizontalAlignment.Fill 62 | textStyle { 63 | fontSize: FontSize.Small 64 | textAlign: TextAlign.Right 65 | } 66 | } 67 | } 68 | Container { 69 | topPadding: 5 70 | leftPadding: 15 71 | layoutProperties: StackLayoutProperties { spaceQuota: 2 } 72 | 73 | Divider { 74 | topMargin: 0 75 | bottomMargin: 0 76 | } 77 | Label { 78 | text: translations 79 | multiline: true 80 | topMargin: 0 81 | bottomMargin: 0 82 | } 83 | } 84 | } 85 | } 86 | ImageView { 87 | imageSource: "asset:///icons/collapse" + (darkTheme ? "_inverted" : "") + ".png" 88 | topMargin: 0 89 | bottomMargin: 0 90 | preferredWidth: 35 91 | preferredHeight: preferredWidth 92 | horizontalAlignment: HorizontalAlignment.Right 93 | visible: expanded 94 | } 95 | Divider { 96 | topMargin: 5 97 | bottomMargin: 0 98 | } 99 | ImageView { 100 | imageSource: "asset:///icons/expand" + (darkTheme ? "_inverted" : "") + ".png" 101 | topMargin: 0 102 | bottomMargin: 0 103 | preferredWidth: 35 104 | preferredHeight: preferredWidth 105 | horizontalAlignment: HorizontalAlignment.Right 106 | visible: !expanded 107 | } 108 | 109 | gestureHandlers: [ 110 | TapHandler { 111 | onTapped: { 112 | expanded = !expanded; 113 | } 114 | } 115 | ] 116 | } 117 | -------------------------------------------------------------------------------- /qml/bb10/ExpandableLabel.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import bb.cascades 1.0 24 | 25 | Container { 26 | property alias text: label.text 27 | property alias textStyle: label.textStyle 28 | property bool expanded: false 29 | 30 | Label { 31 | id: label 32 | 33 | multiline: expanded 34 | topMargin: 0 35 | bottomMargin: 0 36 | } 37 | ImageView { 38 | imageSource: "asset:///icons/collapse" + (darkTheme ? "_inverted" : "") + ".png" 39 | topMargin: 0 40 | bottomMargin: 0 41 | preferredWidth: 35 42 | preferredHeight: preferredWidth 43 | horizontalAlignment: HorizontalAlignment.Right 44 | visible: expanded 45 | } 46 | Divider { 47 | topMargin: 5 48 | bottomMargin: 0 49 | } 50 | ImageView { 51 | imageSource: "asset:///icons/expand" + (darkTheme ? "_inverted" : "") + ".png" 52 | topMargin: 0 53 | bottomMargin: 0 54 | preferredWidth: 35 55 | preferredHeight: preferredWidth 56 | horizontalAlignment: HorizontalAlignment.Right 57 | visible: !expanded 58 | } 59 | 60 | onTextChanged: { 61 | expanded = false; 62 | } 63 | 64 | gestureHandlers: [ 65 | TapHandler { 66 | onTapped: { 67 | expanded = !expanded; 68 | } 69 | } 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /qml/bb10/PrivacyNoticePage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.0 24 | import bb.cascades 1.0 25 | import taot 1.0 26 | 27 | import "privacy.js" as Privacy 28 | 29 | Sheet { 30 | id: root 31 | 32 | Page { 33 | titleBar: TitleBar { 34 | title: qsTr("Privacy Notice") + Retranslate.onLocaleOrLanguageChanged 35 | 36 | dismissAction: ActionItem { 37 | title: qsTr("Cancel") + Retranslate.onLocaleOrLanguageChanged 38 | enabled: translator.privacyLevel != Translator.UndefinedPrivacy 39 | 40 | onTriggered: { 41 | root.close(); 42 | } 43 | } 44 | acceptAction: ActionItem { 45 | title: qsTr("Accept") + Retranslate.onLocaleOrLanguageChanged 46 | 47 | onTriggered: { 48 | translator.privacyLevel = privacySelector.selectedIndex; 49 | root.close(); 50 | } 51 | } 52 | } 53 | 54 | ScrollView { 55 | Container { 56 | property int padding: 20 57 | 58 | topPadding: padding 59 | leftPadding: padding 60 | bottomPadding: padding 61 | rightPadding: padding 62 | 63 | Label { 64 | text: Privacy.notice + Retranslate.onLocaleOrLanguageChanged 65 | multiline: true 66 | textStyle { 67 | base: SystemDefaults.TextStyles.TitleText 68 | } 69 | } 70 | RadioGroup { 71 | id: privacySelector 72 | 73 | selectedIndex: translator.privacyLevel == Translator.UndefinedPrivacy 74 | ? Translator.NoPrivacy 75 | : translator.privacyLevel 76 | dividersVisible: true 77 | 78 | Option { 79 | text: Privacy.noPrivacyText + Retranslate.onLocaleOrLanguageChanged 80 | } 81 | Option { 82 | text: Privacy.errorsOnlyText + Retranslate.onLocaleOrLanguageChanged 83 | } 84 | Option { 85 | text: Privacy.maxPrivacyText + Retranslate.onLocaleOrLanguageChanged 86 | } 87 | } 88 | Label { 89 | text: Privacy.details + Retranslate.onLocaleOrLanguageChanged 90 | textFormat: TextFormat.Html 91 | multiline: true 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /qml/bb10/SettingsSwitch.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import bb.cascades 1.0 24 | 25 | Container { 26 | id: root 27 | 28 | property alias title: title.text 29 | property alias description: description.text 30 | property alias checked: toggle.checked 31 | property int padding: 10 32 | 33 | signal tapped() 34 | 35 | layout: StackLayout { orientation: LayoutOrientation.LeftToRight } 36 | topPadding: padding 37 | leftPadding: padding 38 | bottomPadding: padding 39 | rightPadding: padding 40 | 41 | Container { 42 | verticalAlignment: VerticalAlignment.Center 43 | layoutProperties: StackLayoutProperties { 44 | spaceQuota: 1 45 | } 46 | 47 | Label { 48 | id: title 49 | 50 | multiline: true 51 | bottomMargin: 0 52 | textStyle { 53 | base: SystemDefaults.TextStyles.TitleText 54 | } 55 | } 56 | Label { 57 | id: description 58 | 59 | multiline: true 60 | topMargin: 0 61 | textFormat: TextFormat.Html 62 | visible: text != "" 63 | textStyle { 64 | base: SystemDefaults.TextStyles.SubTitleText 65 | fontWeight: FontWeight.W300 66 | } 67 | } 68 | 69 | gestureHandlers: [ 70 | TapHandler { 71 | onTapped: { 72 | toggle.checked = !toggle.checked; 73 | root.tapped(); 74 | } 75 | } 76 | ] 77 | } 78 | 79 | Container { 80 | leftPadding: 10 81 | verticalAlignment: VerticalAlignment.Center 82 | layoutProperties: StackLayoutProperties { 83 | spaceQuota: -1 84 | } 85 | 86 | ToggleButton { 87 | id: toggle 88 | 89 | gestureHandlers: [ 90 | TapHandler { 91 | onTapped: { 92 | root.tapped(); 93 | } 94 | } 95 | ] 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /qml/bb10/icons/collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/collapse.png -------------------------------------------------------------------------------- /qml/bb10/icons/collapse_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/collapse_inverted.png -------------------------------------------------------------------------------- /qml/bb10/icons/donate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/donate.png -------------------------------------------------------------------------------- /qml/bb10/icons/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/expand.png -------------------------------------------------------------------------------- /qml/bb10/icons/expand_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/expand_inverted.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_bbm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_bbm.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_clear.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_clear_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_clear_inverted.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_copy.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_edit_bookmarks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_edit_bookmarks.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_feedback.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_info.png -------------------------------------------------------------------------------- /qml/bb10/icons/ic_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/ic_paste.png -------------------------------------------------------------------------------- /qml/bb10/icons/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/swap.png -------------------------------------------------------------------------------- /qml/bb10/icons/swap_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/bb10/icons/swap_inverted.png -------------------------------------------------------------------------------- /qml/harmattan/AboutPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | import "about.js" as About 26 | 27 | Page { 28 | id: root 29 | 30 | Header { 31 | id: header 32 | text: "TAO Translator" 33 | } 34 | 35 | Flickable { 36 | id: scrollArea 37 | 38 | contentHeight: column.height + 2 * 8 /*UI.PADDING_LARGE*/ 39 | anchors { 40 | top: header.bottom 41 | left: parent.left 42 | bottom: parent.bottom 43 | right: parent.right 44 | } 45 | 46 | Column { 47 | id: column 48 | 49 | spacing: 8 /*UI.PADDING_LARGE*/ 50 | anchors { 51 | top: parent.top 52 | left: parent.left 53 | right: parent.right 54 | margins: 8 /*UI.PADDING_LARGE*/ 55 | } 56 | 57 | Label { 58 | width: parent.width 59 | text: qsTr("Version: %1").arg(translator.version) 60 | font: UiConstants.TitleFont 61 | } 62 | 63 | Label { 64 | text: About.aboutText 65 | wrapMode: Text.WordWrap 66 | width: parent.width 67 | 68 | onLinkActivated: { 69 | Qt.openUrlExternally(link); 70 | } 71 | } 72 | } 73 | } 74 | 75 | ScrollDecorator { 76 | flickableItem: scrollArea 77 | } 78 | 79 | tools: ToolBarLayout { 80 | ToolIcon { 81 | iconId: "toolbar-back" 82 | onClicked: pageStack.pop(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /qml/harmattan/ExpandableLabel.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | 26 | MouseArea { 27 | id: root 28 | 29 | property string text 30 | property bool expanded: false 31 | property bool expandable: controlLabel.width > label.width 32 | 33 | height: visible ? implicitHeight : 0 34 | implicitHeight: childrenRect.height 35 | clip: true 36 | 37 | TextAreaStyle { 38 | id: style 39 | } 40 | 41 | Label { 42 | id: label 43 | 44 | text: expanded ? root.text : root.text.replace(/\r|\n/g, " ") 45 | wrapMode: expanded ? Text.WordWrap : Text.NoWrap 46 | elide: expanded ? Text.ElideNone : Text.ElideRight 47 | width: parent.width - style.backgroundCornerMargin 48 | anchors { 49 | left: parent.left 50 | right: parent.right 51 | leftMargin: style.backgroundCornerMargin / 2 52 | rightMargin: style.backgroundCornerMargin / 2 53 | } 54 | } 55 | 56 | Image { 57 | id: indicator 58 | 59 | source: Qt.resolvedUrl("icons/expand.png") 60 | rotation: expanded ? 180 : 0 61 | visible: expanded || (!expanded && expandable) 62 | height: visible ? implicitHeight : 0 63 | sourceSize { 64 | width: 32 /*UI.SIZE_ICON_DEFAULT*/ 65 | height: 32 /*UI.SIZE_ICON_DEFAULT*/ 66 | } 67 | anchors { 68 | top: label.bottom 69 | topMargin: -height / 4 70 | right: parent.right 71 | rightMargin: style.backgroundCornerMargin / 2 72 | } 73 | 74 | Behavior on rotation { NumberAnimation {} } 75 | } 76 | 77 | Behavior on height { NumberAnimation {} } 78 | 79 | // HACK: Text::truncated property 80 | // doesn't seem to work properly, 81 | // so this hack is used to detect, 82 | // whether text fits on one line. 83 | property Label controlLabel: Label { 84 | text: root.text.replace(/\r|\n/g, "") 85 | maximumLineCount: 1 86 | visible: false 87 | } 88 | 89 | onTextChanged: { 90 | expanded = false; 91 | } 92 | 93 | onExpandableChanged: { 94 | if (!expandable) 95 | expanded = false; 96 | } 97 | 98 | onClicked: { 99 | if (!expandable) 100 | return; 101 | 102 | expanded = !expanded 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /qml/harmattan/Header.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | 26 | Rectangle { 27 | id: header 28 | 29 | property alias text: label.text 30 | 31 | z: 100 32 | height: appWindow.inPortrait ? UiConstants.HeaderDefaultHeightPortrait 33 | : UiConstants.HeaderDefaultHeightLandscape 34 | gradient: Gradient { 35 | GradientStop { 36 | position: 0.00 37 | color: theme.selectionColor 38 | } 39 | GradientStop { 40 | position: 1.0 41 | color: Qt.darker(theme.selectionColor) 42 | } 43 | } 44 | anchors { 45 | left: parent.left 46 | right: parent.right 47 | } 48 | 49 | Label { 50 | id: label 51 | 52 | color: "white" 53 | font: UiConstants.HeaderFont 54 | anchors { 55 | verticalCenter: parent.verticalCenter 56 | left: parent.left 57 | leftMargin: UiConstants.DefaultMargin 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /qml/harmattan/ListDelegate.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) 6 | ** 7 | ** This file is part of the Qt Components project. 8 | ** 9 | ** $QT_BEGIN_LICENSE:BSD$ 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | import QtQuick 1.1 41 | import com.nokia.meego 1.1 42 | import "constants.js" as UI 43 | 44 | Item { 45 | id: listItem 46 | 47 | signal clicked 48 | property alias pressed: mouseArea.pressed 49 | 50 | property alias title: mainText.text 51 | property alias subTitle: subText.text 52 | 53 | property int titleSize: UI.LIST_TILE_SIZE 54 | property int titleWeight: Font.Bold 55 | property color titleColor: theme.inverted ? UI.LIST_TITLE_COLOR_INVERTED : UI.LIST_TITLE_COLOR 56 | 57 | property int subtitleSize: UI.LIST_SUBTILE_SIZE 58 | property int subtitleWeight: Font.Light 59 | property color subtitleColor: theme.inverted ? UI.LIST_SUBTITLE_COLOR_INVERTED : UI.LIST_SUBTITLE_COLOR 60 | 61 | height: UI.LIST_ITEM_HEIGHT 62 | width: parent.width 63 | 64 | BorderImage { 65 | id: background 66 | anchors.fill: parent 67 | // Fill page porders 68 | visible: mouseArea.pressed 69 | source: "image://theme/meegotouch-list-background-pressed-center" 70 | } 71 | 72 | Row { 73 | anchors { 74 | top: parent.top 75 | left: parent.left 76 | leftMargin: UI.MARGIN_XLARGE 77 | bottom: parent.bottom 78 | right: icon.left 79 | rightMargin: UI.MARGIN_XLARGE 80 | } 81 | spacing: UI.LIST_ITEM_SPACING 82 | 83 | Column { 84 | anchors.verticalCenter: parent.verticalCenter 85 | 86 | Label { 87 | id: mainText 88 | font.weight: listItem.titleWeight 89 | font.pixelSize: listItem.titleSize 90 | color: listItem.titleColor 91 | } 92 | 93 | Label { 94 | id: subText 95 | font.weight: listItem.subtitleWeight 96 | font.pixelSize: listItem.subtitleSize 97 | color: listItem.subtitleColor 98 | 99 | visible: text != "" 100 | } 101 | } 102 | } 103 | Image { 104 | id: icon 105 | 106 | anchors { 107 | right: parent.right 108 | // rightMargin: UI.MARGIN_XLARGE 109 | verticalCenter: parent.verticalCenter 110 | } 111 | height: sourceSize.height 112 | width: sourceSize.width 113 | source: "image://theme/meegotouch-combobox-indicator" + platformStyle.__invertedString 114 | } 115 | 116 | MouseArea { 117 | id: mouseArea; 118 | anchors.fill: parent 119 | onClicked: { 120 | listItem.clicked(); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /qml/harmattan/PrivacyNoticePage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | import taot 1.0 26 | 27 | import "constants.js" as UI 28 | import "privacy.js" as Privacy 29 | 30 | Sheet { 31 | id: root 32 | 33 | acceptButtonText: qsTr("Accept") 34 | rejectButtonText: translator.privacyLevel != Translator.UndefinedPrivacy ? qsTr("Cancel") 35 | : "" 36 | 37 | content: [ 38 | Flickable { 39 | id: scrollArea 40 | 41 | contentHeight: column.height + 2 * UI.MARGIN_XLARGE 42 | anchors { 43 | fill: parent 44 | } 45 | 46 | Column { 47 | id: column 48 | 49 | property int selectedOption 50 | 51 | function checkItem(option) 52 | { 53 | noPrivacyOption.checked = option === Translator.NoPrivacy; 54 | errorsOnlyOption.checked = option === Translator.ErrorsOnlyPrivacy; 55 | maxPrivacyOption.checked = option === Translator.MaximumPrivacy; 56 | selectedOption = option; 57 | } 58 | 59 | spacing: UI.MARGIN_XLARGE 60 | anchors { 61 | top: parent.top 62 | left: parent.left 63 | right: parent.right 64 | margins: UI.MARGIN_XLARGE 65 | } 66 | 67 | Label { 68 | text: Privacy.notice 69 | width: parent.width 70 | wrapMode: Text.WordWrap 71 | font: UiConstants.TitleFont 72 | } 73 | 74 | RadioButton { 75 | id: noPrivacyOption 76 | text: Privacy.noPrivacyText 77 | checked: translator.privacyLevel == Translator.NoPrivacy 78 | || translator.privacyLevel == Translator.UndefinedPrivacy 79 | 80 | function __handleChecked() { 81 | column.checkItem(Translator.NoPrivacy); 82 | } 83 | } 84 | RadioButton { 85 | id: errorsOnlyOption 86 | text: Privacy.errorsOnlyText 87 | checked: translator.privacyLevel == Translator.ErrorsOnlyPrivacy 88 | 89 | function __handleChecked() { 90 | column.checkItem(Translator.ErrorsOnlyPrivacy); 91 | } 92 | } 93 | RadioButton { 94 | id: maxPrivacyOption 95 | text: Privacy.maxPrivacyText 96 | checked: translator.privacyLevel == Translator.MaximumPrivacy 97 | 98 | function __handleChecked() { 99 | column.checkItem(Translator.MaximumPrivacy); 100 | } 101 | } 102 | 103 | Label { 104 | text: Privacy.details 105 | width: parent.width 106 | wrapMode: Text.WordWrap 107 | 108 | onLinkActivated: { 109 | Qt.openUrlExternally(link); 110 | } 111 | } 112 | } 113 | }, 114 | ScrollDecorator { 115 | flickableItem: scrollArea 116 | } 117 | ] 118 | 119 | onAccepted: { 120 | translator.privacyLevel = column.selectedOption; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /qml/harmattan/SettingsSwitch.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | import "constants.js" as UI 26 | 27 | Item { 28 | id: root 29 | 30 | property alias title: titleLabel.text 31 | property alias description: descriptionLabel.text 32 | property alias checked: toggle.checked 33 | 34 | height: childrenRect.height 35 | anchors { 36 | left: parent.left 37 | right: parent.right 38 | leftMargin: UI.MARGIN_XLARGE 39 | rightMargin: UI.MARGIN_XLARGE 40 | } 41 | 42 | Column { 43 | id: labels 44 | 45 | anchors { 46 | left: parent.left 47 | right: toggle.left 48 | rightMargin: 8 /*UI.PADDING_LARGE*/ 49 | } 50 | 51 | Label { 52 | id: titleLabel 53 | color: theme.inverted ? UI.LIST_TITLE_COLOR_INVERTED 54 | : UI.LIST_TITLE_COLOR 55 | font { 56 | weight: Font.Bold 57 | pixelSize: UI.LIST_TILE_SIZE 58 | } 59 | anchors { 60 | left: parent.left 61 | right: parent.right 62 | } 63 | } 64 | Label { 65 | id: descriptionLabel 66 | color: theme.inverted ? UI.LIST_SUBTITLE_COLOR_INVERTED 67 | : UI.LIST_SUBTITLE_COLOR 68 | font { 69 | weight: UI.LIST_SUBTILE_SIZE 70 | pixelSize: Font.Light 71 | } 72 | anchors { 73 | left: parent.left 74 | right: parent.right 75 | } 76 | } 77 | } 78 | Switch { 79 | id: toggle 80 | 81 | anchors { 82 | right: parent.right 83 | verticalCenter: labels.verticalCenter 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /qml/harmattan/TranslationTextAreaPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.meego 1.1 25 | 26 | Page { 27 | id: root 28 | 29 | TextArea { 30 | id: translation 31 | 32 | text: translator.translatedText 33 | readOnly: true 34 | anchors.fill: parent 35 | } 36 | 37 | tools: ToolBarLayout { 38 | ToolIcon { 39 | iconId: "toolbar-back" 40 | onClicked: { 41 | pageStack.pop(); 42 | } 43 | } 44 | ToolButton { 45 | property bool hasSelection: translation.selectionStart 46 | != translation.selectionEnd 47 | text: hasSelection ? qsTr("Copy selection") : qsTr("Copy all") 48 | enabled: translation.text != "" 49 | onClicked: { 50 | if (hasSelection) 51 | clipboard.insert(translation.selectedText); 52 | else 53 | clipboard.insert(translation.text); 54 | } 55 | } 56 | Item { 57 | width: UiConstants.DefaultMargin 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /qml/harmattan/constants.js: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) 6 | ** 7 | ** This file is part of the Qt Components project. 8 | ** 9 | ** $QT_BEGIN_LICENSE:BSD$ 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | .pragma library 42 | 43 | /* Margins */ 44 | var INDENT_DEFAULT = 16; 45 | var CORNER_MARGINS = 22; 46 | var MARGIN_DEFAULT = 0; 47 | var MARGIN_XLARGE = 16; 48 | 49 | // ListDelegate 50 | var LIST_ITEM_MARGIN = 18 51 | var LIST_ITEM_SPACING = 18 52 | var LIST_ITEM_HEIGHT = 88 53 | var LIST_ICON_SIZE = 64 54 | var LIST_TILE_SIZE = 26 55 | var LIST_TITLE_COLOR = "#282828" 56 | var LIST_TITLE_COLOR_INVERTED = "#ffffff" 57 | var LIST_SUBTILE_SIZE = 22 58 | var LIST_SUBTITLE_COLOR = "#505050" 59 | var LIST_SUBTITLE_COLOR_INVERTED = "#d2d2d2" 60 | 61 | /* Font properties */ 62 | var FONT_FAMILY = "Nokia Pure"; 63 | var FONT_FAMILY_BOLD = "Nokia Pure Bold"; 64 | var FONT_FAMILY_LIGHT = "Nokia Pure Light"; 65 | var FONT_DEFAULT_SIZE = 24; 66 | var FONT_LIGHT_SIZE = 22; 67 | 68 | /* TUMBLER properties */ 69 | var TUMBLER_COLOR_TEXT = "#FFFFFF"; 70 | var TUMBLER_COLOR_LABEL = "#8C8C8C"; 71 | var TUMBLER_COLOR = "#000000"; 72 | var TUMBLER_OPACITY_FULL = 1.0; 73 | var TUMBLER_OPACITY = 0.4; 74 | var TUMBLER_OPACITY_LOW = 0.1; 75 | var TUMBLER_FLICK_VELOCITY = 700; 76 | var TUMBLER_ROW_HEIGHT = 64; 77 | var TUMBLER_LABEL_HEIGHT = 54; 78 | var TUMBLER_MARGIN = 16; 79 | var TUMBLER_BORDER_MARGIN = 1; 80 | var TUMBLER_WIDTH = 344; 81 | var TUMBLER_HEIGHT_PORTRAIT = 256; 82 | var TUMBLER_HEIGHT_LANDSCAPE = 192; 83 | 84 | /* Button styles */ 85 | // Normal 86 | var COLOR_BUTTON_FOREGROUND = "#191919"; // Text color 87 | var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed 88 | var COLOR_BUTTON_DISABLED_FOREGROUND = "#b2b2b4"; // Disabled 89 | // Inverted 90 | var COLOR_BUTTON_INVERTED_FOREGROUND = "#FFFFFF"; 91 | var COLOR_BUTTON_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed 92 | var COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND = "#f5f5f5"; // Disabled 93 | 94 | var SIZE_BUTTON = 51; 95 | var SIZE_SMALL_BUTTON = 43; 96 | var WIDTH_SMALL_BUTTON = 122; 97 | var WIDTH_TUMBLER_BUTTON = 222; 98 | 99 | var FONT_BOLD_BUTTON = true; 100 | 101 | var INFO_BANNER_OPACITY = 0.9 102 | var INFO_BANNER_LETTER_SPACING = -1.2 103 | -------------------------------------------------------------------------------- /qml/harmattan/icons/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/harmattan/icons/empty.png -------------------------------------------------------------------------------- /qml/harmattan/icons/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/harmattan/icons/expand.png -------------------------------------------------------------------------------- /qml/harmattan/icons/expand_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/harmattan/icons/expand_inverted.png -------------------------------------------------------------------------------- /qml/harmattan/main.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import com.nokia.meego 1.1 24 | import com.nokia.extras 1.1 25 | 26 | PageStackWindow { 27 | id: appWindow 28 | 29 | initialPage: MainPage {} 30 | 31 | onOrientationChangeFinished: { 32 | showStatusBar = inPortrait; 33 | } 34 | 35 | InfoBanner { 36 | id: banner 37 | y: 36 /* StatusBar height */ + 8 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /qml/privacy.js: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | .pragma library 24 | 25 | var notice = qsTranslate("PrivacyNoticePage", 26 | "Would you like to help improve %1 by enabling application analytics?") 27 | .arg("TAO Translator"); 28 | 29 | var noPrivacyText = qsTranslate("PrivacyNoticePage", "Yes, enable full analytics"); 30 | var errorsOnlyText = qsTranslate("PrivacyNoticePage", "Enable only error reporting"); 31 | var maxPrivacyText = qsTranslate("PrivacyNoticePage", "No, I don't want to help"); 32 | 33 | var details = 34 | qsTranslate("PrivacyNoticePage", 35 | "

%1 contains application analytics functionality that can collect information about" 36 | + " actions performed in the application, application errors, and some information" 37 | + " about your device. This information is processed by a third party analytics" 38 | + " service, Amplitude Analytics. No personally identifiable" 39 | + " information is sent. Collected information will be used solely for the purpose of" 40 | + " improving %1, fixing errors, and analysing application usage.

\n" 41 | + "

Please read %1 Privacy Policy for full information about what" 42 | + " data is sent and when. You can also consult End User Information section of Amplitude Analytics Privacy Policy to see how they deal with the" 44 | + " data that we send to them.

") 45 | .arg("TAO Translator") 46 | .arg("https://github.com/leppa/taot/wiki/Privacy-Policy") 47 | .arg("https://amplitude.com/") 48 | .arg("https://amplitude.com/privacy"); 49 | -------------------------------------------------------------------------------- /qml/sailfish/AboutPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | import "about.js" as About 26 | 27 | Page { 28 | id: root 29 | 30 | allowedOrientations: Orientation.Portrait 31 | | Orientation.Landscape 32 | | Orientation.LandscapeInverted 33 | 34 | SilicaFlickable { 35 | id: scrollArea 36 | 37 | contentHeight: column.height 38 | anchors.fill: parent 39 | 40 | Column { 41 | id: column 42 | 43 | anchors { 44 | left: parent.left 45 | right: parent.right 46 | margins: Theme.paddingLarge 47 | } 48 | 49 | PageHeader { 50 | title: qsTr("About") 51 | } 52 | 53 | Label { 54 | width: parent.width 55 | text: "TAO Translator
v%1".arg(translator.version) 56 | color: Theme.highlightColor 57 | font.family: Theme.fontFamilyHeading 58 | } 59 | 60 | Label { 61 | text: About.aboutText 62 | wrapMode: Text.WordWrap 63 | width: parent.width 64 | font.pixelSize: Theme.fontSizeSmall 65 | 66 | onLinkActivated: { 67 | Qt.openUrlExternally(translator.urlDecode(link)); 68 | } 69 | } 70 | } 71 | 72 | VerticalScrollDecorator {} 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /qml/sailfish/AppCover.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | 26 | CoverBackground { 27 | id: root 28 | 29 | property bool swapped: false 30 | 31 | CoverPlaceholder { 32 | Label { 33 | text: root.swapped ? qsTr("From: %1").arg(translator.sourceLanguage.displayName) 34 | : qsTr("To: %1").arg(translator.targetLanguage.displayName) 35 | color: Theme.secondaryHighlightColor 36 | width: parent.width - 2 * Theme.paddingMedium 37 | horizontalAlignment: Text.AlignHCenter 38 | fontSizeMode: Text.Fit 39 | visible: translator.translatedText 40 | maximumLineCount: 2 41 | wrapMode: Text.Wrap 42 | font.pixelSize: Theme.fontSizeExtraSmall 43 | anchors { 44 | top: parent.top 45 | topMargin: Theme.paddingLarge 46 | horizontalCenter: parent.horizontalCenter 47 | } 48 | } 49 | 50 | text: translator.translatedText ? !root.swapped ? translator.translatedText 51 | : translator.sourceText 52 | : "TAO Translator" 53 | icon.source: translator.translatedText ? "" : Qt.resolvedUrl("icons/icon.png") 54 | } 55 | 56 | CoverActionList { 57 | enabled: translator.translatedText 58 | 59 | CoverAction { 60 | iconSource: Qt.resolvedUrl("icons/swap.png") 61 | 62 | onTriggered: { 63 | root.swapped = !root.swapped; 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /qml/sailfish/ExpandableLabel.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | 26 | MouseArea { 27 | property alias text: label.text 28 | property bool expanded: false 29 | property bool expandable: expanded || label.truncated 30 | 31 | height: visible ? implicitHeight : 0 32 | implicitHeight: childrenRect.height 33 | clip: true 34 | 35 | Label { 36 | id: label 37 | 38 | wrapMode: Text.Wrap 39 | elide: Text.ElideNone 40 | maximumLineCount: expanded ? undefined : 1 41 | font.pixelSize: Theme.fontSizeSmall 42 | anchors { 43 | left: parent.left 44 | right: parent.right 45 | } 46 | } 47 | 48 | OpacityRampEffect { 49 | sourceItem: label 50 | direction: OpacityRamp.TopToBottom 51 | offset: 0.5 52 | enabled: expandable && !expanded 53 | } 54 | 55 | Image { 56 | id: indicator 57 | 58 | source: Qt.resolvedUrl("icons/expand.png") 59 | rotation: expanded ? 180 : 0 60 | visible: expanded || (!expanded && expandable) 61 | height: visible ? implicitHeight : 0 62 | sourceSize { 63 | width: Theme.iconSizeSmall 64 | height: Theme.iconSizeSmall 65 | } 66 | anchors { 67 | top: label.bottom 68 | topMargin: -height / 4 69 | right: parent.right 70 | } 71 | 72 | Behavior on rotation { NumberAnimation {} } 73 | } 74 | 75 | Behavior on height { NumberAnimation {} } 76 | 77 | onTextChanged: { 78 | expanded = false; 79 | } 80 | 81 | onExpandableChanged: { 82 | if (!expandable && expanded) 83 | expanded = false; 84 | } 85 | 86 | onClicked: { 87 | if (!expandable) 88 | return; 89 | 90 | expanded = !expanded 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /qml/sailfish/InfoBanner.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | 26 | Rectangle { 27 | id: root 28 | 29 | function show(text) 30 | { 31 | label.text = text; 32 | anchors.bottomMargin = 0; 33 | timer.restart(); 34 | } 35 | 36 | color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity) 37 | height: childrenRect.height 38 | anchors { 39 | left: parent.left 40 | bottom: parent.bottom 41 | bottomMargin: -height 42 | right: parent.right 43 | } 44 | 45 | Behavior on anchors.bottomMargin { 46 | NumberAnimation { 47 | duration: 200 48 | easing.type: Easing.InOutQuad 49 | } 50 | } 51 | 52 | Timer { 53 | id: timer 54 | 55 | interval: 3000 56 | repeat: false 57 | onTriggered: { 58 | anchors.bottomMargin = -height; 59 | } 60 | } 61 | 62 | Label { 63 | id: label 64 | 65 | color: Theme.highlightColor 66 | height: implicitHeight + 2 * Theme.paddingMedium 67 | wrapMode: Text.Wrap 68 | verticalAlignment: Text.AlignVCenter 69 | horizontalAlignment: Text.AlignHCenter 70 | anchors { 71 | left: parent.left 72 | leftMargin: Theme.paddingMedium 73 | right: parent.right 74 | rightMargin: Theme.paddingMedium 75 | } 76 | } 77 | 78 | MouseArea { 79 | anchors.fill: parent 80 | 81 | onClicked: { 82 | timer.stop(); 83 | root.anchors.bottomMargin = -root.height; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /qml/sailfish/PickerPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | 26 | Page { 27 | id: root 28 | 29 | property string title 30 | property alias model: listView.model 31 | property alias currentIndex: listView.currentIndex 32 | 33 | signal selected(int index) 34 | 35 | allowedOrientations: Orientation.Portrait 36 | | Orientation.Landscape 37 | | Orientation.LandscapeInverted 38 | 39 | SilicaListView { 40 | id: listView 41 | anchors.fill: parent 42 | 43 | header: PageHeader { 44 | title: root.title 45 | } 46 | 47 | delegate: BackgroundItem { 48 | id: delegate 49 | 50 | Label { 51 | x: Theme.paddingLarge 52 | text: model.name 53 | color: delegate.highlighted 54 | || delegate.ListView.isCurrentItem ? Theme.highlightColor 55 | : Theme.primaryColor 56 | anchors.verticalCenter: parent.verticalCenter 57 | } 58 | 59 | onClicked: { 60 | root.selected(model.index); 61 | } 62 | } 63 | VerticalScrollDecorator {} 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /qml/sailfish/PrivacyNoticePage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | import harbour.taot 1.0 26 | import "privacy.js" as Privacy 27 | 28 | Dialog { 29 | id: root 30 | 31 | backNavigation: translator.privacyLevel != Translator.UndefinedPrivacy 32 | allowedOrientations: Orientation.Portrait 33 | | Orientation.Landscape 34 | | Orientation.LandscapeInverted 35 | 36 | SilicaFlickable { 37 | id: scrollArea 38 | 39 | contentHeight: column.height 40 | anchors.fill: parent 41 | 42 | Column { 43 | id: column 44 | 45 | property int selectedOption 46 | 47 | function checkItem(option) 48 | { 49 | noPrivacyOption.checked = option === Translator.NoPrivacy; 50 | errorsOnlyOption.checked = option === Translator.ErrorsOnlyPrivacy; 51 | maxPrivacyOption.checked = option === Translator.MaximumPrivacy; 52 | selectedOption = option; 53 | } 54 | 55 | anchors { 56 | left: parent.left 57 | right: parent.right 58 | } 59 | 60 | DialogHeader { 61 | title: qsTr("Privacy Notice") 62 | } 63 | 64 | Column { 65 | anchors { 66 | left: parent.left 67 | right: parent.right 68 | margins: Theme.paddingLarge 69 | } 70 | 71 | Label { 72 | text: Privacy.notice 73 | width: parent.width 74 | wrapMode: Text.WordWrap 75 | color: Theme.highlightColor 76 | font.family: Theme.fontFamilyHeading 77 | } 78 | 79 | TextSwitch { 80 | id: noPrivacyOption 81 | text: Privacy.noPrivacyText 82 | checked: translator.privacyLevel == Translator.NoPrivacy 83 | || translator.privacyLevel == Translator.UndefinedPrivacy 84 | automaticCheck: false 85 | 86 | onClicked: { 87 | column.checkItem(Translator.NoPrivacy); 88 | } 89 | } 90 | TextSwitch { 91 | id: errorsOnlyOption 92 | text: Privacy.errorsOnlyText 93 | checked: translator.privacyLevel == Translator.ErrorsOnlyPrivacy 94 | automaticCheck: false 95 | 96 | onClicked: { 97 | column.checkItem(Translator.ErrorsOnlyPrivacy); 98 | } 99 | } 100 | TextSwitch { 101 | id: maxPrivacyOption 102 | text: Privacy.maxPrivacyText 103 | checked: translator.privacyLevel == Translator.MaximumPrivacy 104 | automaticCheck: false 105 | 106 | onClicked: { 107 | column.checkItem(Translator.MaximumPrivacy); 108 | } 109 | } 110 | 111 | Label { 112 | text: Privacy.details 113 | width: parent.width 114 | wrapMode: Text.WordWrap 115 | font.pixelSize: Theme.fontSizeExtraSmall 116 | 117 | onLinkActivated: { 118 | Qt.openUrlExternally(link); 119 | } 120 | } 121 | } 122 | } 123 | 124 | VerticalScrollDecorator {} 125 | } 126 | 127 | onAccepted: { 128 | translator.privacyLevel = column.selectedOption; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /qml/sailfish/SettingsPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | import harbour.taot 1.0 26 | 27 | Page { 28 | id: page 29 | 30 | allowedOrientations: Orientation.Portrait 31 | | Orientation.Landscape 32 | | Orientation.LandscapeInverted 33 | 34 | SilicaFlickable { 35 | contentHeight: column.height + Theme.paddingMedium 36 | anchors.fill: parent 37 | 38 | Column { 39 | id: column 40 | 41 | spacing: Theme.paddingMedium 42 | anchors { 43 | left: parent.left 44 | right: parent.right 45 | } 46 | 47 | PageHeader { 48 | title: qsTr("%1 Settings").arg("TAO Translator") 49 | } 50 | 51 | ComboBox { 52 | id: languageCombo 53 | 54 | label: qsTr("Interface Language") 55 | currentIndex: l10n.currentIndex 56 | menu: ContextMenu { 57 | Repeater { 58 | model: l10n 59 | 60 | MenuItem { 61 | text: model.name 62 | } 63 | } 64 | } 65 | 66 | onCurrentIndexChanged: { 67 | l10n.currentLanguage = l10n.get(currentIndex).language; 68 | } 69 | } 70 | 71 | TextSwitch { 72 | text: qsTr("Translate on Enter Press") 73 | description: qsTr("Only one line of text is supported in this mode") 74 | checked: translateOnEnter 75 | 76 | onCheckedChanged: { 77 | translateOnEnter = checked; 78 | } 79 | } 80 | 81 | TextSwitch { 82 | text: qsTr("Paste'n'Translate") 83 | description: qsTr("Automatically start translation after inserting text with" 84 | + " Paste button") 85 | checked: translateOnPaste 86 | 87 | onCheckedChanged: { 88 | translateOnPaste = checked; 89 | } 90 | } 91 | 92 | Button { 93 | text: qsTr("Privacy Settings") 94 | visible: analytics_enabled 95 | anchors { 96 | horizontalCenter: parent.horizontalCenter 97 | } 98 | 99 | onClicked: { 100 | pageStack.push(privacyNoticePage); 101 | } 102 | } 103 | } 104 | 105 | VerticalScrollDecorator {} 106 | } 107 | 108 | L10nModel { 109 | id: l10n 110 | 111 | onCurrentLanguageChanged: { 112 | banner.show(qsTr("Please, restart the application to apply this setting.")); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /qml/sailfish/icons/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/sailfish/icons/expand.png -------------------------------------------------------------------------------- /qml/sailfish/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/sailfish/icons/icon.png -------------------------------------------------------------------------------- /qml/sailfish/icons/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/sailfish/icons/swap.png -------------------------------------------------------------------------------- /qml/sailfish/main.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 2.0 24 | import Sailfish.Silica 1.0 25 | import harbour.taot 1.0 26 | 27 | ApplicationWindow { 28 | initialPage: Component { 29 | MainPage {} 30 | } 31 | 32 | InfoBanner { 33 | id: banner 34 | } 35 | 36 | Translator { 37 | id: translator 38 | 39 | onError: { 40 | banner.show(errorString); 41 | } 42 | onInfo: { 43 | banner.show(infoString); 44 | } 45 | } 46 | 47 | cover: AppCover {} 48 | } 49 | -------------------------------------------------------------------------------- /qml/symbian/AboutPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.symbian 1.1 25 | import "about.js" as About 26 | 27 | Page { 28 | id: root 29 | 30 | property bool platformInverted: false 31 | 32 | Header { 33 | id: header 34 | text: "TAO Translator" 35 | } 36 | 37 | Flickable { 38 | id: scrollArea 39 | 40 | contentHeight: column.height + 2 * platformStyle.paddingMedium 41 | anchors { 42 | top: header.bottom 43 | left: parent.left 44 | bottom: parent.bottom 45 | right: parent.right 46 | } 47 | 48 | Column { 49 | id: column 50 | 51 | spacing: platformStyle.paddingMedium 52 | anchors { 53 | top: parent.top 54 | left: parent.left 55 | right: parent.right 56 | margins: platformStyle.paddingMedium 57 | } 58 | 59 | Label { 60 | width: parent.width 61 | text: qsTr("Version: %1").arg(translator.version) 62 | platformInverted: root.platformInverted 63 | font.pixelSize: platformStyle.fontSizeLarge 64 | } 65 | 66 | Label { 67 | text: About.aboutText 68 | wrapMode: Text.WordWrap 69 | width: parent.width 70 | platformInverted: root.platformInverted 71 | 72 | onLinkActivated: { 73 | Qt.openUrlExternally(link); 74 | } 75 | } 76 | } 77 | } 78 | 79 | ScrollDecorator { 80 | flickableItem: scrollArea 81 | } 82 | 83 | tools: ToolBarLayout { 84 | ToolButton { 85 | iconSource: "toolbar-back" 86 | platformInverted: root.platformInverted 87 | onClicked: pageStack.pop(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /qml/symbian/ExpandableLabel.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.symbian 1.1 25 | 26 | MouseArea { 27 | id: root 28 | 29 | property string text 30 | property bool expanded: false 31 | property bool expandable: controlLabel.width > label.width 32 | property bool platformInverted: false 33 | 34 | height: visible ? implicitHeight : 0 35 | implicitHeight: childrenRect.height 36 | clip: true 37 | 38 | Label { 39 | id: label 40 | 41 | text: expanded ? root.text : root.text.replace(/\r|\n/g, " ") 42 | wrapMode: expanded ? Text.Wrap : Text.NoWrap 43 | elide: expanded ? Text.ElideNone : Text.ElideRight 44 | platformInverted: root.platformInverted 45 | anchors { 46 | left: parent.left 47 | right: parent.right 48 | leftMargin: platformStyle.borderSizeMedium / 2 49 | rightMargin: platformStyle.borderSizeMedium / 2 50 | } 51 | } 52 | 53 | Image { 54 | id: indicator 55 | 56 | source: Qt.resolvedUrl(root.platformInverted ? "icons/expand_inverted.png" 57 | : "icons/expand.png") 58 | rotation: expanded ? 180 : 0 59 | visible: expanded || (!expanded && expandable) 60 | height: visible ? implicitHeight : 0 61 | sourceSize { 62 | width: platformStyle.graphicSizeTiny 63 | height: platformStyle.graphicSizeTiny 64 | } 65 | anchors { 66 | top: label.bottom 67 | topMargin: -height / 4 68 | right: parent.right 69 | rightMargin: platformStyle.borderSizeMedium / 2 70 | } 71 | 72 | Behavior on rotation { NumberAnimation {} } 73 | } 74 | 75 | Behavior on height { NumberAnimation {} } 76 | 77 | // HACK: Text::truncated property 78 | // doesn't seem to work properly, 79 | // so this hack is used to detect, 80 | // whether text fits on one line. 81 | property Label controlLabel: Label { 82 | text: root.text.replace(/\r|\n/g, "") 83 | maximumLineCount: 1 84 | visible: false 85 | } 86 | 87 | onTextChanged: { 88 | expanded = false; 89 | } 90 | 91 | onExpandableChanged: { 92 | if (!expandable) 93 | expanded = false; 94 | } 95 | 96 | onClicked: { 97 | if (!expandable) 98 | return; 99 | 100 | expanded = !expanded 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /qml/symbian/Header.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.symbian 1.1 25 | 26 | Rectangle { 27 | id: header 28 | 29 | property alias text: label.text 30 | 31 | z: 100 32 | height: platformStyle.graphicSizeMedium 33 | gradient: Gradient { 34 | GradientStop { 35 | position: 0.00 36 | color: platformStyle.colorNormalLink 37 | } 38 | GradientStop { 39 | position: 1.0 40 | color: Qt.darker(platformStyle.colorNormalLink) 41 | } 42 | } 43 | anchors { 44 | left: parent.left 45 | right: parent.right 46 | } 47 | 48 | Label { 49 | id: label 50 | 51 | color: "white" 52 | font.pixelSize: platformStyle.fontSizeLarge 53 | anchors { 54 | verticalCenter: parent.verticalCenter 55 | left: parent.left 56 | leftMargin: platformStyle.paddingMedium 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /qml/symbian/SettingsSwitch.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.symbian 1.1 25 | 26 | Item { 27 | id: root 28 | 29 | property alias title: titleLabel.text 30 | property alias description: descriptionLabel.text 31 | property alias checked: toggle.checked 32 | property bool platformInverted: false 33 | 34 | height: childrenRect.height 35 | anchors { 36 | left: parent.left 37 | right: parent.right 38 | leftMargin: platformStyle.paddingLarge 39 | rightMargin: platformStyle.paddingLarge 40 | } 41 | 42 | Column { 43 | id: labels 44 | 45 | anchors { 46 | left: parent.left 47 | right: toggle.left 48 | rightMargin: platformStyle.paddingSmall 49 | } 50 | 51 | ListItemText { 52 | id: titleLabel 53 | 54 | role: "Title" 55 | elide: Text.ElideNone 56 | wrapMode: Text.WordWrap 57 | platformInverted: root.platformInverted 58 | anchors { 59 | left: parent.left 60 | right: parent.right 61 | } 62 | } 63 | ListItemText { 64 | id: descriptionLabel 65 | 66 | role: "SubTitle" 67 | elide: Text.ElideNone 68 | wrapMode: Text.WordWrap 69 | platformInverted: root.platformInverted 70 | anchors { 71 | left: parent.left 72 | right: parent.right 73 | } 74 | } 75 | } 76 | Switch { 77 | id: toggle 78 | 79 | platformInverted: root.platformInverted 80 | anchors { 81 | right: parent.right 82 | verticalCenter: labels.verticalCenter 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /qml/symbian/TranslationTextAreaPage.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import QtQuick 1.1 24 | import com.nokia.symbian 1.1 25 | 26 | Page { 27 | id: root 28 | 29 | property bool platformInverted: false 30 | 31 | TextArea { 32 | id: translation 33 | 34 | text: translator.translatedText 35 | readOnly: true 36 | anchors.fill: parent 37 | platformInverted: root.platformInverted 38 | } 39 | 40 | tools: ToolBarLayout { 41 | ToolButton { 42 | iconSource: "toolbar-back" 43 | platformInverted: root.platformInverted 44 | onClicked: { 45 | pageStack.pop(); 46 | } 47 | } 48 | ToolButton { 49 | property bool hasSelection: translation.selectionStart 50 | != translation.selectionEnd 51 | text: hasSelection ? qsTr("Copy selection") : qsTr("Copy all") 52 | enabled: translation.text != "" 53 | platformInverted: root.platformInverted 54 | onClicked: { 55 | if (hasSelection) 56 | clipboard.insert(translation.selectedText); 57 | else 58 | clipboard.insert(translation.text); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /qml/symbian/icons/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /qml/symbian/icons/close_inverted.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /qml/symbian/icons/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/symbian/icons/empty.png -------------------------------------------------------------------------------- /qml/symbian/icons/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/symbian/icons/expand.png -------------------------------------------------------------------------------- /qml/symbian/icons/expand_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/symbian/icons/expand_inverted.png -------------------------------------------------------------------------------- /qml/symbian/icons/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/symbian/icons/swap.png -------------------------------------------------------------------------------- /qml/symbian/icons/swap_inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/qml/symbian/icons/swap_inverted.png -------------------------------------------------------------------------------- /qml/symbian/main.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | import com.nokia.symbian 1.1 24 | import com.nokia.extras 1.1 25 | 26 | PageStackWindow { 27 | id: appWindow 28 | 29 | platformSoftwareInputPanelEnabled: true 30 | initialPage: MainPage {} 31 | 32 | onOrientationChangeFinished: { 33 | showStatusBar = inPortrait; 34 | } 35 | 36 | InfoBanner { id: banner } 37 | } 38 | -------------------------------------------------------------------------------- /qmlapplicationviewer/qmlapplicationviewer.h: -------------------------------------------------------------------------------- 1 | // checksum 0xc67a version 0x90018 2 | /* 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. 4 | QmlApplicationViewer is a convenience class containing mobile device specific 5 | code such as screen orientation handling. Also QML paths and debugging are 6 | handled here. 7 | It is recommended not to modify this file, since newer versions of Qt Creator 8 | may offer an updated version of it. 9 | */ 10 | 11 | #ifndef QMLAPPLICATIONVIEWER_H 12 | #define QMLAPPLICATIONVIEWER_H 13 | 14 | #include 15 | 16 | class QmlApplicationViewer : public QDeclarativeView 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | enum ScreenOrientation { 22 | ScreenOrientationLockPortrait, 23 | ScreenOrientationLockLandscape, 24 | ScreenOrientationAuto 25 | }; 26 | 27 | explicit QmlApplicationViewer(QWidget *parent = 0); 28 | virtual ~QmlApplicationViewer(); 29 | 30 | static QmlApplicationViewer *create(); 31 | 32 | void setMainQmlFile(const QString &file); 33 | void addImportPath(const QString &path); 34 | 35 | // Note that this will only have an effect on Fremantle. 36 | void setOrientation(ScreenOrientation orientation); 37 | 38 | void showExpanded(); 39 | 40 | private: 41 | class QmlApplicationViewerPrivate *d; 42 | }; 43 | 44 | QApplication *createApplication(int &argc, char **argv); 45 | 46 | #endif // QMLAPPLICATIONVIEWER_H 47 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/README: -------------------------------------------------------------------------------- 1 | The Debian Package taot 2 | ---------------------------- 3 | 4 | Comments regarding the Package 5 | 6 | -- Oleksii Serdiuk Wed, 30 Oct 2013 21:12:15 +0100 7 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Oleksii Serdiuk 2 | on Wed, 30 Oct 2013 21:09:27 +0100. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | Oleksii Serdiuk 9 | 10 | Copyright: 11 | 12 | Copyright (C) 2013-2018 Oleksii Serdiuk 13 | 14 | License: 15 | 16 | This package is free software; you can redistribute it and/or modify 17 | it under the terms of the GNU General Public License as published by 18 | the Free Software Foundation; either version 2 of the License, or 19 | (at your option) any later version. 20 | 21 | This package is distributed in the hope that it will be useful, 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | GNU General Public License for more details. 25 | 26 | You should have received a copy of the GNU General Public License 27 | along with this package; if not, write to the Free Software 28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 29 | 30 | On Debian systems, the complete text of the GNU General 31 | Public License can be found in `/usr/share/common-licenses/GPL'. 32 | 33 | The Debian packaging is (C) 2013-2018, Oleksii Serdiuk 34 | and is licensed under the GPL, see above. 35 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/manifest.aegis: -------------------------------------------------------------------------------- 1 | AutoGenerateAegisFile 2 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 43 | 44 | 45 | 48 | 49 | 50 | 53 | 54 | 55 | 58 | 59 | 60 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | configure-stamp: 18 | dh_testdir 19 | # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator 20 | 21 | touch configure-stamp 22 | 23 | 24 | build: build-stamp 25 | 26 | build-stamp: configure-stamp 27 | dh_testdir 28 | 29 | # Add here commands to compile the package. 30 | # $(MAKE) # Uncomment this line for use without Qt Creator 31 | #docbook-to-man debian/taot.sgml > taot.1 32 | 33 | touch $@ 34 | 35 | clean: 36 | dh_testdir 37 | dh_testroot 38 | rm -f build-stamp configure-stamp 39 | 40 | # Add here commands to clean up after the build process. 41 | $(MAKE) clean 42 | 43 | dh_clean 44 | 45 | install: build 46 | dh_testdir 47 | dh_testroot 48 | dh_clean -k 49 | dh_installdirs 50 | 51 | # Add here commands to install the package into debian/taot. 52 | $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/taot install 53 | 54 | 55 | # Build architecture-independent files here. 56 | binary-indep: build install 57 | # We have nothing to do by default. 58 | 59 | # Build architecture-dependent files here. 60 | binary-arch: build install 61 | dh_testdir 62 | dh_testroot 63 | dh_installchangelogs 64 | dh_installdocs 65 | dh_installexamples 66 | # dh_install 67 | # dh_installmenu 68 | # dh_installdebconf 69 | # dh_installlogrotate 70 | # dh_installemacsen 71 | # dh_installpam 72 | # dh_installmime 73 | # dh_python 74 | # dh_installinit 75 | # dh_installcron 76 | # dh_installinfo 77 | dh_installman 78 | dh_link 79 | dh_strip 80 | dh_compress 81 | dh_fixperms 82 | # dh_perl 83 | # dh_makeshlibs 84 | dh_installdeb 85 | # dh_shlibdeps # Uncomment this line for use without Qt Creator 86 | dh_gencontrol 87 | dh_md5sums 88 | dh_builddeb 89 | 90 | binary: binary-indep binary-arch 91 | .PHONY: build clean binary-indep binary-arch binary install configure 92 | -------------------------------------------------------------------------------- /qtc_packaging/taot_harmattan.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Version=1.0 4 | Type=Application 5 | Terminal=false 6 | Name=TAO Translator 7 | Name[zh]=翻译大师OL 8 | Exec=/usr/bin/invoker --type=d -s /opt/taot/bin/taot 9 | Icon=/usr/share/icons/hicolor/80x80/apps/taot80.png 10 | X-Window-Icon= 11 | X-HildonDesk-ShowInToolbar=true 12 | X-Osso-Type=application/x-executable 13 | -------------------------------------------------------------------------------- /rpm/harbour-taot.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | X-Nemo-Application-Type=silica-qt5 4 | Name=TAO Translator 5 | Icon=harbour-taot 6 | Exec=harbour-taot 7 | 8 | -------------------------------------------------------------------------------- /rpm/harbour-taot.spec: -------------------------------------------------------------------------------- 1 | # 2 | # Do NOT Edit the Auto-generated Part! 3 | # Generated by: spectacle version 0.27 4 | # 5 | 6 | Name: harbour-taot 7 | 8 | # >> macros 9 | %define __requires_exclude ^libQt5SystemInfo.*$ 10 | %define __provides_exclude_from ^%{_datadir}/.*$ 11 | # << macros 12 | -------------------------------------------------------------------------------- /rpm/harbour-taot.yaml: -------------------------------------------------------------------------------- 1 | Name: harbour-taot 2 | Summary: Online Translator with some advanced features 3 | Version: 1.3.5 4 | Release: 1 5 | Group: Qt/Qt 6 | URL: https://github.com/leppa/taot 7 | License: 'GPLv2' 8 | Sources: 9 | - '%{name}-%{version}.tar.bz2' 10 | 11 | Description: |- 12 | TAO Translator uses online translation services to provide translations. 13 | 14 | Currently supported services: 15 | * Google Translate - supports translation, transliteration for most 16 | non-latin scripts, language detection, and dictionary with reverse 17 | translations for single words. 18 | * Microsoft Translator (a.k.a. Bing Translator) - supports translation 19 | and language detection. 20 | * Yandex.Translate - supports translation and language detection. 21 | * Yandex.Dictionaries - supports dictionary with transcription for some 22 | languages, synonyms, and reverse translations. 23 | 24 | More services might be added in future. 25 | 26 | Configure: none 27 | Builder: qtc5 28 | 29 | PkgConfigBR: 30 | - sailfishapp >= 1.0.2 31 | - Qt5Quick 32 | - Qt5Qml 33 | - Qt5Core 34 | - Qt5SystemInfo 35 | 36 | Requires: 37 | - sailfishsilica-qt5 >= 0.10.9 38 | 39 | Files: 40 | - '%{_bindir}' 41 | - '%attr(644,-,-) %{_datadir}/%{name}/qml' 42 | - '%dir %attr(755,-,-) %{_datadir}/%{name}/qml' 43 | - '%dir %attr(755,-,-) %{_datadir}/%{name}/qml/icons' 44 | - '%{_datadir}/%{name}/lib' 45 | - '%attr(644,-,-) %{_datadir}/applications/%{name}.desktop' 46 | - '%attr(644,-,-) %{_datadir}/icons/hicolor/*/apps/%{name}.png' 47 | -------------------------------------------------------------------------------- /rpm/icons/108/harbour-taot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/rpm/icons/108/harbour-taot.png -------------------------------------------------------------------------------- /rpm/icons/128/harbour-taot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/rpm/icons/128/harbour-taot.png -------------------------------------------------------------------------------- /rpm/icons/86/harbour-taot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/rpm/icons/86/harbour-taot.png -------------------------------------------------------------------------------- /rpm/lib/arm/libQt5SystemInfo.so.5: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c44751c32457b23c3f274ed6f4b27e6421004ac148e2f968fdf0487f577aa230 3 | size 3960204 4 | -------------------------------------------------------------------------------- /rpm/lib/i386/libQt5SystemInfo.so.5: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:dc2a3a0ca603603ea181abd37d03e02732edfeffc4871a263acdc5c65479254b 3 | size 3928240 4 | -------------------------------------------------------------------------------- /src/bb10/clipboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "clipboard.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #define CLIPBOARD_PATH "/accounts/1000/clipboard" 30 | #define CLIPBOARD_FILE_PATH CLIPBOARD_PATH"/text.plain" 31 | 32 | Clipboard::Clipboard(QObject *parent) 33 | : QObject(parent) 34 | , m_clipboard(new bb::system::Clipboard(this)) 35 | , m_text(QString::fromUtf8(m_clipboard->value("text/plain"))) 36 | , m_clipboardWatcher(new QFileSystemWatcher(this)) 37 | { 38 | connect(m_clipboardWatcher, SIGNAL(fileChanged(QString)), SLOT(onFileChanged(QString))); 39 | connect(m_clipboardWatcher, 40 | SIGNAL(directoryChanged(QString)), 41 | SLOT(onDirectoryChanged(QString))); 42 | if (QFile::exists(CLIPBOARD_FILE_PATH)) 43 | m_clipboardWatcher->addPath(CLIPBOARD_FILE_PATH); 44 | else 45 | m_clipboardWatcher->addPath(CLIPBOARD_PATH); 46 | } 47 | 48 | bool Clipboard::clear() 49 | { 50 | return m_clipboard->clear(); 51 | } 52 | 53 | bool Clipboard::isEmpty() const 54 | { 55 | return m_text.isEmpty(); 56 | } 57 | 58 | QString Clipboard::text() const 59 | { 60 | return m_text; 61 | } 62 | 63 | bool Clipboard::insert(const QString &text) 64 | { 65 | m_clipboard->clear(); 66 | return m_clipboard->insert("text/plain", text.toUtf8()); 67 | } 68 | 69 | void Clipboard::onDirectoryChanged(const QString &) 70 | { 71 | addClipboardFileWatcher(); 72 | } 73 | 74 | void Clipboard::onFileChanged(const QString &) 75 | { 76 | updateClipboardText(); 77 | } 78 | 79 | void Clipboard::addClipboardFileWatcher() 80 | { 81 | if (QFile::exists(CLIPBOARD_FILE_PATH)) { 82 | m_clipboardWatcher->removePath(CLIPBOARD_PATH); 83 | m_clipboardWatcher->addPath(CLIPBOARD_FILE_PATH); 84 | updateClipboardText(); 85 | } 86 | } 87 | 88 | void Clipboard::updateClipboardText() 89 | { 90 | const QString text = QString::fromUtf8(m_clipboard->value("text/plain")); 91 | if (m_text == text) 92 | return; 93 | 94 | m_text = text; 95 | emit textChanged(); 96 | } 97 | -------------------------------------------------------------------------------- /src/bb10/clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef CLIPBOARD_H 24 | #define CLIPBOARD_H 25 | 26 | #include 27 | #include 28 | 29 | class QFileSystemWatcher; 30 | namespace bb { namespace system { class Clipboard; } } 31 | class Clipboard: public QObject 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(QString text READ text WRITE insert NOTIFY textChanged) 35 | Q_PROPERTY(bool empty READ isEmpty NOTIFY textChanged) 36 | 37 | public: 38 | explicit Clipboard(QObject *parent = 0); 39 | bool isEmpty() const; 40 | 41 | public slots: 42 | bool clear(); 43 | QString text() const; 44 | bool insert(const QString &text); 45 | 46 | signals: 47 | void textChanged(); 48 | 49 | private slots: 50 | void onDirectoryChanged(const QString &path); 51 | void onFileChanged(const QString &path); 52 | 53 | private: 54 | bb::system::Clipboard *m_clipboard; 55 | QString m_text; 56 | QFileSystemWatcher *m_clipboardWatcher; 57 | 58 | void addClipboardFileWatcher(); 59 | void updateClipboardText(); 60 | }; 61 | 62 | Q_DECLARE_METATYPE(Clipboard *) 63 | 64 | #endif // CLIPBOARD_H 65 | -------------------------------------------------------------------------------- /src/bb10/dictionarymodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "dictionarymodel.h" 24 | 25 | #include "bb10/reversetranslationsmodel.h" 26 | 27 | DictionaryPos::DictionaryPos(const QString &pos, const QStringList &translations) 28 | : m_pos(pos) 29 | , m_translations(translations) 30 | , m_reverse(new ReverseTranslations) 31 | { 32 | // We can't delete m_reverse in destructor because when the object 33 | // is copied through copy constructor and original is deleted it 34 | // would invalidate m_reverse in both original and copied objects. 35 | // QSharedPointer takes care of this and deletes m_reverse only 36 | // when all copies of the object are deleted. 37 | ptr = QSharedPointer(m_reverse); 38 | } 39 | 40 | QString DictionaryPos::pos() const 41 | { 42 | return m_pos; 43 | } 44 | 45 | QString DictionaryPos::translations(const QString separator) const 46 | { 47 | return m_translations.join(separator); 48 | } 49 | 50 | QStringList &DictionaryPos::translations() 51 | { 52 | return m_translations; 53 | } 54 | 55 | ReverseTranslations *DictionaryPos::reverseTranslations() 56 | { 57 | return m_reverse; 58 | } 59 | 60 | DictionaryModel::DictionaryModel(QObject *parent) 61 | : bb::cascades::QMapListDataModel() 62 | { 63 | setParent(parent); 64 | } 65 | 66 | void DictionaryModel::append(DictionaryPos &pos) 67 | { 68 | QVariantMap map; 69 | map.insert("pos", pos.pos()); 70 | map.insert("translations", pos.translations(tr(", "))); 71 | map.insert("reverseTranslations", 72 | QVariant::fromValue(new ReverseTranslationsModel(pos.reverseTranslations(), this))); 73 | 74 | bb::cascades::QMapListDataModel::append(map); 75 | } 76 | -------------------------------------------------------------------------------- /src/bb10/dictionarymodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef DICTIONARYMODEL_H 24 | #define DICTIONARYMODEL_H 25 | 26 | #include 27 | 28 | class ReverseTranslations; 29 | class DictionaryPos 30 | { 31 | Q_DECLARE_TR_FUNCTIONS(DictionaryPos) 32 | 33 | public: 34 | DictionaryPos(const QString &pos, const QStringList &translations = QStringList()); 35 | 36 | QString pos() const; 37 | QString translations(const QString separator) const; 38 | QStringList &translations(); 39 | ReverseTranslations *reverseTranslations(); 40 | 41 | private: 42 | QString m_pos; 43 | QStringList m_translations; 44 | ReverseTranslations *m_reverse; 45 | QSharedPointer ptr; 46 | }; 47 | 48 | class DictionaryModel: public bb::cascades::QMapListDataModel 49 | { 50 | Q_OBJECT 51 | 52 | public: 53 | explicit DictionaryModel(QObject *parent = 0); 54 | 55 | void append(DictionaryPos &pos); 56 | }; 57 | Q_DECLARE_METATYPE(DictionaryModel *) 58 | 59 | #endif // DICTIONARYMODEL_H 60 | -------------------------------------------------------------------------------- /src/bb10/languagechangelistener.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2013 BlackBerry Limited. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "languagechangelistener.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | LanguageChangeListener::LanguageChangeListener(QObject *parent) 26 | : QObject(parent) 27 | { 28 | m_pLocaleHandler = new bb::cascades::LocaleHandler(this); 29 | connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), SLOT(onSystemLanguageChanged())); 30 | 31 | onSystemLanguageChanged(); 32 | } 33 | 34 | void LanguageChangeListener::onSystemLanguageChanged() 35 | { 36 | static QTranslator *qtTr = NULL; 37 | if (qtTr) { 38 | qApp->removeTranslator(qtTr); 39 | delete qtTr; 40 | } 41 | 42 | static QTranslator *tr = NULL; 43 | if (tr) { 44 | qApp->removeTranslator(tr); 45 | delete tr; 46 | } 47 | 48 | QString lc = QLocale().name(); 49 | QSettings settings(QCoreApplication::organizationName(), "taot"); 50 | if (settings.contains("UILanguage")) { 51 | const QString lang = settings.value("UILanguage").toString(); 52 | if (!lang.isEmpty()) 53 | lc = lang; 54 | } 55 | 56 | // Load Qt's translation 57 | qtTr = new QTranslator(this); 58 | if (qtTr->load("qt_" + lc, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) 59 | qApp->installTranslator(qtTr); 60 | 61 | // Load TAOT's translation 62 | tr = new QTranslator(this); 63 | if (tr->load("taot_" + lc, ":/l10n")) 64 | qApp->installTranslator(tr); 65 | } 66 | -------------------------------------------------------------------------------- /src/bb10/languagechangelistener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef LANGUAGECHANGELISTENER_H 24 | #define LANGUAGECHANGELISTENER_H 25 | 26 | #include 27 | 28 | namespace bb 29 | { 30 | namespace cascades 31 | { 32 | class Application; 33 | class LocaleHandler; 34 | } 35 | } 36 | 37 | class LanguageChangeListener: public QObject 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | LanguageChangeListener(QObject *parent); 43 | 44 | private slots: 45 | void onSystemLanguageChanged(); 46 | 47 | private: 48 | bb::cascades::LocaleHandler *m_pLocaleHandler; 49 | }; 50 | 51 | #endif // LANGUAGECHANGELISTENER_H 52 | -------------------------------------------------------------------------------- /src/bb10/repeater.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "repeater.h" 24 | 25 | #include 26 | #include 27 | 28 | using namespace bb::cascades; 29 | 30 | Repeater::Repeater(Container *parent) 31 | : CustomControl(parent) 32 | , m_model(NULL) 33 | , m_delegate(NULL) 34 | { 35 | setVisible(false); 36 | } 37 | 38 | DataModel *Repeater::model() const 39 | { 40 | return m_model; 41 | } 42 | 43 | void Repeater::setModel(DataModel *model) 44 | { 45 | if (m_model == model) 46 | return; 47 | 48 | clear(); 49 | if (m_model) 50 | m_model->disconnect(this); 51 | 52 | m_model = model; 53 | 54 | createDelegates(); 55 | connect(m_model, 56 | SIGNAL(itemAdded(QVariantList)), 57 | SLOT(onItemAddedRemovedOrUpdated(QVariantList))); 58 | connect(m_model, 59 | SIGNAL(itemRemoved(QVariantList)), 60 | SLOT(onItemAddedRemovedOrUpdated(QVariantList))); 61 | connect(m_model, 62 | SIGNAL(itemUpdated(QVariantList)), 63 | SLOT(onItemAddedRemovedOrUpdated(QVariantList))); 64 | connect(m_model, 65 | SIGNAL(itemsChanged(bb::cascades::DataModelChangeType::Type, 66 | QSharedPointer)), 67 | SLOT(onItemsChanged(bb::cascades::DataModelChangeType::Type, 68 | QSharedPointer))); 69 | 70 | emit modelChanged(); 71 | } 72 | 73 | QDeclarativeComponent* Repeater::delegate() const 74 | { 75 | return m_delegate; 76 | } 77 | 78 | void Repeater::setDelegate(QDeclarativeComponent *delegate) 79 | { 80 | if (m_delegate == delegate) 81 | return; 82 | 83 | clear(); 84 | m_delegate = delegate; 85 | createDelegates(); 86 | 87 | emit delegateChanged(); 88 | } 89 | 90 | void Repeater::onItemAddedRemovedOrUpdated(const QVariantList &) 91 | { 92 | clear(); 93 | createDelegates(); 94 | } 95 | 96 | void Repeater::onItemsChanged(DataModelChangeType::Type, QSharedPointer) 97 | { 98 | clear(); 99 | createDelegates(); 100 | } 101 | 102 | void Repeater::clear() 103 | { 104 | Container *container = qobject_cast(parent()); 105 | foreach (Control *control, m_controls) { 106 | container->remove(control); 107 | } 108 | 109 | qDeleteAll(m_controls); 110 | m_controls.clear(); 111 | } 112 | 113 | void Repeater::createDelegates() 114 | { 115 | if (!m_delegate || !m_model) 116 | return; 117 | 118 | Container *container = qobject_cast(parent()); 119 | const int pos = container->indexOf(this); 120 | 121 | for (int i = 0; i < m_model->childCount(QVariantList()); i++) { 122 | QDeclarativeContext *context = new QDeclarativeContext(m_delegate->creationContext(), this); 123 | 124 | QVariantList indexPath; 125 | indexPath.append(i); 126 | const QVariantMap map = m_model->data(indexPath).toMap(); 127 | foreach (const QString &key, map.keys()) { 128 | context->setContextProperty(key, map.value(key)); 129 | } 130 | 131 | Control *control = qobject_cast(m_delegate->create(context)); 132 | m_controls.append(control); 133 | container->insert(pos + i + 1, control); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/bb10/repeater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef REPEATER_H 24 | #define REPEATER_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace bb { 31 | namespace cascades { 32 | class Container; 33 | } 34 | } 35 | 36 | class Repeater: public bb::cascades::CustomControl 37 | { 38 | Q_OBJECT 39 | 40 | Q_PROPERTY(bb::cascades::DataModel *model READ model WRITE setModel NOTIFY modelChanged) 41 | Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) 42 | 43 | Q_CLASSINFO("DefaultProperty", "delegate") 44 | 45 | public: 46 | Repeater(bb::cascades::Container *parent = 0); 47 | 48 | bb::cascades::DataModel *model() const; 49 | void setModel(bb::cascades::DataModel *model); 50 | 51 | QDeclarativeComponent *delegate() const; 52 | void setDelegate(QDeclarativeComponent *delegate); 53 | 54 | signals: 55 | void modelChanged(); 56 | void delegateChanged(); 57 | 58 | private slots: 59 | void onItemAddedRemovedOrUpdated(const QVariantList &indexPath); 60 | void onItemsChanged(bb::cascades::DataModelChangeType::Type eChangeType, 61 | QSharedPointer indexMapper); 62 | 63 | private: 64 | void clear(); 65 | void createDelegates(); 66 | 67 | bb::cascades::DataModel *m_model; 68 | QDeclarativeComponent *m_delegate; 69 | QList m_controls; 70 | }; 71 | 72 | #endif // REPEATER_H 73 | -------------------------------------------------------------------------------- /src/bb10/reversetranslationsmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "bb10/reversetranslationsmodel.h" 24 | 25 | void ReverseTranslations::append(const QString &term, 26 | const QStringList &synonyms, 27 | const QStringList &translations) 28 | { 29 | QVariantMap map; 30 | map.insert("term", term); 31 | map.insert("synonyms", synonyms.join(tr(", "))); 32 | map.insert("translations", translations.join(tr(", "))); 33 | 34 | QList::append(map); 35 | } 36 | 37 | ReverseTranslationsModel::ReverseTranslationsModel(QList *list, QObject *parent) 38 | : bb::cascades::QMapListDataModel() 39 | { 40 | setParent(parent); 41 | append(*list); 42 | } 43 | -------------------------------------------------------------------------------- /src/bb10/reversetranslationsmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef REVERSETRANSLATIONSMODEL_H 24 | #define REVERSETRANSLATIONSMODEL_H 25 | 26 | #include 27 | 28 | class ReverseTranslations: public QList 29 | { 30 | Q_DECLARE_TR_FUNCTIONS(ReverseTranslationsModel) 31 | 32 | public: 33 | void append(const QString &term, const QStringList &synonyms, const QStringList &translations); 34 | }; 35 | 36 | class ReverseTranslationsModel: public bb::cascades::QMapListDataModel 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | ReverseTranslationsModel(QList *list, QObject *parent = NULL); 42 | }; 43 | Q_DECLARE_METATYPE(ReverseTranslationsModel *) 44 | 45 | #endif // REVERSETRANSLATIONSMODEL_H 46 | -------------------------------------------------------------------------------- /src/clipboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "clipboard.h" 24 | 25 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 26 | # include 27 | #else 28 | # include 29 | #endif 30 | 31 | #include 32 | 33 | Clipboard::Clipboard(QObject *parent) 34 | : QObject(parent) 35 | , m_text(qApp->clipboard()->text()) 36 | { 37 | connect(qApp->clipboard(), SIGNAL(changed(QClipboard::Mode)), 38 | this, SLOT(onChanged(QClipboard::Mode))); 39 | } 40 | 41 | bool Clipboard::isEmpty() const 42 | { 43 | return m_text.isEmpty(); 44 | } 45 | 46 | void Clipboard::clear() 47 | { 48 | qApp->clipboard()->clear(); 49 | } 50 | 51 | QString Clipboard::text() const 52 | { 53 | return m_text; 54 | } 55 | 56 | void Clipboard::insert(const QString &text) 57 | { 58 | qApp->clipboard()->setText(text); 59 | } 60 | 61 | void Clipboard::onChanged(QClipboard::Mode mode) 62 | { 63 | const QString text = qApp->clipboard()->text(); 64 | if (mode != QClipboard::Clipboard || m_text == text) 65 | return; 66 | 67 | m_text = text; 68 | emit textChanged(); 69 | } 70 | -------------------------------------------------------------------------------- /src/clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef CLIPBOARD_H 24 | #define CLIPBOARD_H 25 | 26 | #include 27 | #include 28 | 29 | class Clipboard: public QObject 30 | { 31 | Q_OBJECT 32 | Q_PROPERTY(QString text READ text WRITE insert NOTIFY textChanged) 33 | Q_PROPERTY(bool empty READ isEmpty NOTIFY textChanged) 34 | 35 | public: 36 | explicit Clipboard(QObject *parent = 0); 37 | bool isEmpty() const; 38 | 39 | public slots: 40 | void clear(); 41 | QString text() const; 42 | void insert(const QString &text); 43 | 44 | signals: 45 | void textChanged(); 46 | 47 | private slots: 48 | void onChanged(QClipboard::Mode mode = QClipboard::Clipboard); 49 | 50 | private: 51 | QString m_text; 52 | }; 53 | 54 | #endif // CLIPBOARD_H 55 | -------------------------------------------------------------------------------- /src/dictionarymodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "dictionarymodel.h" 24 | 25 | DictionaryPos::DictionaryPos(const QString &pos, const QStringList &translations) 26 | : m_pos(pos), m_translations(translations), m_reverse(new ReverseTranslationsModel()) 27 | { 28 | // We can't delete m_reverse in destructor because when the object 29 | // is copied through copy constructor and original is deleted it 30 | // would invalidate m_reverse in both original and copied objects. 31 | // QSharedPointer takes care of this and deletes m_reverse only 32 | // when all copies of the object are deleted. 33 | ptr = QSharedPointer(m_reverse); 34 | } 35 | 36 | QString DictionaryPos::pos() const 37 | { 38 | return m_pos; 39 | } 40 | 41 | QString DictionaryPos::translations(const QString separator) const 42 | { 43 | return m_translations.join(separator); 44 | } 45 | 46 | QStringList &DictionaryPos::translations() 47 | { 48 | return m_translations; 49 | } 50 | 51 | ReverseTranslationsModel *DictionaryPos::reverseTranslations() const 52 | { 53 | return m_reverse; 54 | } 55 | 56 | DictionaryModel::DictionaryModel(QObject *parent) : 57 | QAbstractListModel(parent) 58 | { 59 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 60 | setRoleNames(roleNames()); 61 | #endif 62 | } 63 | 64 | QHash DictionaryModel::roleNames() const 65 | { 66 | QHash roles; 67 | roles[PosRole] = "pos"; 68 | roles[TranslationsRole] = "translations"; 69 | roles[ReverseTranslationsRole] = "reverseTranslations"; 70 | return roles; 71 | } 72 | 73 | int DictionaryModel::rowCount(const QModelIndex &parent) const 74 | { 75 | if (parent.isValid()) 76 | return 0; 77 | 78 | return m_dict.count(); 79 | } 80 | 81 | QVariant DictionaryModel::data(const QModelIndex &index, int role) const 82 | { 83 | if (!index.isValid() || (index.row() < 0) || (index.row() > m_dict.count())) 84 | return QVariant(); 85 | 86 | switch (role) { 87 | case PosRole: 88 | return m_dict.at(index.row()).pos(); 89 | case TranslationsRole: 90 | //: Separator for joining string lists (don't forget space after comma) 91 | return m_dict.at(index.row()).translations(tr(", ")); 92 | case ReverseTranslationsRole: 93 | return QVariant::fromValue(m_dict.at(index.row()).reverseTranslations()); 94 | } 95 | 96 | return QVariant(); 97 | } 98 | 99 | void DictionaryModel::append(const DictionaryPos &pos) 100 | { 101 | emit beginInsertRows(QModelIndex(), m_dict.count(), m_dict.count()); 102 | m_dict.append(pos); 103 | emit endInsertRows(); 104 | } 105 | 106 | void DictionaryModel::clear() 107 | { 108 | emit beginRemoveRows(QModelIndex(), 0, m_dict.count() - 1); 109 | m_dict.clear(); 110 | emit endRemoveRows(); 111 | } 112 | -------------------------------------------------------------------------------- /src/dictionarymodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef DICTIONARYMODEL_H 24 | #define DICTIONARYMODEL_H 25 | 26 | #include "reversetranslationsmodel.h" 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | class DictionaryPos 35 | { 36 | Q_DECLARE_TR_FUNCTIONS(DictionaryPos) 37 | 38 | public: 39 | DictionaryPos(const QString &pos, const QStringList &translations = QStringList()); 40 | 41 | QString pos() const; 42 | QString translations(const QString separator) const; 43 | QStringList &translations(); 44 | ReverseTranslationsModel *reverseTranslations() const; 45 | 46 | private: 47 | QString m_pos; 48 | QStringList m_translations; 49 | ReverseTranslationsModel *m_reverse; 50 | QSharedPointer ptr; 51 | }; 52 | 53 | class DictionaryModel: public QAbstractListModel 54 | { 55 | Q_OBJECT 56 | 57 | public: 58 | enum DictionaryRoles { 59 | PosRole = Qt::UserRole + 1, 60 | TranslationsRole, 61 | ReverseTranslationsRole 62 | }; 63 | 64 | explicit DictionaryModel(QObject *parent = 0); 65 | 66 | QHash roleNames() const; 67 | 68 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 69 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 70 | 71 | void append(const DictionaryPos &pos); 72 | void clear(); 73 | 74 | private: 75 | QList m_dict; 76 | }; 77 | 78 | Q_DECLARE_METATYPE(DictionaryModel *) 79 | 80 | #endif // DICTIONARYMODEL_H 81 | -------------------------------------------------------------------------------- /src/icon/AI/TAOT.bb10.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/src/icon/AI/TAOT.bb10.ai -------------------------------------------------------------------------------- /src/icon/AI/TAOT.harmattan.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/src/icon/AI/TAOT.harmattan.ai -------------------------------------------------------------------------------- /src/icon/AI/TAOT.jolla.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/src/icon/AI/TAOT.jolla.ai -------------------------------------------------------------------------------- /src/icon/AI/TAOT.symbian.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/src/icon/AI/TAOT.symbian.ai -------------------------------------------------------------------------------- /src/l10nmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef L10NMODEL_H 24 | #define L10NMODEL_H 25 | 26 | #include 27 | #include 28 | 29 | class QStringList; 30 | class QSettings; 31 | class L10nModel: public QAbstractListModel 32 | { 33 | Q_OBJECT 34 | Q_PROPERTY(int count READ count CONSTANT) 35 | Q_PROPERTY(int currentIndex READ currentIndex NOTIFY currentLanguageChanged) 36 | Q_PROPERTY(QString currentLanguage READ currentLanguage 37 | WRITE setCurrentLanguage 38 | NOTIFY currentLanguageChanged) 39 | 40 | public: 41 | enum L10nRoles { 42 | LanguageRole = Qt::UserRole + 1 43 | }; 44 | 45 | explicit L10nModel(QObject *parent = 0); 46 | 47 | QHash roleNames() const; 48 | 49 | int count() const; 50 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 51 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 52 | 53 | int currentIndex() const; 54 | 55 | QString currentLanguage() const; 56 | void setCurrentLanguage(const QString &language); 57 | 58 | Q_INVOKABLE QVariantMap get(int index) const; 59 | 60 | ~L10nModel(); 61 | 62 | signals: 63 | void currentLanguageChanged(); 64 | 65 | private: 66 | QStringList *m_translations; 67 | QSettings *m_settings; 68 | }; 69 | 70 | #endif // L10NMODEL_H 71 | -------------------------------------------------------------------------------- /src/languagelistmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "languagelistmodel.h" 24 | 25 | LanguageItem::LanguageItem(const Language &language, int index, QObject *parent) 26 | : QObject(parent), m_language(language), m_index(index) 27 | {} 28 | 29 | Language LanguageItem::language() const 30 | { 31 | return m_language; 32 | } 33 | 34 | QString LanguageItem::displayName() const 35 | { 36 | return m_language.displayName; 37 | } 38 | 39 | QVariant LanguageItem::info() const 40 | { 41 | return m_language.info; 42 | } 43 | 44 | int LanguageItem::index() const 45 | { 46 | return m_index; 47 | } 48 | 49 | void LanguageItem::setIndex(int index) 50 | { 51 | if (index == m_index) 52 | return; 53 | 54 | m_index = index; 55 | emit indexChanged(); 56 | } 57 | 58 | LanguageListModel::LanguageListModel(QObject *parent) 59 | : QAbstractListModel(parent) 60 | { 61 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 62 | setRoleNames(roleNames()); 63 | #endif 64 | } 65 | 66 | QHash LanguageListModel::roleNames() const 67 | { 68 | QHash roles; 69 | roles.insert(Qt::DisplayRole, "name"); 70 | roles.insert(InfoRole, "info"); 71 | return roles; 72 | } 73 | 74 | int LanguageListModel::count() const 75 | { 76 | return m_languages.count(); 77 | } 78 | 79 | int LanguageListModel::rowCount(const QModelIndex &parent) const 80 | { 81 | if (parent.isValid()) 82 | return 0; 83 | 84 | return count(); 85 | } 86 | 87 | QVariant LanguageListModel::data(const QModelIndex &index, int role) const 88 | { 89 | if (!index.isValid() || index.row() < 0 || index.row() >= m_languages.count()) 90 | return QVariant(); 91 | 92 | switch (role) { 93 | case Qt::DisplayRole: 94 | return m_languages.at(index.row()).displayName; 95 | case InfoRole: 96 | return m_languages.at(index.row()).info; 97 | default: 98 | return QVariant(); 99 | } 100 | } 101 | 102 | void LanguageListModel::setLanguageList(const LanguageList &list) 103 | { 104 | if (list == m_languages) 105 | return; 106 | 107 | beginResetModel(); 108 | m_languages = list; 109 | endResetModel(); 110 | 111 | emit countChanged(); 112 | } 113 | 114 | Language LanguageListModel::get(int index) const 115 | { 116 | if (index < 0 || index >= m_languages.count()) 117 | return Language(); 118 | 119 | return m_languages.at(index); 120 | } 121 | 122 | int LanguageListModel::indexOf(const Language language) const 123 | { 124 | return m_languages.indexOf(language); 125 | } 126 | 127 | int LanguageListModel::indexOf(LanguageItem *language) const 128 | { 129 | return indexOf(language->language()); 130 | } 131 | 132 | QString LanguageListModel::displayNameOf(int index) const 133 | { 134 | return data(createIndex(index, 0), Qt::DisplayRole).toString(); 135 | } 136 | -------------------------------------------------------------------------------- /src/languagelistmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef LANGUAGELISTMODEL_H 24 | #define LANGUAGELISTMODEL_H 25 | 26 | #include "translationservice.h" 27 | 28 | #include 29 | 30 | class LanguageItem : public QObject 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(QString displayName READ displayName CONSTANT) 34 | Q_PROPERTY(QVariant info READ info CONSTANT) 35 | Q_PROPERTY(int index READ index NOTIFY indexChanged) 36 | 37 | public: 38 | LanguageItem(const Language &language, int index, QObject *parent = 0); 39 | 40 | Language language() const; 41 | QString displayName() const; 42 | QVariant info() const; 43 | int index() const; 44 | void setIndex(int index); 45 | 46 | signals: 47 | void indexChanged(); 48 | 49 | private: 50 | const Language m_language; 51 | int m_index; 52 | }; 53 | 54 | class LanguageListModel: public QAbstractListModel 55 | { 56 | Q_OBJECT 57 | Q_PROPERTY(int count READ count NOTIFY countChanged) 58 | 59 | public: 60 | enum LanguageListRoles { 61 | InfoRole = Qt::UserRole + 1 62 | }; 63 | 64 | explicit LanguageListModel(QObject *parent = 0); 65 | 66 | QHash roleNames() const; 67 | 68 | int count() const; 69 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 70 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 71 | 72 | void setLanguageList(const LanguageList &list); 73 | Language get(int index) const; 74 | 75 | int indexOf(const Language language) const; 76 | 77 | public slots: 78 | int indexOf(LanguageItem *language) const; 79 | QString displayNameOf(int index) const; 80 | 81 | signals: 82 | int countChanged(); 83 | 84 | private: 85 | LanguageList m_languages; 86 | }; 87 | 88 | Q_DECLARE_METATYPE(LanguageItem *) 89 | Q_DECLARE_METATYPE(LanguageListModel *) 90 | 91 | #endif // LANGUAGELISTMODEL_H 92 | -------------------------------------------------------------------------------- /src/reversetranslationsmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "reversetranslationsmodel.h" 24 | 25 | ReverseTranslationsModel::ReverseTranslationsModel(QObject *parent) 26 | : QAbstractListModel(parent) 27 | { 28 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 29 | setRoleNames(roleNames()); 30 | #endif 31 | } 32 | 33 | QHash ReverseTranslationsModel::roleNames() const 34 | { 35 | QHash roles; 36 | roles[TermRole] = "term"; 37 | roles[SynonymsRole] = "synonyms"; 38 | roles[TranslationsRole] = "translations"; 39 | return roles; 40 | } 41 | 42 | int ReverseTranslationsModel::rowCount(const QModelIndex &parent) const 43 | { 44 | if (parent.isValid()) 45 | return 0; 46 | 47 | return m_terms.count(); 48 | } 49 | 50 | QVariant ReverseTranslationsModel::data(const QModelIndex &index, int role) const 51 | { 52 | if (!index.isValid() || (index.row() < 0) || (index.row() >= m_terms.count())) 53 | return QVariant(); 54 | 55 | switch (role) { 56 | case TermRole: 57 | return m_terms.at(index.row()).first; 58 | case SynonymsRole: 59 | //: Separator for joining string lists (don't forget space after comma) 60 | return m_terms.at(index.row()).second.first.join(tr(", ")); 61 | case TranslationsRole: 62 | return m_terms.at(index.row()).second.second.join(tr(", ")); 63 | } 64 | 65 | return QVariant(); 66 | } 67 | 68 | void ReverseTranslationsModel::append(const QString &term, 69 | const QStringList &synonyms, 70 | const QStringList &translations) 71 | { 72 | beginInsertRows(QModelIndex(), m_terms.count(), m_terms.count()); 73 | m_terms.append(qMakePair(term, qMakePair(synonyms, translations))); 74 | endInsertRows(); 75 | } 76 | -------------------------------------------------------------------------------- /src/reversetranslationsmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef REVERSETRANSLATIONSMODEL_H 24 | #define REVERSETRANSLATIONSMODEL_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class ReverseTranslationsModel: public QAbstractListModel 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | enum ReverseTranslationRoles { 36 | TermRole = Qt::UserRole + 1, 37 | SynonymsRole, 38 | TranslationsRole 39 | }; 40 | 41 | explicit ReverseTranslationsModel(QObject *parent = 0); 42 | 43 | QHash roleNames() const; 44 | 45 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 46 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 47 | 48 | void append(const QString &term, const QStringList &synonyms, const QStringList &translations); 49 | 50 | private: 51 | QList > > m_terms; 52 | }; 53 | 54 | Q_DECLARE_METATYPE(ReverseTranslationsModel *) 55 | 56 | #endif // REVERSETRANSLATIONSMODEL_H 57 | -------------------------------------------------------------------------------- /src/services/apikeys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef APIKEYS_H 24 | #define APIKEYS_H 25 | 26 | // Specify your API keys and application IDs in this file 27 | 28 | // Microsoft Translator 29 | #define MSTRANSLATOR_TEXT_API_KEY "" 30 | 31 | // Yandex.Translate 32 | #define YANDEXTRANSLATE_API_KEY "" 33 | 34 | // Yandex.Dictionary 35 | #define YANDEXDICTIONARIES_API_KEY "" 36 | 37 | // Amplitude Analytics 38 | #define AMPLITUDE_API_KEY "" 39 | 40 | #endif // APIKEYS_H 41 | -------------------------------------------------------------------------------- /src/services/googletranslate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef GOOGLETRANSLATE_H 24 | #define GOOGLETRANSLATE_H 25 | 26 | #include "jsontranslationservice.h" 27 | 28 | #include 29 | 30 | class DictionaryModel; 31 | class GoogleTranslate: public JsonTranslationService 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | static QString displayName(); 37 | 38 | explicit GoogleTranslate(DictionaryModel *dict, QObject *parent = 0); 39 | 40 | QString uid() const; 41 | bool targetLanguagesDependOnSourceLanguage() const; 42 | bool supportsTranslation() const; 43 | bool supportsDictionary() const; 44 | 45 | LanguageList sourceLanguages() const; 46 | LanguageList targetLanguages(const Language &sourceLanguage) const; 47 | LanguagePair defaultLanguagePair() const; 48 | QString getLanguageName(const QVariant &info) const; 49 | bool isAutoLanguage(const Language &lang) const; 50 | bool canSwapLanguages(const Language &first, const Language &second) const; 51 | 52 | bool translate(const Language &from, const Language &to, const QString &text); 53 | bool parseReply(const QByteArray &data); 54 | 55 | private: 56 | DictionaryModel *m_dict; 57 | LanguageList m_sourceLanguages; 58 | LanguageList m_targetLanguages; 59 | LanguagePair m_defaultLanguagePair; 60 | QHash m_langCodeToName; 61 | QSslConfiguration m_sslConfiguration; 62 | }; 63 | 64 | #endif // GOOGLETRANSLATE_H 65 | -------------------------------------------------------------------------------- /src/services/jsontranslationservice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "jsontranslationservice.h" 24 | 25 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 26 | # include 27 | # include 28 | #else 29 | # include 30 | #endif 31 | 32 | #include 33 | 34 | JsonTranslationService::JsonTranslationService(QObject *parent) 35 | : TranslationService(parent) 36 | {} 37 | 38 | QVariant JsonTranslationService::parseJson(const QByteArray &json) 39 | { 40 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 41 | QString js; 42 | js.reserve(json.size() + 2); 43 | js.append("(").append(QString::fromUtf8(json)).append(")"); 44 | 45 | static QScriptEngine engine; 46 | if (!engine.canEvaluate(js)) { 47 | m_error = tr("Couldn't parse response from the server because of an error: \"%1\"") 48 | .arg(tr("Can't evaluate JSON data")); 49 | return QVariant(); 50 | } 51 | 52 | QScriptValue data = engine.evaluate(js); 53 | if (engine.hasUncaughtException()) { 54 | m_error = tr("Couldn't parse response from the server because of an error: \"%1\"") 55 | .arg(engine.uncaughtException().toString()); 56 | return QVariant(); 57 | } 58 | 59 | return data.toVariant(); 60 | #else 61 | if (json.endsWith('"')) { 62 | // A plain quoted string - return it with quotes removed 63 | QString str = QString::fromUtf8(json); 64 | 65 | // Remove quotes 66 | str.remove(0, 1); 67 | str.chop(1); 68 | 69 | // Replace CRLF 70 | str.replace("\\u000a", "\x0A"); 71 | str.replace("\\u000d", "\x0D"); 72 | 73 | return str; 74 | } 75 | 76 | QJsonParseError err; 77 | QJsonDocument doc = QJsonDocument::fromJson(json, &err); 78 | 79 | if (err.error != QJsonParseError::NoError) { 80 | m_error = tr("Couldn't parse response from the server because of an error: \"%1\"") 81 | .arg(err.errorString()); 82 | return QVariant(); 83 | } 84 | 85 | return doc.toVariant(); 86 | #endif 87 | } 88 | -------------------------------------------------------------------------------- /src/services/jsontranslationservice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef JSONTRANSLATIONSERVICE_H 24 | #define JSONTRANSLATIONSERVICE_H 25 | 26 | #include "translationservice.h" 27 | 28 | typedef QMapIterator QVariantMapIterator; 29 | 30 | class JsonTranslationService: public TranslationService 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit JsonTranslationService(QObject *parent = 0); 36 | 37 | protected: 38 | QVariant parseJson(const QByteArray &json); 39 | }; 40 | 41 | #endif // JSONTRANSLATIONSERVICE_H 42 | -------------------------------------------------------------------------------- /src/services/microsofttranslator.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROSOFTTRANSLATOR_H 2 | #define MICROSOFTTRANSLATOR_H 3 | 4 | #include "jsontranslationservice.h" 5 | 6 | #include 7 | #include 8 | 9 | class MicrosoftTranslator: public JsonTranslationService 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | static QString displayName(); 15 | 16 | explicit MicrosoftTranslator(QObject *parent = 0); 17 | 18 | QString uid() const; 19 | bool targetLanguagesDependOnSourceLanguage() const; 20 | bool supportsTranslation() const; 21 | bool supportsDictionary() const; 22 | 23 | LanguageList sourceLanguages() const; 24 | LanguageList targetLanguages(const Language &sourceLanguage) const; 25 | LanguagePair defaultLanguagePair() const; 26 | QString getLanguageName(const QVariant &info) const; 27 | bool isAutoLanguage(const Language &lang) const; 28 | bool canSwapLanguages(const Language &first, const Language &second) const; 29 | 30 | bool translate(const Language &from, const Language &to, const QString &text); 31 | bool parseReply(const QByteArray &reply); 32 | 33 | private slots: 34 | void onTokenTimeout(); 35 | 36 | private: 37 | bool checkReplyForErrors(QNetworkReply *reply); 38 | void requestToken(); 39 | 40 | enum State { 41 | TokenRequestState, 42 | TranslationState 43 | }; 44 | 45 | State m_state; 46 | QByteArray m_token; 47 | QTimer m_tokenTimeout; 48 | LanguageList m_sourceLanguages; 49 | LanguageList m_targetLanguages; 50 | LanguagePair m_defaultLanguagePair; 51 | QHash m_langCodeToName; 52 | LanguagePair m_translationPair; 53 | QString m_sourceText; 54 | QSslConfiguration m_sslConfiguration; 55 | }; 56 | 57 | #endif // MICROSOFTTRANSLATOR_H 58 | -------------------------------------------------------------------------------- /src/services/yandexdictionaries.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef YANDEXDICTIONARIES_H 24 | #define YANDEXDICTIONARIES_H 25 | 26 | #include "yandextranslationservice.h" 27 | 28 | #include 29 | 30 | class DictionaryModel; 31 | class YandexDictionaries: public YandexTranslationService 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | static QString displayName(); 37 | 38 | explicit YandexDictionaries(DictionaryModel *dict, QObject *parent = 0); 39 | 40 | QString uid() const; 41 | bool supportsTranslation() const; 42 | bool supportsDictionary() const; 43 | 44 | LanguagePair defaultLanguagePair() const; 45 | 46 | bool translate(const Language &from, const Language &to, const QString &text); 47 | bool parseReply(const QByteArray &reply); 48 | 49 | protected: 50 | QString serviceName() const { return displayName(); } 51 | 52 | private: 53 | DictionaryModel *m_dict; 54 | }; 55 | 56 | #endif // YANDEXDICTIONARIES_H 57 | -------------------------------------------------------------------------------- /src/services/yandextranslate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "yandextranslate.h" 24 | #include "apikeys.h" 25 | 26 | #include 27 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 28 | # include 29 | #endif 30 | 31 | QString YandexTranslate::displayName() 32 | { 33 | return tr("Yandex.Translate"); 34 | } 35 | 36 | YandexTranslate::YandexTranslate(QObject *parent) : 37 | YandexTranslationService(parent) 38 | { 39 | // TODO: Download actual list from 40 | // https://translate.yandex.net/api/v1.5/tr.json/getLangs 41 | loadLanguages(QLatin1String("://langs/yandex.translate.json")); 42 | } 43 | 44 | QString YandexTranslate::uid() const 45 | { 46 | return "YandexTranslate"; 47 | } 48 | 49 | bool YandexTranslate::supportsTranslation() const 50 | { 51 | return true; 52 | } 53 | 54 | bool YandexTranslate::supportsDictionary() const 55 | { 56 | return false; 57 | } 58 | 59 | LanguagePair YandexTranslate::defaultLanguagePair() const 60 | { 61 | return LanguagePair(Language("", getLanguageName("")), Language("en", getLanguageName("en"))); 62 | } 63 | 64 | bool YandexTranslate::translate(const Language &from, const Language &to, const QString &text) 65 | { 66 | QString lang; 67 | if (!from.info.toString().isEmpty()) 68 | lang.append(from.info.toString()).append("-"); 69 | lang.append(to.info.toString()); 70 | 71 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 72 | QUrl query("https://translate.yandex.net/api/v1.5/tr.json/translate"); 73 | QUrl dataQuery; 74 | #else 75 | QUrl url("https://translate.yandex.net/api/v1.5/tr.json/translate"); 76 | QUrlQuery dataQuery, query; 77 | #endif 78 | query.addQueryItem("key", YANDEXTRANSLATE_API_KEY); 79 | query.addQueryItem("lang", lang); 80 | query.addQueryItem("options", "1"); 81 | 82 | dataQuery.addQueryItem("text", text); 83 | 84 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 85 | QNetworkRequest request(query); 86 | const QByteArray data(dataQuery.encodedQuery()); 87 | #else 88 | url.setQuery(query); 89 | QNetworkRequest request(url); 90 | const QByteArray data(dataQuery.toString(QUrl::FullyEncoded).toUtf8()); 91 | #endif 92 | request.setHeader(QNetworkRequest::ContentTypeHeader, 93 | "application/x-www-form-urlencoded;charset=UTF-8"); 94 | request.setSslConfiguration(m_sslConfiguration); 95 | 96 | m_reply = m_nam.post(request, data); 97 | 98 | return true; 99 | } 100 | 101 | bool YandexTranslate::parseReply(const QByteArray &reply) 102 | { 103 | const QVariant data = parseJson(reply); 104 | if (!data.isValid()) 105 | return false; 106 | 107 | if (data.toMap().value("detected").type() == QVariant::Map) { 108 | const QString detected = data.toMap().value("detected").toMap().value("lang").toString(); 109 | m_detectedLanguage = Language(detected, getLanguageName(detected)); 110 | } 111 | 112 | m_translation = data.toMap().value("text").toStringList().join(""); 113 | 114 | return true; 115 | } 116 | -------------------------------------------------------------------------------- /src/services/yandextranslate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef YANDEXTRANSLATE_H 24 | #define YANDEXTRANSLATE_H 25 | 26 | #include "yandextranslationservice.h" 27 | 28 | #include 29 | 30 | class YandexTranslate: public YandexTranslationService 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | static QString displayName(); 36 | 37 | explicit YandexTranslate(QObject *parent = 0); 38 | 39 | QString uid() const; 40 | bool supportsTranslation() const; 41 | bool supportsDictionary() const; 42 | 43 | LanguagePair defaultLanguagePair() const; 44 | 45 | bool translate(const Language &from, const Language &to, const QString &text); 46 | bool parseReply(const QByteArray &reply); 47 | 48 | protected: 49 | QString serviceName() const { return displayName(); } 50 | }; 51 | 52 | #endif // YANDEXTRANSLATE_H 53 | -------------------------------------------------------------------------------- /src/services/yandextranslationservice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef YANDEXTRANSLATIONSERVICE_H 24 | #define YANDEXTRANSLATIONSERVICE_H 25 | 26 | #include "jsontranslationservice.h" 27 | 28 | #include 29 | 30 | class YandexTranslationService: public JsonTranslationService 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit YandexTranslationService(QObject *parent = 0); 36 | 37 | bool targetLanguagesDependOnSourceLanguage() const; 38 | LanguageList sourceLanguages() const; 39 | LanguageList targetLanguages(const Language &sourceLanguage) const; 40 | QString getLanguageName(const QVariant &info) const; 41 | bool isAutoLanguage(const Language &lang) const; 42 | bool canSwapLanguages(const Language &first, const Language &second) const; 43 | 44 | bool checkReplyForErrors(QNetworkReply *reply); 45 | 46 | protected: 47 | virtual QString serviceName() const = 0; 48 | void loadLanguages(const QString &file, bool withAutodetect = true); 49 | 50 | QSslConfiguration m_sslConfiguration; 51 | LanguageList m_sourceLanguages; 52 | QHash m_targetLanguages; 53 | LanguagePair m_defaultLanguagePair; 54 | QHash m_langCodeToName; 55 | }; 56 | 57 | #endif // YANDEXTRANSLATIONSERVICE_H 58 | -------------------------------------------------------------------------------- /src/symbian/symbianapplication.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "symbianapplication.h" 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | SymbianApplication::SymbianApplication(int &argc, char **argv) 30 | : QApplication(argc, argv), m_visibility(NotVisible) 31 | {} 32 | 33 | SymbianApplication::Visibility SymbianApplication::visibility() const 34 | { 35 | return m_visibility; 36 | } 37 | 38 | bool SymbianApplication::symbianEventFilter(const QSymbianEvent *event) 39 | { 40 | if (event->type() == QSymbianEvent::WindowServerEvent 41 | && event->windowServerEvent()->Type() == EEventWindowVisibilityChanged) { 42 | TUint flags = event->windowServerEvent()->VisibilityChanged()->iFlags; 43 | if (flags & TWsVisibilityChangedEvent::ENotVisible) 44 | setVisibility(NotVisible); 45 | else if (flags & TWsVisibilityChangedEvent::EFullyVisible) 46 | setVisibility(FullyVisible); 47 | else 48 | setVisibility(PartiallyVisible); 49 | } 50 | return QApplication::symbianEventFilter(event); 51 | } 52 | 53 | void SymbianApplication::setVisibility(Visibility visibility) 54 | { 55 | if (m_visibility == visibility) 56 | return; 57 | 58 | m_visibility = visibility; 59 | 60 | emit visibilityChanged(); 61 | } 62 | -------------------------------------------------------------------------------- /src/symbian/symbianapplication.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef SYMBIANAPPLICATION_H 24 | #define SYMBIANAPPLICATION_H 25 | 26 | #include 27 | 28 | class SymbianApplication: public QApplication 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | enum Visibility { 34 | NotVisible, 35 | PartiallyVisible, 36 | FullyVisible 37 | }; 38 | 39 | SymbianApplication(int &argc, char **argv); 40 | Visibility visibility() const; 41 | 42 | signals: 43 | void visibilityChanged(); 44 | 45 | protected: 46 | bool symbianEventFilter(const QSymbianEvent *event); 47 | 48 | private: 49 | Visibility m_visibility; 50 | 51 | void setVisibility(Visibility visibility); 52 | }; 53 | 54 | #endif // SYMBIANAPPLICATION_H 55 | -------------------------------------------------------------------------------- /src/translationservicesmodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #include "translationservicesmodel.h" 24 | 25 | TranslationServiceItem::TranslationServiceItem(int id, const QString &name, QObject *parent) 26 | : QObject(parent), m_id(id), m_name(name) 27 | {} 28 | 29 | int TranslationServiceItem::index() const 30 | { 31 | return m_id; 32 | } 33 | 34 | QString TranslationServiceItem::name() const 35 | { 36 | return m_name; 37 | } 38 | 39 | TranslationServicesModel::TranslationServicesModel(const QStringList &strings, QObject *parent) 40 | : QStringListModel(strings, parent) 41 | { 42 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 43 | setRoleNames(roleNames()); 44 | #endif 45 | } 46 | 47 | QHash TranslationServicesModel::roleNames() const 48 | { 49 | QHash roles; 50 | roles.insert(Qt::DisplayRole, "name"); 51 | return roles; 52 | } 53 | 54 | int TranslationServicesModel::count() const 55 | { 56 | return rowCount(); 57 | } 58 | 59 | QString TranslationServicesModel::get(int index) const 60 | { 61 | return data(createIndex(index, 0), Qt::DisplayRole).toString(); 62 | } 63 | -------------------------------------------------------------------------------- /src/translationservicesmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef TRANSLATIONSERVICESMODEL_H 24 | #define TRANSLATIONSERVICESMODEL_H 25 | 26 | #include 27 | 28 | class TranslationServiceItem: public QObject 29 | { 30 | Q_OBJECT 31 | Q_PROPERTY(int index READ index CONSTANT) 32 | Q_PROPERTY(QString name READ name CONSTANT) 33 | 34 | public: 35 | TranslationServiceItem(int index, const QString &name, QObject *parent = 0); 36 | 37 | int index() const; 38 | QString name() const; 39 | 40 | private: 41 | int m_id; 42 | QString m_name; 43 | }; 44 | 45 | // A wrapper around QStringListModel to make it more QML friendly. 46 | class TranslationServicesModel: public QStringListModel 47 | { 48 | Q_OBJECT 49 | Q_PROPERTY(int count READ count CONSTANT) 50 | 51 | public: 52 | explicit TranslationServicesModel(const QStringList &strings, QObject *parent = 0); 53 | QHash roleNames() const; 54 | int count() const; 55 | 56 | public slots: 57 | QString get(int index) const; 58 | }; 59 | 60 | Q_DECLARE_METATYPE(TranslationServiceItem *) 61 | Q_DECLARE_METATYPE(TranslationServicesModel *) 62 | 63 | #endif // TRANSLATIONSERVICESMODEL_H 64 | -------------------------------------------------------------------------------- /src/updater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAO Translator 3 | * Copyright (C) 2013-2018 Oleksii Serdiuk 4 | * 5 | * $Id: 61edf98 2018-06-02 19:31:38 +0200 Oleksii Serdiuk $ 6 | * 7 | * This file is part of TAO Translator. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program. If not, see . 21 | */ 22 | 23 | #ifndef UPDATER_H 24 | #define UPDATER_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class Release: public QObject 31 | { 32 | Q_OBJECT 33 | Q_PROPERTY(QString version READ version CONSTANT) 34 | Q_PROPERTY(QString title READ title CONSTANT) 35 | Q_PROPERTY(QString changeLog READ changeLog CONSTANT) 36 | 37 | public: 38 | Release(QObject *parent = 0); 39 | Release(const QString &version, 40 | const QString &title, 41 | const QString &changeLog, 42 | QObject *parent = 0); 43 | 44 | QString version() const; 45 | QString title() const; 46 | QString changeLog() const; 47 | 48 | private: 49 | QString m_version; 50 | QString m_title; 51 | QString m_changeLog; 52 | }; 53 | Q_DECLARE_METATYPE(Release *) 54 | 55 | class QNetworkAccessManager; 56 | class QNetworkReply; 57 | class Updater: public QObject 58 | { 59 | Q_OBJECT 60 | Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) 61 | Q_PROPERTY(QString variant READ variant WRITE setVariant NOTIFY variantChanged) 62 | Q_PROPERTY(QString currentVersion READ currentVersion 63 | WRITE setCurrentVersion 64 | NOTIFY currentVersionChanged) 65 | Q_PROPERTY(Release *latestRelease READ latestRelease NOTIFY latestReleaseChanged) 66 | Q_PROPERTY(bool latestReleaseValid READ latestReleaseValid NOTIFY latestReleaseValidChanged) 67 | Q_PROPERTY(bool updateAvailable READ updateAvailable NOTIFY updateAvailableChanged) 68 | 69 | public: 70 | explicit Updater(QObject *parent = 0); 71 | 72 | bool busy() const; 73 | 74 | QString variant() const; 75 | void setVariant(const QString &variant); 76 | 77 | QString currentVersion() const; 78 | void setCurrentVersion(const QString ¤tVersion); 79 | 80 | Release *latestRelease() const; 81 | bool latestReleaseValid() const; 82 | bool updateAvailable() const; 83 | 84 | signals: 85 | void busyChanged(); 86 | void variantChanged(); 87 | void currentVersionChanged(); 88 | void latestReleaseChanged(); 89 | void latestReleaseValidChanged(); 90 | void updateAvailableChanged(); 91 | void error(const QString &errorString); 92 | 93 | public slots: 94 | void checkForUpdates(); 95 | 96 | private slots: 97 | void onNetworkReply(QNetworkReply *reply); 98 | 99 | private: 100 | bool m_busy; 101 | QString m_variant; 102 | QString m_currentVersion; 103 | Release *m_latestRelease; 104 | bool m_latestReleaseValid; 105 | bool m_updateAvailable; 106 | 107 | int m_numericCurrentVersion; 108 | int m_numericLatestVersion; 109 | 110 | QNetworkAccessManager *m_nam; 111 | QNetworkReply *m_reply; 112 | QSslConfiguration m_sslConfiguration; 113 | 114 | void setBusy(bool busy); 115 | void setUpdateAvailable(bool available); 116 | int parseVersion(const QString versionString); 117 | QVariantList parseJson(const QByteArray &json); 118 | }; 119 | Q_DECLARE_METATYPE(Updater *) 120 | 121 | #endif // UPDATER_H 122 | -------------------------------------------------------------------------------- /taot480.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/taot480.png -------------------------------------------------------------------------------- /taot80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leppa/taot/61edf98a80e08b4d8441e65319e7c29c926bdbee/taot80.png --------------------------------------------------------------------------------