├── .gitignore ├── .travis.yml ├── 3rdParty └── QSimpleUpdater │ ├── .travis.yml │ ├── COPYING.md │ ├── QSimpleUpdater.pri │ ├── QSimpleUpdater.pro │ ├── README.md │ ├── etc │ ├── resources │ │ ├── qsimpleupdater.qrc │ │ └── update.png │ ├── screenshots │ │ ├── download-complete.png │ │ ├── downloading.png │ │ └── tutorial.png │ └── scripts │ │ ├── format-code.bat │ │ └── format-code.sh │ ├── include │ └── QSimpleUpdater.h │ ├── src │ ├── Downloader.cpp │ ├── Downloader.h │ ├── Downloader.ui │ ├── QSimpleUpdater.cpp │ ├── Updater.cpp │ └── Updater.h │ └── tutorial │ ├── COPYING │ ├── definitions │ ├── README.md │ └── updates.json │ ├── download │ └── YesItWorks.jpg │ ├── src │ ├── Window.cpp │ ├── Window.h │ ├── Window.ui │ └── main.cpp │ └── tutorial.pro ├── INSTALL ├── WifiAssist ├── bin │ ├── WifiAssist.desktop │ ├── ap.sh │ ├── client.sh │ ├── net.sh │ ├── test.sh │ └── wifi.sh ├── etc │ ├── com.lzjqsdd.WifiAssist.policy │ ├── macinfo │ └── update.json ├── img │ ├── WifiAssist.ico │ └── WifiAssistIcon.png ├── install.sh └── uninstall.sh ├── README.md ├── WifiAssist.pro ├── build └── Makefile ├── config.ini ├── resources ├── about.qrc ├── corpo.qrc ├── i18n.qrc ├── i18n │ ├── en_US.qm │ ├── en_US.ts │ ├── zh_CN.qm │ ├── zh_CN.ts │ ├── zh_TW.qm │ └── zh_TW.ts ├── icon.qrc └── img │ ├── Devices.ico │ ├── Settings.ico │ ├── WifiAssist.ico │ ├── WifiAssistIcon.png │ ├── WifiAssistIcon_100x100.jpg │ ├── corpicon │ ├── Apple.ico │ ├── Apple.png │ ├── SamsungE.ico │ ├── Sony.png │ ├── SonyComp.ico │ └── XiaomiCo.ico │ └── edit.ico ├── screenshot ├── ClientNotify.png ├── WifiAssistForLinux-Device.png ├── WifiAssistForLinux-Main.png └── WifiAssistForLinux-Settings.png └── src ├── about.cpp ├── about.h ├── about.ui ├── device.cpp ├── device.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── singleinstance.cpp ├── singleinstance.h ├── wdevices.cpp ├── wdevices.h ├── wifi.cpp ├── wifi.h ├── wlistwidgetitem.cpp ├── wlistwidgetitem.h ├── wlistwidgetitem.ui ├── wsettings.cpp ├── wsettings.h ├── wthread.cpp └── wthread.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/qt 3 | 4 | ### Qt ### 5 | # C++ objects and libs 6 | 7 | *.slo 8 | *.lo 9 | *.o 10 | *.a 11 | *.la 12 | *.lai 13 | *.so 14 | *.dll 15 | *.dylib 16 | 17 | # Qt-es 18 | 19 | /.qmake.cache 20 | /.qmake.stash 21 | *.pro.user 22 | *.pro.user.* 23 | *.qbs.user 24 | *.qbs.user.* 25 | *.moc 26 | moc_*.cpp 27 | qrc_*.cpp 28 | ui_*.h 29 | *build-* 30 | 31 | # QtCreator 32 | 33 | *.autosave 34 | 35 | #QtCtreator Qml 36 | *.qmlproject.user 37 | *.qmlproject.user.* 38 | 39 | #QtCtreator CMake 40 | CMakeLists.txt.user 41 | 42 | 43 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | 4 | before_install: 5 | - sudo apt-get update -qq 6 | - sudo apt-get -y install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev 7 | - sudo apt-get -y install qt5-default qttools5-dev-tools 8 | 9 | script: 10 | - qmake WifiAssist.pro 11 | - make 12 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: gcc 3 | 4 | dist: trusty 5 | sudo: required 6 | 7 | before_install: 8 | - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test 9 | - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa 10 | - sudo apt-get update -qq 11 | 12 | install: 13 | - sudo apt-get install -y --force-yes build-essential g++-4.8 -y 14 | - sudo apt-get install -y --force-yes libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev -y 15 | - sudo apt-get install -y --force-yes qtbase5-dev qtdeclarative5-dev libqt5gui5 qttools5-dev-tools qttools5-dev qtmultimedia5-dev 16 | 17 | script: 18 | - qmake -qt=qt5 QSimpleUpdater.pro 19 | - make -j4 20 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/COPYING.md: -------------------------------------------------------------------------------- 1 | # DON'T BE A DICK PUBLIC LICENSE 2 | 3 | > Version 1, December 2009 4 | 5 | > Copyright (C) 2009 Philip Sturgeon 6 | 7 | Everyone is permitted to copy and distribute verbatim or modified 8 | copies of this license document, and changing it is allowed as long 9 | as the name is changed. 10 | 11 | > DON'T BE A DICK PUBLIC LICENSE 12 | > TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 13 | 14 | 1. Do whatever you like with the original work, just don't be a dick. 15 | 16 | Being a dick includes - but is not limited to - the following instances: 17 | 18 | 1a. Outright copyright infringement - Don't just copy this and change the name. 19 | 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick. 20 | 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick. 21 | 22 | 2. If you become rich through modifications, related works/services, or supporting the original work, 23 | share the love. Only a dick would make loads off this work and not buy the original work's 24 | creator(s) a pint. 25 | 26 | 3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes 27 | you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back. 28 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/QSimpleUpdater.pri: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2016 Alex Spataru 3 | # 4 | # This file is part of the QSimpleUpdater library, which is released under 5 | # the DBAD license, you can read a copy of it below: 6 | # 7 | # DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION 8 | # AND MODIFICATION: 9 | # 10 | # Do whatever you like with the original work, just don't be a dick. 11 | # Being a dick includes - but is not limited to - the following instances: 12 | # 13 | # 1a. Outright copyright infringement - Don't just copy this and change the 14 | # name. 15 | # 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | # REALLY being a dick. 17 | # 1c. Modifying the original work to contain hidden harmful content. 18 | # That would make you a PROPER dick. 19 | # 20 | # If you become rich through modifications, related works/services, or 21 | # supporting the original work, share the love. 22 | # Only a dick would make loads off this work and not buy the original works 23 | # creator(s) a pint. 24 | # 25 | # Code is provided with no warranty. Using somebody else's code and bitching 26 | # when it goes wrong makes you a DONKEY dick. 27 | # Fix the problem yourself. A non-dick would submit the fix back. 28 | 29 | QT += gui 30 | QT += core 31 | QT += network 32 | QT += widgets 33 | 34 | INCLUDEPATH += $$PWD/include 35 | 36 | SOURCES += \ 37 | $$PWD/src/Updater.cpp \ 38 | $$PWD/src/Downloader.cpp \ 39 | $$PWD/src/QSimpleUpdater.cpp 40 | 41 | HEADERS += \ 42 | $$PWD/include/QSimpleUpdater.h \ 43 | $$PWD/src/Updater.h \ 44 | $$PWD/src/Downloader.h 45 | 46 | FORMS += $$PWD/src/Downloader.ui 47 | RESOURCES += $$PWD/etc/resources/qsimpleupdater.qrc 48 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/QSimpleUpdater.pro: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2016 Alex Spataru 3 | # 4 | # This file is part of the QSimpleUpdater library, which is released under 5 | # the DBAD license, you can read a copy of it below: 6 | # 7 | # DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION 8 | # AND MODIFICATION: 9 | # 10 | # Do whatever you like with the original work, just don't be a dick. 11 | # Being a dick includes - but is not limited to - the following instances: 12 | # 13 | # 1a. Outright copyright infringement - Don't just copy this and change the 14 | # name. 15 | # 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | # REALLY being a dick. 17 | # 1c. Modifying the original work to contain hidden harmful content. 18 | # That would make you a PROPER dick. 19 | # 20 | # If you become rich through modifications, related works/services, or 21 | # supporting the original work, share the love. 22 | # Only a dick would make loads off this work and not buy the original works 23 | # creator(s) a pint. 24 | # 25 | # Code is provided with no warranty. Using somebody else's code and bitching 26 | # when it goes wrong makes you a DONKEY dick. 27 | # Fix the problem yourself. A non-dick would submit the fix back. 28 | 29 | TEMPLATE = lib 30 | DEFINES += QSU_SHARED 31 | include ($$PWD/QSimpleUpdater.pri) 32 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/README.md: -------------------------------------------------------------------------------- 1 | # QSimpleUpdater 2 | 3 | [![Build Status](https://travis-ci.org/alex-spataru/QSimpleUpdater.svg?branch=master)](https://travis-ci.org/alex-spataru/QSimpleUpdater) 4 | [![BitCoin donate button](https://img.shields.io/badge/bitcoin-donate-yellow.svg)](https://blockchain.info/address/1K85yLxjuqUmhkjP839R7C23XFhSxrefMx "Donate once-off to this project using BitCoin") 5 | [![Github downloads](https://img.shields.io/github/downloads/alex-spataru/qsimpleupdater/total.svg)](https://github.com/alex-spataru/qsimpleupdater/releases/latest) 6 | 7 | QSimpleUpdater is an implementation of an auto-updating system to be used with Qt projects. It allows you to easily check for updates, download them and install them. Additionally, the QSimpleUpdater allows you to check for updates for different "modules" of your application. Check the [WTFs Section](#wtfs-section) for more information. 8 | 9 | [![Downloading](etc/screenshots/downloading.png)](etc/screenshots/) 10 | 11 | ## Integrating QSimpleUpdater with your projects 12 | 1. Copy the QSimpleUpdater folder in your "3rd-party" folder. 13 | 2. Include the QSimpleUpdater project include (*pri*) file using the include() function. 14 | 3. That's all! Check the [tutorial project](/tutorial) as a reference for your project. 15 | 16 | ## WTFs Section 17 | 18 | ### 1. How does the QSimpleUpdater check for updates? 19 | 20 | The QSimpleUpdater downloads an update definition file stored in JSON format. This file specifies the latest version, the download links and changelogs for each platform (you can also register your own platform easily if needed). 21 | 22 | After downloading this file, the library analyzes the local version and the remote version. If the remote version is greater than the local version, then the library infers that there is an update available and notifies the user. 23 | 24 | An example update definition file can be found [here](https://github.com/alex-spataru/QSimpleUpdater/blob/master/tutorial/definitions/updates.json). 25 | 26 | ### 2. Can I customize the update notifications shown to the user? 27 | 28 | Yes! You can "toggle" which notifications to show using the library's functions or re-implement by yourself the notifications by "reacting" to the signals emitted by the QSimpleUpdater. 29 | 30 | ```c++ 31 | QString url = "https://MyBadassApplication.com/updates.json"; 32 | 33 | QSimpleUpdater::getInstance()->setNotifyOnUpdate (url, true); 34 | QSimpleUpdater::getInstance()->setNotifyOnFinish (url, false); 35 | 36 | QSimpleUpdater::getInstance()->checkForUpdates (url); 37 | ``` 38 | 39 | ### 3. Is the application able to download the updates directly? 40 | 41 | Yes. If there is an update available, the library will prompt the user if he/she wants to download the update. You can enable or disable the integrated downloader with the following code: 42 | 43 | ```c++ 44 | QString url = "https://MyBadassApplication.com/updates.json"; 45 | QSimpleUpdater::getInstance()->setDownloaderEnabled (url, true); 46 | ``` 47 | 48 | ### 4. Why do I need to specify an URL for each function of the library? 49 | 50 | The QSimpleUpdater allows you to use different updater instances, which can be accessed with the URL of the update definitions. 51 | While it is not obligatory to use multiple updater instances, this can be useful for applications that make use of plugins or different modules. 52 | 53 | Say that you are developing a game, in this case, you could use the following code: 54 | 55 | ```c++ 56 | // Update the game textures 57 | QString textures_url = "https://MyBadassGame.com/textures.json" 58 | QSimpleUpdater::getInstance()->setModuleName (textures_url, "textures"); 59 | QSimpleUpdater::getInstance()->setModuleVersion (textures_url, "0.4"); 60 | QSimpleUpdater::getInstance()->checkForUpdates (textures_url); 61 | 62 | // Update the game sounds 63 | QString sounds_url = "https://MyBadassGame.com/sounds.json" 64 | QSimpleUpdater::getInstance()->setModuleName (sounds_url, "sounds"); 65 | QSimpleUpdater::getInstance()->setModuleVersion (sounds_url, "0.6"); 66 | QSimpleUpdater::getInstance()->checkForUpdates (sounds_url); 67 | 68 | // Update the client (name & versions are already stored in qApp) 69 | QString client_url = "https://MyBadassGame.com/client.json" 70 | QSimpleUpdater::getInstance()->checkForUpdates (client_url); 71 | ``` 72 | 73 | ## License 74 | QSimpleUpdater is free and open-source software, it is released under the [DBAD](COPYING.md) license. 75 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/resources/qsimpleupdater.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | update.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/resources/update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/3rdParty/QSimpleUpdater/etc/resources/update.png -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/screenshots/download-complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/3rdParty/QSimpleUpdater/etc/screenshots/download-complete.png -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/screenshots/downloading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/3rdParty/QSimpleUpdater/etc/screenshots/downloading.png -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/screenshots/tutorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/3rdParty/QSimpleUpdater/etc/screenshots/tutorial.png -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/scripts/format-code.bat: -------------------------------------------------------------------------------- 1 | :: Description: This script changes the style format of 2 | :: all the source code of the project. 3 | 4 | :: Setup the command line 5 | @echo off 6 | title Code Formatter 7 | 8 | :: Go to the directory where the script is run 9 | cd /d %~dp0 10 | 11 | :: Style and format the source code recursively 12 | astyle --pad-oper --pad-first-paren-out --align-pointer=type --remove-brackets --convert-tabs --max-code-length=80 --style=google --lineend=windows --suffix=none --recursive ../../*.h ../../*.cpp ../../*.c 13 | 14 | :: Notify the user that we have finished 15 | echo. 16 | echo Code styling complete! 17 | echo. 18 | 19 | :: Let the user see the output 20 | pause 21 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/etc/scripts/format-code.sh: -------------------------------------------------------------------------------- 1 | # Style and format recursively 2 | astyle --pad-oper --pad-first-paren-out --align-pointer=type --remove-brackets --convert-tabs --max-code-length=80 --style=google --lineend=windows --suffix=none --recursive ../../*.h ../../*.cpp ../../*.c 3 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/include/QSimpleUpdater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This file is part of the QSimpleUpdater library, which is released under 5 | * the DBAD license, you can read a copy of it below: 6 | * 7 | * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, 8 | * DISTRIBUTION AND MODIFICATION: 9 | * 10 | * Do whatever you like with the original work, just don't be a dick. 11 | * Being a dick includes - but is not limited to - the following instances: 12 | * 13 | * 1a. Outright copyright infringement - Don't just copy this and change the 14 | * name. 15 | * 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | * REALLY being a dick. 17 | * 1c. Modifying the original work to contain hidden harmful content. 18 | * That would make you a PROPER dick. 19 | * 20 | * If you become rich through modifications, related works/services, or 21 | * supporting the original work, share the love. 22 | * Only a dick would make loads off this work and not buy the original works 23 | * creator(s) a pint. 24 | * 25 | * Code is provided with no warranty. Using somebody else's code and bitching 26 | * when it goes wrong makes you a DONKEY dick. 27 | * Fix the problem yourself. A non-dick would submit the fix back. 28 | */ 29 | 30 | #ifndef _QSIMPLEUPDATER_MAIN_H 31 | #define _QSIMPLEUPDATER_MAIN_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #if defined (QSU_SHARED) 38 | # define QSU_DECL Q_DECL_EXPORT 39 | #elif defined (QSU_IMPORT) 40 | # define QSU_DECL Q_DECL_IMPORT 41 | #else 42 | # define QSU_DECL 43 | #endif 44 | 45 | class Updater; 46 | 47 | /// 48 | /// Project homepage: http://qsimpleupdater.sf.net/ 49 | /// Code repository: http://github.com/alex-spataru/qsimpleupdater 50 | /// 51 | /// The \c QSimpleUpdater class manages the updater system and allows for 52 | /// parallel application modules to check for updates and download them. 53 | /// 54 | /// The behavior of each updater can be regulated by specifying the update 55 | /// definitions URL (from where we download the individual update definitions) 56 | /// and defining the desired options by calling the individual "setter" 57 | /// functions (e.g. \c setNotifyOnUpdate()). 58 | /// 59 | /// The \c QSimpleUpdater also implements an integrated downloader. 60 | /// If you need to use a custom install procedure/code, just create a function 61 | /// that is called when the \c downloadFinished() signal is emitted to 62 | /// implement your own install procedures. 63 | /// 64 | /// By default, the downloader will try to open the file as if you opened it 65 | /// from a file manager or a web browser (with the "file:///" url). 66 | /// 67 | class QSU_DECL QSimpleUpdater : public QObject { 68 | Q_OBJECT 69 | 70 | public: 71 | /// 72 | /// Returns the only instance of the class 73 | /// 74 | static QSimpleUpdater* getInstance(); 75 | 76 | /// 77 | /// Returns \c true if the updater registered with the given \a url is set 78 | /// to notify the user when it finds an available update. 79 | /// 80 | bool getNotifyOnUpdate (const QString& url) const; 81 | 82 | /// 83 | /// Returns \c true if the updater registered with the given \a url is set 84 | /// to notify the user when it finishes checking for updates 85 | /// 86 | bool getNotifyOnFinish (const QString& url) const; 87 | 88 | /// 89 | /// Returns \c true if the updater registered with the given \a url has an 90 | /// update available. 91 | /// 92 | /// \note you should call \c checkForUpdates() for this URL first in order 93 | /// for this function to regurn a valid value 94 | /// 95 | bool getUpdateAvailable (const QString& url) const; 96 | 97 | /// 98 | /// Returns \c true if the downloader is enabled for the updater registered 99 | /// with the given \a c url 100 | /// 101 | bool getDownloaderEnabled (const QString& url) const; 102 | 103 | /// 104 | /// Returns the changelog of the updater instance with the given \c url. 105 | /// 106 | QString getChangelog (const QString& url) const; 107 | 108 | /// 109 | /// Returns the URL from where we can download the update 110 | /// 111 | QString getDownloadUrl (const QString& url) const; 112 | 113 | /// 114 | /// Returns the latest version online 115 | /// 116 | QString getLatestVersion (const QString& url) const; 117 | 118 | /// 119 | /// Returns the platform of the updater with the given \c url. 120 | /// 121 | QString getPlatformKey (const QString& url) const; 122 | 123 | /// 124 | /// Returns the application name registered for the given \c url. 125 | /// 126 | QString getModuleName (const QString& url) const; 127 | 128 | /// 129 | /// Returns the application version registered for the given \c url 130 | /// 131 | QString getModuleVersion (const QString& url) const; 132 | 133 | /// 134 | /// Returns \c true if the downloader will not attempt to install the 135 | /// downloaded file. 136 | /// 137 | /// This can be useful if you want to use the \c downloadFinished() signal 138 | /// to implement your own install procedures. 139 | /// 140 | bool usesCustomInstallProcedures (const QString& url) const; 141 | 142 | public slots: 143 | /// 144 | /// Checks for updates by downloading the update definitions file at the 145 | /// given \a url. 146 | /// 147 | /// You can have more than one updater running at the same time while the 148 | /// \a url is different. Every updater instance will have its own set of 149 | /// settings. 150 | /// 151 | /// This can be used - for example - when having multiple shared modules 152 | /// (e.g. plugins) that can be updated separately. 153 | /// 154 | void checkForUpdates (const QString& url); 155 | 156 | /// 157 | /// Changes the platform key which we use to get version data and download 158 | /// link in the appcast in the given \c url. 159 | /// 160 | /// \note By default, the updater will use the name of the current operating 161 | /// system as its platform key. 162 | /// 163 | void setPlatformKey (const QString& url, const QString& platform); 164 | 165 | /// 166 | /// Changes the application name to display in the notification messages 167 | /// for the given appcast \a url. 168 | /// 169 | /// This can be used - for example - when having multiple shared modules 170 | /// (e.g. plugins) that can be updated separately. 171 | /// 172 | /// \note By default, the updater will use the name given to the 173 | /// \c QApplication during initialization of your application. 174 | /// 175 | void setModuleName (const QString& url, const QString& name); 176 | 177 | /// 178 | /// Changes the application version to use when comparing the local and 179 | /// remote application versions. 180 | /// 181 | /// This can be used - for example - when having multiple shared modules 182 | /// (e.g. plugins) that can be updated separately. 183 | /// 184 | /// \note By default, the updater will use the version given to the 185 | /// \c QApplication during initialization of your application. 186 | /// 187 | void setModuleVersion (const QString& url, const QString& version); 188 | 189 | /// 190 | /// If \c notify is set to true, the \c QSimpleUpdater will notify the user 191 | /// when an update is available. 192 | /// 193 | /// If \c notify is set to false, the \c QSimpleUpdater will not notify the 194 | /// user when an update is available. 195 | /// 196 | /// \note this feature is enabled by default 197 | /// \note you should disable this feature if you are implementing your own 198 | /// notification methods or update procedures in your application. 199 | /// \note this function only changes the behavior for the updater registered 200 | /// with the given \a url. 201 | /// 202 | void setNotifyOnUpdate (const QString& url, const bool& notify); 203 | 204 | /// 205 | /// If set to \c true, the updater will notify the user when it finishes 206 | /// checking for updates (even where there are no updates available). 207 | /// 208 | /// If set to \c false (default), the updater will only notify the user 209 | /// when there is an update available (if setNotifyOnUpdate() is \c true). 210 | /// 211 | /// You can enable this feature when the user triggers manually the updater 212 | /// (e.g. by clicking on the "Check for Updates..." action on the menu). 213 | /// 214 | /// \note this feature is disabled by default 215 | /// \note you should disable this feature if you are implementing your own 216 | /// notification methods or update procedures in your application. 217 | /// \note this function only changes the behavior for the updater registered 218 | /// with the given \a url. 219 | /// 220 | void setNotifyOnFinish (const QString& url, const bool& notify); 221 | 222 | /// 223 | /// If set to true, the updater will allow the user to choose whenever to 224 | /// download the update directly from the application (instead of opening 225 | /// the given download link through a browser). 226 | /// 227 | /// \note this feature is enabled by default 228 | /// \note you should disable this if you are implementing your own update 229 | /// procedures in your application. 230 | /// \note this function only changes the behavior for the updater registered 231 | /// with the given \a url. 232 | /// 233 | void setDownloaderEnabled (const QString& url, const bool& enabled); 234 | 235 | /// 236 | /// If \c custom is set to true, then the Downloader will not attempt to 237 | /// open or install the downloaded updates. This can be useful if you want 238 | /// to implement your own install procedures using the \c downloadFinished() 239 | /// signal. 240 | /// 241 | void setUseCustomInstallProcedures (const QString& url, const bool& custom); 242 | 243 | signals: 244 | /// 245 | /// Emitted when the check for updates process finishes. 246 | /// You can use this function if you are implementing your own notification 247 | /// methods or download procedures. 248 | /// 249 | /// \note use of this signal is not obligatory if you don't want 250 | /// to show a custom notification or create your own downloader. 251 | /// 252 | void checkingFinished (const QString& url); 253 | 254 | /// 255 | /// Emitted when the download has finished. 256 | /// You can use this to implement your own procedures to install the 257 | /// downloaded updates. 258 | /// 259 | void downloadFinished (const QString& url, const QString& filepath); 260 | 261 | protected: 262 | ~QSimpleUpdater(); 263 | 264 | private: 265 | /// 266 | /// Returns the updater object registered with the given \a url. 267 | /// If an updater object with the given \a url is not found, then this 268 | /// function will create it and configure it. 269 | /// 270 | Updater* getUpdater (const QString& url) const; 271 | }; 272 | 273 | #endif 274 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/Downloader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014 Alex Spataru 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the GNU Lesser General Public License 6 | * (LGPL) version 2.1 which accompanies this distribution, and is available at 7 | * http://www.gnu.org/licenses/lgpl-2.1.html 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | */ 15 | 16 | //============================================================================== 17 | // Class includes 18 | //============================================================================== 19 | 20 | #include "Downloader.h" 21 | 22 | //============================================================================== 23 | // System includes 24 | //============================================================================== 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | //============================================================================== 37 | // Downloader::Downloader 38 | //============================================================================== 39 | 40 | Downloader::Downloader (QWidget* parent) : QWidget (parent) { 41 | m_ui = new Ui::Downloader; 42 | m_ui->setupUi (this); 43 | 44 | /* Initialize private members */ 45 | m_manager = new QNetworkAccessManager(); 46 | 47 | /* Initialize internal values */ 48 | m_filePath = ""; 49 | m_startTime = 0; 50 | m_useCustomProcedures = false; 51 | 52 | /* Make the window look like a modal dialog */ 53 | setWindowIcon (QIcon ()); 54 | setWindowFlags (Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint); 55 | 56 | /* Configure the appearance and behavior of the buttons */ 57 | m_ui->openButton->setEnabled (false); 58 | m_ui->openButton->setVisible (false); 59 | connect (m_ui->stopButton, SIGNAL (clicked()), 60 | this, SLOT (cancelDownload())); 61 | connect (m_ui->openButton, SIGNAL (clicked()), 62 | this, SLOT (installUpdate())); 63 | 64 | /* Resize to fit */ 65 | setFixedSize (minimumSizeHint()); 66 | } 67 | 68 | //============================================================================== 69 | // Downloader::~Downloader 70 | //============================================================================== 71 | 72 | Downloader::~Downloader() { 73 | delete m_ui; 74 | delete m_reply; 75 | delete m_manager; 76 | } 77 | 78 | //============================================================================== 79 | // Downloader::useCustomInstallProcedures 80 | //============================================================================== 81 | 82 | bool Downloader::useCustomInstallProcedures() const { 83 | return m_useCustomProcedures; 84 | } 85 | 86 | //============================================================================== 87 | // Downloader::startDownload 88 | //============================================================================== 89 | 90 | void Downloader::startDownload (const QUrl& url) { 91 | /* Reset UI */ 92 | m_ui->progressBar->setValue (0); 93 | m_ui->stopButton->setText (tr ("Stop")); 94 | m_ui->downloadLabel->setText (tr ("Downloading updates")); 95 | m_ui->timeLabel->setText (tr ("Time remaining") + ": " + tr ("unknown")); 96 | 97 | /* Start download */ 98 | m_startTime = QDateTime::currentDateTime().toTime_t(); 99 | m_reply = m_manager->get (QNetworkRequest (url)); 100 | 101 | /* Update UI when download progress changes or download finishes */ 102 | connect (m_reply, SIGNAL (downloadProgress (qint64, qint64)), 103 | this, SLOT (updateProgress (qint64, qint64))); 104 | connect (m_reply, SIGNAL (finished()), 105 | this, SLOT (onDownloadFinished())); 106 | 107 | showNormal(); 108 | } 109 | 110 | //============================================================================== 111 | // Downloader::openDownload 112 | //============================================================================== 113 | 114 | void Downloader::openDownload() { 115 | if (!m_filePath.isEmpty()) 116 | QDesktopServices::openUrl (QUrl::fromLocalFile (m_filePath)); 117 | 118 | else { 119 | QMessageBox::critical (this, 120 | tr ("Error"), 121 | tr ("Cannot find downloaded update!"), 122 | QMessageBox::Close); 123 | } 124 | } 125 | 126 | //============================================================================== 127 | // Downloader::installUpdate 128 | //============================================================================== 129 | 130 | void Downloader::installUpdate() { 131 | if (useCustomInstallProcedures()) 132 | return; 133 | 134 | QMessageBox box; 135 | box.setIcon (QMessageBox::Question); 136 | box.setDefaultButton (QMessageBox::Ok); 137 | box.setStandardButtons (QMessageBox::Ok | QMessageBox::Cancel); 138 | box.setInformativeText (tr ("Click \"OK\" to begin installing the update")); 139 | box.setText ("

" + 140 | tr ("In order to install the update, you may need to " 141 | "quit the application.") 142 | + "

"); 143 | 144 | if (box.exec() == QMessageBox::Ok) { 145 | if (!useCustomInstallProcedures()) 146 | openDownload(); 147 | } 148 | 149 | else { 150 | m_ui->openButton->setEnabled (true); 151 | m_ui->openButton->setVisible (true); 152 | m_ui->timeLabel->setText (tr ("Click the \"Open\" button to " 153 | "apply the update")); 154 | } 155 | } 156 | 157 | //============================================================================== 158 | // Downloader::cancelDownload 159 | //============================================================================== 160 | 161 | void Downloader::cancelDownload() { 162 | if (!m_reply->isFinished()) { 163 | QMessageBox box; 164 | box.setWindowTitle (tr ("Updater")); 165 | box.setIcon (QMessageBox::Question); 166 | box.setStandardButtons (QMessageBox::Yes | QMessageBox::No); 167 | box.setText (tr ("Are you sure you want to cancel the download?")); 168 | 169 | if (box.exec() == QMessageBox::Yes) { 170 | hide(); 171 | m_reply->abort(); 172 | } 173 | } 174 | 175 | else 176 | hide(); 177 | } 178 | 179 | //============================================================================== 180 | // Downloader::onDownloadFinished 181 | //============================================================================== 182 | 183 | void Downloader::onDownloadFinished() { 184 | m_ui->stopButton->setText (tr ("Close")); 185 | m_ui->downloadLabel->setText (tr ("Download complete!")); 186 | m_ui->timeLabel->setText (tr ("The installer will open separately") 187 | + "..."); 188 | 189 | QByteArray data = m_reply->readAll(); 190 | 191 | if (!data.isEmpty()) { 192 | QStringList list = m_reply->url().toString().split ("/"); 193 | QFile file (QDir::tempPath() + "/" + list.at (list.count() - 1)); 194 | 195 | if (file.open (QIODevice::WriteOnly)) { 196 | file.write (data); 197 | file.close(); 198 | 199 | m_filePath = file.fileName(); 200 | emit downloadFinished (m_reply->url().toString(), m_filePath); 201 | } 202 | 203 | installUpdate(); 204 | } 205 | } 206 | 207 | //============================================================================== 208 | // Downloader::calculateSizes 209 | //============================================================================== 210 | 211 | void Downloader::calculateSizes (qint64 received, qint64 total) { 212 | QString totalSize; 213 | QString receivedSize; 214 | 215 | if (total < 1024) 216 | totalSize = tr ("%1 bytes").arg (total); 217 | 218 | else if (total < 1048576) 219 | totalSize = tr ("%1 KB").arg (round (total / 1024)); 220 | 221 | else 222 | totalSize = tr ("%1 MB").arg (round (total / 1048576)); 223 | 224 | if (received < 1024) 225 | receivedSize = tr ("%1 bytes").arg (received); 226 | 227 | else if (received < 1048576) 228 | receivedSize = tr ("%1 KB").arg (received / 1024); 229 | 230 | else 231 | receivedSize = tr ("%1 MB").arg (received / 1048576); 232 | 233 | m_ui->downloadLabel->setText (tr ("Downloading updates") 234 | + " (" + receivedSize + " " + tr ("of") 235 | + " " + totalSize + ")"); 236 | } 237 | 238 | //============================================================================== 239 | // Downloader::updateProgress 240 | //============================================================================== 241 | 242 | void Downloader::updateProgress (qint64 received, qint64 total) { 243 | if (total > 0) { 244 | m_ui->progressBar->setMinimum (0); 245 | m_ui->progressBar->setMaximum (100); 246 | m_ui->progressBar->setValue ((received * 100) / total); 247 | 248 | calculateSizes (received, total); 249 | calculateTimeRemaining (received, total); 250 | } 251 | 252 | else { 253 | m_ui->progressBar->setMinimum (0); 254 | m_ui->progressBar->setMaximum (0); 255 | m_ui->progressBar->setValue (-1); 256 | m_ui->downloadLabel->setText (tr ("Downloading Updates") + "..."); 257 | m_ui->timeLabel->setText (QString ("%1: %2") 258 | .arg (tr ("Time Remaining")) 259 | .arg (tr ("Unknown"))); 260 | } 261 | } 262 | 263 | //============================================================================== 264 | // Downloader::calculateTimeRemaining 265 | //============================================================================== 266 | 267 | void Downloader::calculateTimeRemaining (qint64 received, qint64 total) { 268 | uint difference = QDateTime::currentDateTime().toTime_t() - m_startTime; 269 | 270 | if (difference > 0) { 271 | QString timeString; 272 | float timeRemaining = total / (received / difference); 273 | 274 | if (timeRemaining > 7200) { 275 | timeRemaining /= 3600; 276 | timeString = tr ("About %1 hours").arg (int (timeRemaining + 0.5)); 277 | } 278 | 279 | else if (timeRemaining > 60) { 280 | timeRemaining /= 60; 281 | timeString = tr ("About %1 minutes").arg (int (timeRemaining + 0.5)); 282 | } 283 | 284 | else if (timeRemaining <= 60) 285 | timeString = tr ("%1 seconds").arg (int (timeRemaining + 0.5)); 286 | 287 | m_ui->timeLabel->setText (tr ("Time remaining") + ": " + timeString); 288 | } 289 | } 290 | 291 | //============================================================================== 292 | // Downloader::round 293 | //============================================================================== 294 | 295 | float Downloader::round (const float& input) { 296 | return roundf (input * 100) / 100; 297 | } 298 | 299 | //============================================================================== 300 | // Downloader::setUseCustomInstallProcedures 301 | //============================================================================== 302 | 303 | void Downloader::setUseCustomInstallProcedures (const bool& custom) { 304 | m_useCustomProcedures = custom; 305 | } 306 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/Downloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014 Alex Spataru 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the GNU Lesser General Public License 6 | * (LGPL) version 2.1 which accompanies this distribution, and is available at 7 | * http://www.gnu.org/licenses/lgpl-2.1.html 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | */ 15 | 16 | #ifndef DOWNLOAD_DIALOG_H 17 | #define DOWNLOAD_DIALOG_H 18 | 19 | #include 20 | #include 21 | 22 | namespace Ui { 23 | class Downloader; 24 | } 25 | 26 | class QNetworkReply; 27 | class QNetworkAccessManager; 28 | 29 | class Downloader : public QWidget { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit Downloader (QWidget* parent = 0); 34 | ~Downloader(); 35 | 36 | /// 37 | /// Returns \c true if the downloader will not attempt to install the 38 | /// downloaded file. 39 | /// 40 | /// This can be useful if you want to use the \c downloadFinished() signal 41 | /// to implement your own install procedures. 42 | /// 43 | bool useCustomInstallProcedures() const; 44 | 45 | public slots: 46 | /// 47 | /// Begins downloading the update 48 | /// 49 | void startDownload (const QUrl& url); 50 | 51 | /// 52 | /// If \c custom is set to true, then the Downloader will not attempt to 53 | /// open or install the downloaded updates. This can be useful if you want 54 | /// to implement your own install procedures using the \c downloadFinished() 55 | /// signal. 56 | /// 57 | void setUseCustomInstallProcedures (const bool& custom); 58 | 59 | private slots: 60 | void openDownload(); 61 | void installUpdate(); 62 | void cancelDownload(); 63 | void onDownloadFinished(); 64 | void calculateSizes (qint64 received, qint64 total); 65 | void updateProgress (qint64 received, qint64 total); 66 | void calculateTimeRemaining (qint64 received, qint64 total); 67 | 68 | private: 69 | /// 70 | /// Rounds the \a input to the nearest integer 71 | /// 72 | float round (const float& input); 73 | 74 | signals: 75 | /// 76 | /// Emitted when the download has finished. 77 | /// You can use this to implement your own procedures to install the 78 | /// downloaded updates. 79 | /// 80 | void downloadFinished (const QString& url, const QString& filepath); 81 | 82 | private: 83 | uint m_startTime; 84 | QString m_filePath; 85 | Ui::Downloader* m_ui; 86 | QNetworkReply* m_reply; 87 | bool m_useCustomProcedures; 88 | QNetworkAccessManager* m_manager; 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/Downloader.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Downloader 4 | 5 | 6 | 7 | 0 8 | 0 9 | 464 10 | 164 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Updater 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 12 28 | 29 | 30 | 12 31 | 32 | 33 | 12 34 | 35 | 36 | 12 37 | 38 | 39 | 40 | 41 | 42 | 0 43 | 44 | 45 | 0 46 | 47 | 48 | 0 49 | 50 | 51 | 0 52 | 53 | 54 | 0 55 | 56 | 57 | 58 | 59 | 60 | 96 61 | 96 62 | 63 | 64 | 65 | 66 | 67 | 68 | :/icons/update.png 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 0 77 | 78 | 79 | 80 | 81 | 82 | 75 83 | true 84 | 85 | 86 | 87 | Downloading updates 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 320 96 | 0 97 | 98 | 99 | 100 | 0 101 | 102 | 103 | false 104 | 105 | 106 | 107 | 108 | 109 | 110 | Time remaining: 0 minutes 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 12 125 | 126 | 127 | 12 128 | 129 | 130 | 12 131 | 132 | 133 | 12 134 | 135 | 136 | 137 | 138 | Qt::Horizontal 139 | 140 | 141 | 142 | 40 143 | 20 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Open 152 | 153 | 154 | 155 | 156 | 157 | 158 | Stop 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/QSimpleUpdater.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This file is part of the QSimpleUpdater library, which is released under 5 | * the DBAD license, you can read a copy of it below: 6 | * 7 | * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, 8 | * DISTRIBUTION AND MODIFICATION: 9 | * 10 | * Do whatever you like with the original work, just don't be a dick. 11 | * Being a dick includes - but is not limited to - the following instances: 12 | * 13 | * 1a. Outright copyright infringement - Don't just copy this and change the 14 | * name. 15 | * 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | * REALLY being a dick. 17 | * 1c. Modifying the original work to contain hidden harmful content. 18 | * That would make you a PROPER dick. 19 | * 20 | * If you become rich through modifications, related works/services, or 21 | * supporting the original work, share the love. 22 | * Only a dick would make loads off this work and not buy the original works 23 | * creator(s) a pint. 24 | * 25 | * Code is provided with no warranty. Using somebody else's code and bitching 26 | * when it goes wrong makes you a DONKEY dick. 27 | * Fix the problem yourself. A non-dick would submit the fix back. 28 | */ 29 | 30 | //============================================================================== 31 | // Class Includes 32 | //============================================================================== 33 | 34 | #include "Updater.h" 35 | #include "QSimpleUpdater.h" 36 | 37 | //============================================================================== 38 | // Implementation hacks 39 | //============================================================================== 40 | 41 | static QList URLS; 42 | static QList UPDATERS; 43 | 44 | //============================================================================== 45 | // QSimpleUpdater::~QSimpleUpdater 46 | //============================================================================== 47 | 48 | QSimpleUpdater::~QSimpleUpdater() { 49 | URLS.clear(); 50 | UPDATERS.clear(); 51 | } 52 | 53 | //============================================================================== 54 | // QSimpleUpdater::getInstance 55 | //============================================================================== 56 | 57 | QSimpleUpdater* QSimpleUpdater::getInstance() { 58 | static QSimpleUpdater updater; 59 | return &updater; 60 | } 61 | 62 | //============================================================================== 63 | // QSimpleUpdater::getNotifyOnUpdate 64 | //============================================================================== 65 | 66 | bool QSimpleUpdater::getNotifyOnUpdate (const QString& url) const { 67 | return getUpdater (url)->notifyOnUpdate(); 68 | } 69 | 70 | //============================================================================== 71 | // QSimpleUpdater::getNotifyOnFinish 72 | //============================================================================== 73 | 74 | bool QSimpleUpdater::getNotifyOnFinish (const QString& url) const { 75 | return getUpdater (url)->notifyOnFinish(); 76 | } 77 | 78 | //============================================================================== 79 | // QSimpleUpdater::getUpdateAvailable 80 | //============================================================================== 81 | 82 | bool QSimpleUpdater::getUpdateAvailable (const QString& url) const { 83 | return getUpdater (url)->updateAvailable(); 84 | } 85 | 86 | //============================================================================== 87 | // QSimpleUpdater::getDownloaderEnabled 88 | //============================================================================== 89 | 90 | bool QSimpleUpdater::getDownloaderEnabled (const QString& url) const { 91 | return getUpdater (url)->downloaderEnabled(); 92 | } 93 | 94 | //============================================================================== 95 | // QSimpleUpdater::getChangelog 96 | //============================================================================== 97 | 98 | QString QSimpleUpdater::getChangelog (const QString& url) const { 99 | return getUpdater (url)->changelog(); 100 | } 101 | 102 | //============================================================================== 103 | // QSimpleUpdater::getDownloadUrl 104 | //============================================================================== 105 | 106 | QString QSimpleUpdater::getDownloadUrl (const QString& url) const { 107 | return getUpdater (url)->downloadUrl(); 108 | } 109 | 110 | //============================================================================== 111 | // QSimpleUpdater::getLatestVersion 112 | //============================================================================== 113 | 114 | QString QSimpleUpdater::getLatestVersion (const QString& url) const { 115 | return getUpdater (url)->latestVersion(); 116 | } 117 | 118 | //============================================================================== 119 | // QSimpleUpdater::getPlatformKey 120 | //============================================================================== 121 | 122 | QString QSimpleUpdater::getPlatformKey (const QString& url) const { 123 | return getUpdater (url)->platformKey(); 124 | } 125 | 126 | //============================================================================== 127 | // QSimpleUpdater::getModuleName 128 | //============================================================================== 129 | 130 | QString QSimpleUpdater::getModuleName (const QString& url) const { 131 | return getUpdater (url)->moduleName(); 132 | } 133 | 134 | //============================================================================== 135 | // QSimpleUpdater::getModuleVersion 136 | //============================================================================== 137 | 138 | QString QSimpleUpdater::getModuleVersion (const QString& url) const { 139 | return getUpdater (url)->moduleVersion(); 140 | } 141 | 142 | //============================================================================== 143 | // QSimpleUpdater::usesCustomInstallProcedures 144 | //============================================================================== 145 | 146 | bool QSimpleUpdater::usesCustomInstallProcedures (const QString& url) const { 147 | return getUpdater (url)->useCustomInstallProcedures(); 148 | } 149 | 150 | //============================================================================== 151 | // QSimpleUpdater::checkForUpdates 152 | //============================================================================== 153 | 154 | void QSimpleUpdater::checkForUpdates (const QString& url) { 155 | getUpdater (url)->checkForUpdates(); 156 | } 157 | 158 | //============================================================================== 159 | // QSimpleUpdater::setPlatformKey 160 | //============================================================================== 161 | 162 | void QSimpleUpdater::setPlatformKey (const QString& url, 163 | const QString& platform) { 164 | getUpdater (url)->setPlatformKey (platform); 165 | } 166 | 167 | //============================================================================== 168 | // QSimpleUpdater::setModuleName 169 | //============================================================================== 170 | 171 | void QSimpleUpdater::setModuleName (const QString& url, const QString& name) { 172 | getUpdater (url)->setModuleName (name); 173 | } 174 | 175 | //============================================================================== 176 | // QSimpleUpdater::setModuleVersion 177 | //============================================================================== 178 | 179 | void QSimpleUpdater::setModuleVersion (const QString& url, 180 | const QString& version) { 181 | getUpdater (url)->setModuleVersion (version); 182 | } 183 | 184 | //============================================================================== 185 | // QSimpleUpdater::setNotifyOnUpdate 186 | //============================================================================== 187 | 188 | void QSimpleUpdater::setNotifyOnUpdate (const QString& url, 189 | const bool& notify) { 190 | getUpdater (url)->setNotifyOnUpdate (notify); 191 | } 192 | 193 | //============================================================================== 194 | // QSimpleUpdater::setNotifyOnFinish 195 | //============================================================================== 196 | 197 | void QSimpleUpdater::setNotifyOnFinish (const QString& url, 198 | const bool& notify) { 199 | getUpdater (url)->setNotifyOnFinish (notify); 200 | } 201 | 202 | //============================================================================== 203 | // QSimpleUpdater::setDownloaderEnabled 204 | //============================================================================== 205 | 206 | void QSimpleUpdater::setDownloaderEnabled (const QString& url, 207 | const bool& enabled) { 208 | getUpdater (url)->setDownloaderEnabled (enabled); 209 | } 210 | 211 | //============================================================================== 212 | // QSimpleUpdater::setUseCustomInstallProcedures 213 | //============================================================================== 214 | 215 | void QSimpleUpdater::setUseCustomInstallProcedures (const QString& url, 216 | const bool& custom) { 217 | getUpdater (url)->setUseCustomInstallProcedures (custom); 218 | } 219 | 220 | //============================================================================== 221 | // QSimpleUpdater::getUpdater 222 | //============================================================================== 223 | 224 | Updater* QSimpleUpdater::getUpdater (const QString& url) const { 225 | if (!URLS.contains (url)) { 226 | Updater* updater = new Updater; 227 | updater->setUrl (url); 228 | 229 | URLS.append (url); 230 | UPDATERS.append (updater); 231 | 232 | connect (updater, SIGNAL (checkingFinished (QString)), 233 | this, SIGNAL (checkingFinished (QString))); 234 | connect (updater, SIGNAL (downloadFinished (QString, QString)), 235 | this, SIGNAL (downloadFinished (QString, QString))); 236 | } 237 | 238 | return UPDATERS.at (URLS.indexOf (url)); 239 | } 240 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/Updater.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This file is part of the QSimpleUpdater library, which is released under 5 | * the DBAD license, you can read a copy of it below: 6 | * 7 | * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, 8 | * DISTRIBUTION AND MODIFICATION: 9 | * 10 | * Do whatever you like with the original work, just don't be a dick. 11 | * Being a dick includes - but is not limited to - the following instances: 12 | * 13 | * 1a. Outright copyright infringement - Don't just copy this and change the 14 | * name. 15 | * 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | * REALLY being a dick. 17 | * 1c. Modifying the original work to contain hidden harmful content. 18 | * That would make you a PROPER dick. 19 | * 20 | * If you become rich through modifications, related works/services, or 21 | * supporting the original work, share the love. 22 | * Only a dick would make loads off this work and not buy the original works 23 | * creator(s) a pint. 24 | * 25 | * Code is provided with no warranty. Using somebody else's code and bitching 26 | * when it goes wrong makes you a DONKEY dick. 27 | * Fix the problem yourself. A non-dick would submit the fix back. 28 | */ 29 | 30 | //============================================================================== 31 | // Class includes 32 | //============================================================================== 33 | 34 | #include "Updater.h" 35 | #include "Downloader.h" 36 | 37 | //============================================================================== 38 | // System includes 39 | //============================================================================== 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | //============================================================================== 49 | // Updater::Updater 50 | //============================================================================== 51 | 52 | Updater::Updater() { 53 | m_url = ""; 54 | m_openUrl = ""; 55 | m_changelog = ""; 56 | m_downloadUrl = ""; 57 | m_latestVersion = ""; 58 | m_notifyOnUpdate = true; 59 | m_notifyOnFinish = false; 60 | m_updateAvailable = false; 61 | m_downloaderEnabled = true; 62 | m_moduleName = qApp->applicationName(); 63 | m_moduleVersion = qApp->applicationVersion(); 64 | 65 | m_downloader = new Downloader(); 66 | m_manager = new QNetworkAccessManager(); 67 | 68 | #if defined Q_OS_WIN 69 | m_platform = "windows"; 70 | #elif defined Q_OS_MAC 71 | m_platform = "osx"; 72 | #elif defined Q_OS_LINUX 73 | m_platform = "linux"; 74 | #elif defined Q_OS_ANDROID 75 | m_platform = "android"; 76 | #elif defined Q_OS_IOS 77 | m_platform = "ios"; 78 | #endif 79 | 80 | connect (m_downloader, SIGNAL (downloadFinished (QString, QString)), 81 | this, SIGNAL (downloadFinished (QString, QString))); 82 | connect (m_manager, SIGNAL (finished (QNetworkReply*)), 83 | this, SLOT (onReply (QNetworkReply*))); 84 | } 85 | 86 | //============================================================================== 87 | // Updater::~Updater 88 | //============================================================================== 89 | 90 | Updater::~Updater() { 91 | delete m_downloader; 92 | } 93 | 94 | //============================================================================== 95 | // Updater::url 96 | //============================================================================== 97 | 98 | QString Updater::url() const { 99 | return m_url; 100 | } 101 | 102 | //============================================================================== 103 | // Updater::platformKey 104 | //============================================================================== 105 | 106 | QString Updater::platformKey() const { 107 | return m_platform; 108 | } 109 | 110 | //============================================================================== 111 | // Updater::notifyOnUpdate 112 | //============================================================================== 113 | 114 | bool Updater::notifyOnUpdate() const { 115 | return m_notifyOnUpdate; 116 | } 117 | 118 | //============================================================================== 119 | // Updater::notifyOnFinish 120 | //============================================================================== 121 | 122 | bool Updater::notifyOnFinish() const { 123 | return m_notifyOnFinish; 124 | } 125 | 126 | //============================================================================== 127 | // Updater::updateAvailable 128 | //============================================================================== 129 | 130 | bool Updater::updateAvailable() const { 131 | return m_updateAvailable; 132 | } 133 | 134 | //============================================================================== 135 | // Updater::downloaderEnabled 136 | //============================================================================== 137 | 138 | bool Updater::downloaderEnabled() const { 139 | return m_downloaderEnabled; 140 | } 141 | 142 | //============================================================================== 143 | // Updater::m_changelog 144 | //============================================================================== 145 | 146 | QString Updater::changelog() const { 147 | return m_changelog; 148 | } 149 | 150 | //============================================================================== 151 | // Updater::downloadUrl 152 | //============================================================================== 153 | 154 | QString Updater::downloadUrl() const { 155 | return m_downloadUrl; 156 | } 157 | 158 | //============================================================================== 159 | // Updater::latestVersion 160 | //============================================================================== 161 | 162 | QString Updater::latestVersion() const { 163 | return m_latestVersion; 164 | } 165 | 166 | //============================================================================== 167 | // Updater::moduleName 168 | //============================================================================== 169 | 170 | QString Updater::moduleName() const { 171 | return m_moduleName; 172 | } 173 | 174 | //============================================================================== 175 | // Updater::moduleVersion 176 | //============================================================================== 177 | 178 | QString Updater::moduleVersion() const { 179 | return m_moduleVersion; 180 | } 181 | 182 | //============================================================================== 183 | // Updater::useCustomInstallProcedures 184 | //============================================================================== 185 | 186 | bool Updater::useCustomInstallProcedures() const { 187 | return m_downloader->useCustomInstallProcedures(); 188 | } 189 | 190 | //============================================================================== 191 | // Updater::checkForUpdates 192 | //============================================================================== 193 | 194 | void Updater::checkForUpdates() { 195 | m_manager->get (QNetworkRequest (url())); 196 | } 197 | 198 | //============================================================================== 199 | // Updater::setUrl 200 | //============================================================================== 201 | 202 | void Updater::setUrl (const QString& url) { 203 | m_url = url; 204 | } 205 | 206 | //============================================================================== 207 | // Updater::setNotifyOnUpdate 208 | //============================================================================== 209 | 210 | void Updater::setNotifyOnUpdate (const bool& notify) { 211 | m_notifyOnUpdate = notify; 212 | } 213 | 214 | //============================================================================== 215 | // Updater::setNotifyOnFinish 216 | //============================================================================== 217 | 218 | void Updater::setNotifyOnFinish (const bool& notify) { 219 | m_notifyOnFinish = notify; 220 | } 221 | 222 | //============================================================================== 223 | // Updater::setPlatformKey 224 | //============================================================================== 225 | 226 | void Updater::setPlatformKey (const QString& platformKey) { 227 | m_platform = platformKey; 228 | } 229 | 230 | //============================================================================== 231 | // Updater::setModuleName 232 | //============================================================================== 233 | 234 | void Updater::setModuleName (const QString& name) { 235 | m_moduleName = name; 236 | } 237 | 238 | //============================================================================== 239 | // Updater::setDownloaderEnabled 240 | //============================================================================== 241 | 242 | void Updater::setDownloaderEnabled (const bool& enabled) { 243 | m_downloaderEnabled = enabled; 244 | } 245 | 246 | //============================================================================== 247 | // Updater::setUseCustomInstallProcedures 248 | //============================================================================== 249 | 250 | void Updater::setUseCustomInstallProcedures (const bool& custom) { 251 | m_downloader->setUseCustomInstallProcedures (custom); 252 | } 253 | 254 | //============================================================================== 255 | // Updater::setModuleVersion 256 | //============================================================================== 257 | 258 | void Updater::setModuleVersion (const QString& version) { 259 | m_moduleVersion = version; 260 | } 261 | 262 | //============================================================================== 263 | // Updater::onReply 264 | //============================================================================== 265 | 266 | void Updater::onReply (QNetworkReply* reply) { 267 | if (reply->error() == QNetworkReply::NoError) { 268 | QJsonDocument document = QJsonDocument::fromJson (reply->readAll()); 269 | 270 | if (document.isNull()) 271 | return; 272 | 273 | QJsonObject updates = document.object().value ("updates").toObject(); 274 | QJsonObject platform = updates.value (platformKey()).toObject(); 275 | 276 | m_openUrl = platform.value ("open-url").toString(); 277 | m_changelog = platform.value ("changelog").toString(); 278 | m_downloadUrl = platform.value ("download-url").toString(); 279 | m_latestVersion = platform.value ("latest-version").toString(); 280 | 281 | setUpdateAvailable (compare (latestVersion(), moduleVersion())); 282 | } 283 | 284 | emit checkingFinished (url()); 285 | } 286 | 287 | //============================================================================== 288 | // Updater::setUpdateAvailable 289 | //============================================================================== 290 | 291 | void Updater::setUpdateAvailable (const bool& available) { 292 | m_updateAvailable = available; 293 | 294 | QMessageBox box; 295 | box.setTextFormat (Qt::RichText); 296 | box.setIcon (QMessageBox::Information); 297 | 298 | if (updateAvailable() && (notifyOnUpdate() || notifyOnFinish())) { 299 | QString text = tr ("Would you like to download the update now?"); 300 | QString title = "

" 301 | + tr ("Version %1 of %2 has been released!") 302 | .arg (latestVersion()).arg (moduleName()) 303 | + "

"; 304 | 305 | box.setText (title); 306 | box.setInformativeText (text); 307 | box.setStandardButtons (QMessageBox::No | QMessageBox::Yes); 308 | box.setDefaultButton (QMessageBox::Yes); 309 | 310 | if (box.exec() == QMessageBox::Yes) { 311 | if (!m_openUrl.isEmpty()) 312 | QDesktopServices::openUrl (QUrl (m_openUrl)); 313 | 314 | else if (downloaderEnabled()) 315 | m_downloader->startDownload (downloadUrl()); 316 | 317 | else 318 | QDesktopServices::openUrl (QUrl (downloadUrl())); 319 | } 320 | } 321 | 322 | else if (notifyOnFinish()) { 323 | box.setStandardButtons (QMessageBox::Close); 324 | box.setInformativeText (tr ("No updates are available for the moment")); 325 | box.setText ("

" 326 | + tr ("Congratulations! You are running the " 327 | "latest version of %1").arg (moduleName()) 328 | + "

"); 329 | 330 | box.exec(); 331 | } 332 | } 333 | 334 | //============================================================================== 335 | // Updater::compare 336 | //============================================================================== 337 | 338 | bool Updater::compare (const QString& x, const QString& y) { 339 | QStringList versionsX = x.split ("."); 340 | QStringList versionsY = y.split ("."); 341 | 342 | int count = qMin (versionsX.count(), versionsY.count()); 343 | 344 | for (int i = 0; i < count; ++i) { 345 | int a = QString (versionsX.at (i)).toInt(); 346 | int b = QString (versionsY.at (i)).toInt(); 347 | 348 | if (a > b) 349 | return true; 350 | 351 | else if (b > a) 352 | return false; 353 | } 354 | 355 | return versionsY.count() < versionsX.count(); 356 | } 357 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/src/Updater.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This file is part of the QSimpleUpdater library, which is released under 5 | * the DBAD license, you can read a copy of it below: 6 | * 7 | * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, 8 | * DISTRIBUTION AND MODIFICATION: 9 | * 10 | * Do whatever you like with the original work, just don't be a dick. 11 | * Being a dick includes - but is not limited to - the following instances: 12 | * 13 | * 1a. Outright copyright infringement - Don't just copy this and change the 14 | * name. 15 | * 1b. Selling the unmodified original with no work done what-so-ever, that's 16 | * REALLY being a dick. 17 | * 1c. Modifying the original work to contain hidden harmful content. 18 | * That would make you a PROPER dick. 19 | * 20 | * If you become rich through modifications, related works/services, or 21 | * supporting the original work, share the love. 22 | * Only a dick would make loads off this work and not buy the original works 23 | * creator(s) a pint. 24 | * 25 | * Code is provided with no warranty. Using somebody else's code and bitching 26 | * when it goes wrong makes you a DONKEY dick. 27 | * Fix the problem yourself. A non-dick would submit the fix back. 28 | */ 29 | 30 | #ifndef _QSIMPLEUPDATER_UPDATER_H 31 | #define _QSIMPLEUPDATER_UPDATER_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | class Downloader; 41 | 42 | /// 43 | /// The Updater class is in charge of downloading and analyzing 44 | /// the appcast and "reacting" based on the options given by the 45 | /// user/developer/application. 46 | /// 47 | class QSU_DECL Updater : public QObject { 48 | Q_OBJECT 49 | 50 | public: 51 | Updater(); 52 | ~Updater(); 53 | 54 | /// 55 | /// Returns the AppCast URL (from which we extract the update definitions) 56 | /// 57 | QString url() const; 58 | 59 | /// 60 | /// Returns the current platform key, which is used to differentiate the 61 | /// different download links (and download versions) based on the current 62 | /// operating system. 63 | /// 64 | /// You can modify this value with the \c setPlatformKey() function 65 | /// 66 | QString platformKey() const; 67 | 68 | /// 69 | /// Returns \c true if the class is set to notify the user when an update 70 | /// is found online. By default this value is set to \c true. 71 | /// 72 | bool notifyOnUpdate() const; 73 | 74 | /// 75 | /// Returns \c true if the class is set to notify the user when it finishes 76 | /// checking for updates (even if there are no updates available). 77 | /// By default this value is set to \c false. 78 | /// 79 | bool notifyOnFinish() const; 80 | 81 | /// 82 | /// Returns \c true if the updater found an updated version of the 83 | /// application/module online. 84 | /// 85 | bool updateAvailable() const; 86 | 87 | /// 88 | /// Returns \c if the updater allows the integrated downloader to download 89 | /// and install the update (if aplicable). 90 | /// 91 | bool downloaderEnabled() const; 92 | 93 | /// 94 | /// Returns the latest changelog 95 | /// 96 | QString changelog() const; 97 | 98 | /// 99 | /// Returns the URL from where we can download the update 100 | /// 101 | QString downloadUrl() const; 102 | 103 | /// 104 | /// Returns the latest version online 105 | /// 106 | QString latestVersion() const; 107 | 108 | /// 109 | /// Returns the application name, which can be set manually or 110 | /// automatically using the \c qApp->applicationName() function. 111 | /// 112 | QString moduleName() const; 113 | 114 | /// 115 | /// Returns the application version, which can be set manually or 116 | /// automatically using the \c qApp->applicationVersion() function. 117 | /// 118 | QString moduleVersion() const; 119 | 120 | /// 121 | /// Returns \c true if the downloader will not attempt to install the 122 | /// downloaded file. 123 | /// 124 | /// This can be useful if you want to use the \c downloadFinished() signal 125 | /// to implement your own install procedures. 126 | /// 127 | bool useCustomInstallProcedures() const; 128 | 129 | public slots: 130 | /// 131 | /// Downloads the update definitions file and analyzes it to determine the 132 | /// latest version and the download links 133 | /// 134 | void checkForUpdates(); 135 | 136 | /// 137 | /// Changes the \a url from where we download the update definitions 138 | /// 139 | void setUrl (const QString& url); 140 | 141 | /// 142 | /// If \c notify is set to true, the \c QSimpleUpdater will notify the user 143 | /// when an update is available. 144 | /// 145 | /// If \c notify is set to false, the \c QSimpleUpdater will not notify the 146 | /// user when an update is available. 147 | /// 148 | void setNotifyOnUpdate (const bool& notify); 149 | 150 | /// 151 | /// If set to \c true, the updater will notify the user when it finishes 152 | /// checking for updates (even where there are no updates available). 153 | /// 154 | /// If set to \c false (default), the updater will only notify the user 155 | /// when there is an update available (if setNotifyOnUpdate() is \c true). 156 | /// 157 | void setNotifyOnFinish (const bool& notify); 158 | 159 | /// 160 | /// Changes the name of the module, this can be useful in large applications 161 | /// that only need to update certain components of them (e.g. plugins). 162 | /// 163 | void setModuleName (const QString& name); 164 | 165 | /// 166 | /// Changes the version of the module, this can be useful in large 167 | /// applications that only need to update certain components of them 168 | /// (e.g. plugins). 169 | /// 170 | void setModuleVersion (const QString& version); 171 | 172 | /// 173 | /// If \a enabled is set to true, then the user will be able to download 174 | /// and install updates directly from the application, without the need 175 | /// of opening the download URL from a browser and manually installing 176 | /// the update. 177 | /// 178 | void setDownloaderEnabled (const bool& enabled); 179 | 180 | /// 181 | /// Changes the platform key/id. This can be useful if the update depends 182 | /// on more than the underlying operating system on which the application 183 | /// runs. 184 | /// 185 | void setPlatformKey (const QString& platformKey); 186 | 187 | /// 188 | /// If \c custom is set to true, then the Downloader will not attempt to 189 | /// open or install the downloaded updates. This can be useful if you want 190 | /// to implement your own install procedures using the \c downloadFinished() 191 | /// signal. 192 | /// 193 | void setUseCustomInstallProcedures (const bool& custom); 194 | 195 | signals: 196 | /// 197 | /// Emitted when the download definitions have been downloaded and analyzed. 198 | /// 199 | void checkingFinished (const QString& url); 200 | 201 | /// 202 | /// Emitted when the download has finished. 203 | /// You can use this to implement your own procedures to install the 204 | /// downloaded updates. 205 | /// 206 | void downloadFinished (const QString& url, const QString& filepath); 207 | 208 | private slots: 209 | /// 210 | /// Reads and analyzes the downloaded update definition. 211 | /// 212 | void onReply (QNetworkReply* reply); 213 | 214 | /// 215 | /// Changes the appropiate internal values, shows notifications (if allowed) 216 | /// and (if allowed) initializes the internal downloader. 217 | /// 218 | void setUpdateAvailable (const bool& available); 219 | 220 | private: 221 | /// 222 | /// Returns \c true if version \a x is greater than version \a y. 223 | /// This is used to determine if the online version is greater than the 224 | /// installed version of the module. 225 | /// 226 | bool compare (const QString& x, const QString& y); 227 | 228 | private: 229 | QString m_url; 230 | 231 | bool m_notifyOnUpdate; 232 | bool m_notifyOnFinish; 233 | bool m_updateAvailable; 234 | bool m_downloaderEnabled; 235 | 236 | QString m_openUrl; 237 | QString m_platform; 238 | QString m_changelog; 239 | QString m_moduleName; 240 | QString m_downloadUrl; 241 | QString m_moduleVersion; 242 | QString m_latestVersion; 243 | 244 | Downloader* m_downloader; 245 | QNetworkAccessManager* m_manager; 246 | }; 247 | 248 | #endif 249 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/definitions/README.md: -------------------------------------------------------------------------------- 1 | # What is this? 2 | 3 | The [updates.json](updates.json) file is the update definitions file. In other words, it lists the latest versions, changelogs and download URLs for each platform. 4 | 5 | The example project downloads the [updates.json](updates.json) file and analyzes in order to: 6 | 7 | - Compare the local (user set) version and the remote version (specified in [updates.json](updates.json)) 8 | - Download the change log for the current platform 9 | - Obtain the download URLs 10 | - Obtain the URL to open (if specified) 11 | 12 | Check the article on this article on the [wiki](#) for more information. 13 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/definitions/updates.json: -------------------------------------------------------------------------------- 1 | { 2 | "updates": { 3 | "windows": { 4 | "open-url": "", 5 | "latest-version": "1.0", 6 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 7 | "changelog": "This is an example changelog for Windows. Go on..." 8 | }, 9 | "osx": { 10 | "open-url": "", 11 | "latest-version": "1.0", 12 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 13 | "changelog": "This is an example changelog for Mac OS X. Go on..." 14 | }, 15 | "linux": { 16 | "open-url": "", 17 | "latest-version": "1.0", 18 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 19 | "changelog": "This is an example changelog for Linux. Go on..." 20 | }, 21 | "ios": { 22 | "open-url": "", 23 | "latest-version": "1.0", 24 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 25 | "changelog": "This is an example changelog for iOS. Go on..." 26 | }, 27 | "android": { 28 | "open-url": "", 29 | "latest-version": "1.0", 30 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 31 | "changelog": "This is an example changelog for Android. Go on..." 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/download/YesItWorks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/3rdParty/QSimpleUpdater/tutorial/download/YesItWorks.jpg -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/src/Window.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This work is free. You can redistribute it and/or modify it under the 5 | * terms of the Do What The Fuck You Want To Public License, Version 2, 6 | * as published by Sam Hocevar. See the COPYING file for more details. 7 | */ 8 | 9 | #include "Window.h" 10 | #include "ui_Window.h" 11 | 12 | #include 13 | 14 | //============================================================================== 15 | // Define the URL of the Update Definitions file 16 | //============================================================================== 17 | 18 | static const QString DEFS_URL = "https://raw.githubusercontent.com/" 19 | "alex-spataru/QSimpleUpdater/master/tutorial/" 20 | "definitions/updates.json"; 21 | 22 | //============================================================================== 23 | // Window::Window 24 | //============================================================================== 25 | 26 | Window::Window (QWidget* parent) : QMainWindow (parent) { 27 | m_ui = new Ui::Window; 28 | m_ui->setupUi (this); 29 | 30 | setWindowTitle (qApp->applicationName()); 31 | 32 | /* QSimpleUpdater is single-instance */ 33 | m_updater = QSimpleUpdater::getInstance(); 34 | 35 | /* Check for updates when the "Check For Updates" button is clicked */ 36 | connect (m_updater, SIGNAL (checkingFinished (QString)), 37 | this, SLOT (updateChangelog (QString))); 38 | 39 | /* React to button clicks */ 40 | connect (m_ui->resetButton, SIGNAL (clicked()), 41 | this, SLOT (resetFields())); 42 | connect (m_ui->closeButton, SIGNAL (clicked()), 43 | this, SLOT (close())); 44 | connect (m_ui->checkButton, SIGNAL (clicked()), 45 | this, SLOT (checkForUpdates())); 46 | 47 | /* Resize the dialog to fit */ 48 | setFixedSize (minimumSizeHint()); 49 | 50 | /* Reset the UI state */ 51 | resetFields(); 52 | } 53 | 54 | //============================================================================== 55 | // Window::~Window 56 | //============================================================================== 57 | 58 | Window::~Window() { 59 | delete m_ui; 60 | } 61 | 62 | //============================================================================== 63 | // Window::checkForUpdates 64 | //============================================================================== 65 | 66 | void Window::resetFields() { 67 | m_ui->installedVersion->setText ("0.1"); 68 | m_ui->enableDownloader->setChecked (true); 69 | m_ui->showAllNotifcations->setChecked (false); 70 | m_ui->showUpdateNotifications->setChecked (true); 71 | } 72 | 73 | //============================================================================== 74 | // Window::checkForUpdates 75 | //============================================================================== 76 | 77 | void Window::checkForUpdates() { 78 | /* Get settings from the UI */ 79 | QString version = m_ui->installedVersion->text(); 80 | bool downloaderEnabled = m_ui->enableDownloader->isChecked(); 81 | bool notifyOnFinish = m_ui->showAllNotifcations->isChecked(); 82 | bool notifyOnUpdate = m_ui->showUpdateNotifications->isChecked(); 83 | 84 | /* Apply the settings */ 85 | m_updater->setModuleVersion (DEFS_URL, version); 86 | m_updater->setNotifyOnFinish (DEFS_URL, notifyOnFinish); 87 | m_updater->setNotifyOnUpdate (DEFS_URL, notifyOnUpdate); 88 | m_updater->setDownloaderEnabled (DEFS_URL, downloaderEnabled); 89 | 90 | /* Check for updates */ 91 | m_updater->checkForUpdates (DEFS_URL); 92 | } 93 | 94 | //============================================================================== 95 | // Window::updateChangelog 96 | //============================================================================== 97 | 98 | void Window::updateChangelog (QString url) { 99 | if (url == DEFS_URL) 100 | m_ui->changelogText->setText (m_updater->getChangelog (url)); 101 | } 102 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/src/Window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This work is free. You can redistribute it and/or modify it under the 5 | * terms of the Do What The Fuck You Want To Public License, Version 2, 6 | * as published by Sam Hocevar. See the COPYING file for more details. 7 | */ 8 | 9 | #ifndef _WINDOW_H 10 | #define _WINDOW_H 11 | 12 | #include 13 | #include 14 | 15 | namespace Ui { 16 | class Window; 17 | } 18 | 19 | class QSimpleUpdater; 20 | 21 | class Window : public QMainWindow { 22 | Q_OBJECT 23 | 24 | public: 25 | explicit Window (QWidget* parent = 0); 26 | ~Window(); 27 | 28 | public slots: 29 | void resetFields(); 30 | void checkForUpdates(); 31 | void updateChangelog (QString url); 32 | 33 | private: 34 | Ui::Window* m_ui; 35 | QSimpleUpdater* m_updater; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/src/Window.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Window 4 | 5 | 6 | 7 | 0 8 | 0 9 | 496 10 | 487 11 | 12 | 13 | 14 | QSimpleUpdater Example 15 | 16 | 17 | 18 | 19 | 20 | 21 | QFrame::NoFrame 22 | 23 | 24 | QFrame::Raised 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | :/icons/update.png 34 | 35 | 36 | 37 | 38 | 39 | 40 | QFrame::NoFrame 41 | 42 | 43 | QFrame::Raised 44 | 45 | 46 | 47 | 48 | 49 | <h1><i>QSimpleUpdater</i></h1> 50 | 51 | 52 | 53 | 54 | 55 | 56 | <i>A simpler way to update your Qt applications...</i> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Qt::Horizontal 67 | 68 | 69 | 70 | 40 71 | 20 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Updater Options 83 | 84 | 85 | 86 | 87 | 88 | Enable integrated downloader 89 | 90 | 91 | true 92 | 93 | 94 | 95 | 96 | 97 | 98 | Notify me when an update is available 99 | 100 | 101 | true 102 | 103 | 104 | 105 | 106 | 107 | 108 | Show all notifications 109 | 110 | 111 | 112 | 113 | 114 | 115 | Set installed version (latest version is 1.0) 116 | 117 | 118 | 119 | 120 | 121 | 122 | 0.1 123 | 124 | 125 | Write a version string... 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | Changelog 136 | 137 | 138 | 139 | 140 | 141 | true 142 | 143 | 144 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 145 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 146 | p, li { white-space: pre-wrap; } 147 | </style></head><body style=" font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;"> 148 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click &quot;Check for Updates&quot; to update this field...</p></body></html> 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | Qt::Vertical 159 | 160 | 161 | 162 | 20 163 | 40 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | QFrame::NoFrame 172 | 173 | 174 | QFrame::Plain 175 | 176 | 177 | 178 | 179 | 180 | Reset Fields 181 | 182 | 183 | 184 | 185 | 186 | 187 | Qt::Horizontal 188 | 189 | 190 | 191 | 40 192 | 20 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | Close 201 | 202 | 203 | 204 | 205 | 206 | 207 | Check for Updates 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Alex Spataru 3 | * 4 | * This work is free. You can redistribute it and/or modify it under the 5 | * terms of the Do What The Fuck You Want To Public License, Version 2, 6 | * as published by Sam Hocevar. See the COPYING file for more details. 7 | */ 8 | 9 | #include "Window.h" 10 | 11 | int main (int argc, char** argv) { 12 | QApplication app (argc, argv); 13 | app.setApplicationVersion ("1.0"); 14 | app.setApplicationName ("Bob's Badass App"); 15 | 16 | Window window; 17 | window.show(); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /3rdParty/QSimpleUpdater/tutorial/tutorial.pro: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2016 Alex Spataru 3 | # 4 | # This work is free. You can redistribute it and/or modify it under the 5 | # terms of the Do What The Fuck You Want To Public License, Version 2, 6 | # as published by Sam Hocevar. See the COPYING file for more details. 7 | # 8 | 9 | TEMPLATE = app 10 | 11 | TARGET = "QSU Tutorial" 12 | 13 | FORMS += $$PWD/src/Window.ui 14 | HEADERS += $$PWD/src/Window.h 15 | SOURCES += $$PWD/src/Window.cpp \ 16 | $$PWD/src/main.cpp 17 | 18 | include ($$PWD/../QSimpleUpdater.pri) 19 | -------------------------------------------------------------------------------- /INSTALL/WifiAssist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/INSTALL/WifiAssist -------------------------------------------------------------------------------- /INSTALL/bin/WifiAssist.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=WifiAssist 3 | Name[zh_CN]=Wifi助手 4 | Name[zh_TW]=Wifi助手 5 | Exec=WifiAssist 6 | Icon=/usr/local/WifiAssist/img/WifiAssist.ico 7 | Terminal=false 8 | X-MultipleArgs=false 9 | Type=Application 10 | Encoding=UTF-8 11 | Categories=Application;Utility; 12 | StartupNotify=true 13 | 14 | -------------------------------------------------------------------------------- /INSTALL/bin/ap.sh: -------------------------------------------------------------------------------- 1 | rm -f ~/.WifiAssist/ap.pid 2 | ./wifi.sh --list-running > ~/.WifiAssist/ap.pid 3 | -------------------------------------------------------------------------------- /INSTALL/bin/client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #rm -f ~/.WifiAssist/client.list 3 | 4 | basepath=$(cd "$(dirname "$0")"; pwd) 5 | $basepath/wifi.sh --list-clients ap0 > ~/.WifiAssist/client.list 6 | -------------------------------------------------------------------------------- /INSTALL/bin/net.sh: -------------------------------------------------------------------------------- 1 | ls /sys/class/net > ~/.WifiAssist/interface.list 2 | -------------------------------------------------------------------------------- /INSTALL/bin/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm -f ~/.WifiAssist/client.list 3 | 4 | echo "mac ip hostname" > ~/.WifiAssist/client.list 5 | echo "aaaa bbbb xiaomi" >> ~/.WifiAssist/client.list 6 | -------------------------------------------------------------------------------- /INSTALL/etc/com.lzjqsdd.WifiAssist.policy: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Run WifiAssist program 8 | WifiAssist Need Your Authentication~~ 9 | accessories-text-editor 10 | 11 | yes 12 | no 13 | yes 14 | 15 | /usr/local/WifiAssist/bin/wifi.sh 16 | true 17 | 18 | 19 | -------------------------------------------------------------------------------- /INSTALL/etc/update.json: -------------------------------------------------------------------------------- 1 | { 2 | "updates": { 3 | "linux": { 4 | "open-url": "", 5 | "latest-version": "0.8", 6 | "download-url": "https://raw.githubusercontent.com/alex-spataru/QSimpleUpdater/master/tutorial/download/YesItWorks.jpg", 7 | "changelog": "This is an example changelog for Linux. Go on..." 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /INSTALL/img/WifiAssist.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/INSTALL/img/WifiAssist.ico -------------------------------------------------------------------------------- /INSTALL/img/WifiAssistIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/INSTALL/img/WifiAssistIcon.png -------------------------------------------------------------------------------- /INSTALL/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -d "/usr/local/WifiAssist" ]; then 4 | echo "Exists Old version,uninstall ..." 5 | sudo ./uninstall.sh 6 | fi 7 | echo "Install WifiAssist ..." 8 | sudo mkdir /usr/local/WifiAssist 9 | sudo cp WifiAssist /usr/local/WifiAssist/ 10 | sudo cp bin/WifiAssist.desktop /usr/local/share/applications 11 | sudo cp etc/com.lzjqsdd.WifiAssist.policy /usr/share/polkit-1/actions/ 12 | sudo cp -r bin/ etc/ img/ /usr/local/WifiAssist/ 13 | sudo ln -s /usr/local/WifiAssist/WifiAssist /usr/local/bin/WifiAssist 14 | echo "Done." 15 | -------------------------------------------------------------------------------- /INSTALL/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "UnInstall WifiAssist ..." 4 | sudo rm -rf /usr/local/WifiAssist 5 | sudo rm -rf /usr/local/bin/WifiAssist 6 | sudo rm -rf /usr/local/share/applications/WifiAssist.desktop 7 | sudo rm -rf /usr/share/polkit-1/actions/com.lzjqsdd.WifiAssist.policy 8 | echo "Done." 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/lzjqsdd/WifiAssist.svg?branch=master)](https://travis-ci.org/lzjqsdd/WifiAssist) 2 | 3 | ## WifiAssit 4 | The easy way to use Wifi through PC. 5 | 类似windows平台下的猎豹免费wifi 6 | 7 | ## Lastest Version(最新版) [Download](https://github.com/lzjqsdd/WifiAssist/archive/v0.8.zip) 8 | 9 | 10 | 11 | ## 测试机型 12 | 13 | WifiAssist在Ubuntu14.04下开发。在以下系统测试及问题: 14 | 15 | Ubuntu14.04 测试通过 16 | 17 | Deepin15.2/3 出现 `Refusing to render service to dead parents.` 18 | 19 | 20 | 21 | - [x] 简单开启并关闭wifi 22 | - [x] 增加接入点设置、wifi名称、密码设置,重置设置 23 | - [x] 桌面图标启动 24 | - [x] 自动获取系统网卡列表 25 | - [x] 增加名称密码修改后提示 26 | - [x] 应用为单进程 27 | - [x] 问题报告及关于 28 | - [x] 系统托盘控制 29 | - [x] 增加接入设备气泡提示 30 | - [x] 接入设备列表页 31 | - [x] 接入设备列表的设备logo显示 32 | - [ ] 增加高级设置项 33 | - [ ] 气泡控制提示 34 | - [ ] 接入设备限速控制、踢人 35 | - [ ] 自动更新 36 | 37 | ## Install 38 | 39 | ```shell 40 | git clone https://github.com/lzjqsdd/WifiAssist.git 41 | cd WifiAssist 42 | sudo ./install.sh 43 | ``` 44 | 45 | ## 或编译安装(32为系统需要自己编译) 46 | ```shell 47 | sudo apt-get update -qq 48 | sudo apt-get -y install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev 49 | sudo apt-get -y install qt5-default qttools5-dev-tools 50 | git clone https://github.com/lzjqsdd/WifiAssist.git 51 | cd WifiAssist/build 52 | qmake ../WifiAssist.pro 53 | make 54 | cd ../INSTALL 55 | sudo ./install.sh 56 | ``` 57 | 58 | ## 运行 59 | - 终端执行WifiAssist 60 | - 或dash搜索应用WifiAssit,点击图标执行。 61 | 62 | ## Uninstall 63 | ```shell 64 | ./uninstall.sh 65 | ``` 66 | (建议卸载按照install.sh中的命令对应着逐个删除。) 67 | ## Snapshot 68 | ![WifiAssit_init1](https://github.com/lzjqsdd/WifiAssist/blob/master/screenshot/WifiAssistForLinux-Main.png) 69 | ![WifiAssit_init2](https://github.com/lzjqsdd/WifiAssist/blob/master/screenshot/WifiAssistForLinux-Settings.png) 70 | ![WifiAssit_init2](https://github.com/lzjqsdd/WifiAssist/blob/master/screenshot/WifiAssistForLinux-Device.png) 71 | ![WifiAssit_init2](https://github.com/lzjqsdd/WifiAssist/blob/master/screenshot/ClientNotify.png) 72 | 73 | ## Thanks 74 | create_ap project:https://github.com/oblique/create_ap 75 | -------------------------------------------------------------------------------- /WifiAssist.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-03-11T22:37:32 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = $$PWD/INSTALL/WifiAssist 12 | TEMPLATE = app 13 | CONFIG += c++11 14 | 15 | include($$PWD/3rdParty/QSimpleUpdater/QSimpleUpdater.pri) 16 | 17 | SOURCES += $$PWD/src/main.cpp\ 18 | $$PWD/src/mainwindow.cpp \ 19 | $$PWD/src/wifi.cpp \ 20 | $$PWD/src/wsettings.cpp \ 21 | $$PWD/src/wdevices.cpp \ 22 | $$PWD/src/about.cpp \ 23 | $$PWD/src/singleinstance.cpp \ 24 | $$PWD/src/device.cpp \ 25 | $$PWD/src/wthread.cpp \ 26 | $$PWD/src/wlistwidgetitem.cpp \ 27 | 28 | HEADERS += src/mainwindow.h \ 29 | $$PWD/src/wifi.h \ 30 | $$PWD/src/wsettings.h \ 31 | $$PWD/src/wdevices.h \ 32 | $$PWD/src/about.h \ 33 | $$PWD/src/singleinstance.h \ 34 | $$PWD/src/device.h \ 35 | $$PWD/src/wthread.h \ 36 | $$PWD/src/wlistwidgetitem.h \ 37 | 38 | FORMS += $$PWD/src/mainwindow.ui \ 39 | $$PWD/src/about.ui \ 40 | $$PWD/src/wlistwidgetitem.ui 41 | 42 | DISTFILES += 43 | 44 | RESOURCES += \ 45 | $$PWD/resources/icon.qrc \ 46 | $$PWD/resources/i18n.qrc \ 47 | resources/corpo.qrc 48 | 49 | TRANSLATIONS += \ 50 | $$PWD/resources/i18n/en_US.ts \ 51 | $$PWD/resources/i18n/zh_CN.ts \ 52 | $$PWD/resources/i18n/zh_TW.ts \ 53 | -------------------------------------------------------------------------------- /config.ini: -------------------------------------------------------------------------------- 1 | [settings] 2 | ACCESSPOINT=192.168.12.2 3 | APNAME=WifiAssistForLinux 4 | INTERFACE_CREATED=wlan0 5 | INTERFACE_SHARED=eth0 6 | PASSWORD=1234567890 7 | PATH=bin/wifi.sh 8 | -------------------------------------------------------------------------------- /resources/about.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | img/WifiAssistIcon_100x100.jpg 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/corpo.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | img/corpicon/Apple.png 4 | img/corpicon/Sony.png 5 | img/corpicon/Apple.ico 6 | img/corpicon/SamsungE.ico 7 | img/corpicon/SonyComp.ico 8 | img/corpicon/XiaomiCo.ico 9 | 10 | 11 | -------------------------------------------------------------------------------- /resources/i18n.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | i18n/zh_CN.qm 4 | i18n/zh_TW.qm 5 | i18n/en_US.qm 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/i18n/en_US.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/i18n/en_US.qm -------------------------------------------------------------------------------- /resources/i18n/en_US.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | About 6 | 7 | 8 | Dialog 9 | 10 | 11 | 12 | 13 | WifiAssist 基于QT5开发,帮助用户在Linux系统上快速建立热点的小工具项目地址:www.github.com/lzjqsdd/WifiAssist 14 | 15 | 16 | 17 | 18 | Downloader 19 | 20 | 21 | 22 | Updater 23 | Updater 24 | 25 | 26 | 27 | 28 | 29 | Downloading updates 30 | 31 | 32 | 33 | 34 | Time remaining: 0 minutes 35 | 36 | 37 | 38 | 39 | Open 40 | 41 | 42 | 43 | 44 | 45 | Stop 46 | 47 | 48 | 49 | 50 | 51 | Time remaining 52 | 53 | 54 | 55 | 56 | unknown 57 | 58 | 59 | 60 | 61 | Error 62 | 63 | 64 | 65 | 66 | Cannot find downloaded update! 67 | 68 | 69 | 70 | 71 | Click "OK" to begin installing the update 72 | 73 | 74 | 75 | 76 | In order to install the update, you may need to quit the application. 77 | 78 | 79 | 80 | 81 | Click the "Open" button to apply the update 82 | 83 | 84 | 85 | 86 | Are you sure you want to cancel the download? 87 | 88 | 89 | 90 | 91 | Close 92 | 93 | 94 | 95 | 96 | Download complete! 97 | 98 | 99 | 100 | 101 | The installer will open separately 102 | 103 | 104 | 105 | 106 | 107 | %1 bytes 108 | 109 | 110 | 111 | 112 | 113 | %1 KB 114 | 115 | 116 | 117 | 118 | 119 | %1 MB 120 | 121 | 122 | 123 | 124 | of 125 | 126 | 127 | 128 | 129 | Downloading Updates 130 | 131 | 132 | 133 | 134 | Time Remaining 135 | 136 | 137 | 138 | 139 | Unknown 140 | 141 | 142 | 143 | 144 | About %1 hours 145 | 146 | 147 | 148 | 149 | About %1 minutes 150 | 151 | 152 | 153 | 154 | %1 seconds 155 | 156 | 157 | 158 | 159 | MainWindow 160 | 161 | 162 | 163 | WifiAssist 164 | WifiAssist 165 | 166 | 167 | 168 | <html><head/><body><p>Show Connected Clients</p></body></html> 169 | Show Connect Clients 170 | 171 | 172 | 173 | Wifi 174 | Wifi 175 | 176 | 177 | START 178 | START 179 | 180 | 181 | 182 | 183 | WifiName 184 | WifiName 185 | 186 | 187 | 188 | 189 | Password 190 | Password 191 | 192 | 193 | 194 | Devices 195 | Devices 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | Settings 208 | Settings 209 | 210 | 211 | 212 | SAVE 213 | SAVE 214 | 215 | 216 | 217 | RESET 218 | RESET 219 | 220 | 221 | 222 | 223 | AccessPoint 224 | AccessPoint 225 | 226 | 227 | 228 | WifiInterface 229 | WifiInterface 230 | 231 | 232 | 233 | 234 | 235 | SharedInterface 236 | SharedInterface 237 | 238 | 239 | 240 | Option 241 | Option 242 | 243 | 244 | 245 | CheckUpdate 246 | CheckUpdate 247 | 248 | 249 | 250 | About 251 | About 252 | 253 | 254 | 255 | APInterface 256 | APInterface 257 | 258 | 259 | 260 | Language 261 | Language 262 | 263 | 264 | 265 | Stop Wifi 266 | Stop Wifi 267 | 268 | 269 | 270 | Start Wifi 271 | Start Wifi 272 | 273 | 274 | 275 | Hide WifiAssist 276 | Hide WifiAssist 277 | 278 | 279 | Quit 280 | Quit 281 | 282 | 283 | 284 | Restart Wifi 285 | Restart Wifi 286 | 287 | 288 | 289 | Show WifiAssist 290 | Show WifiAssist 291 | 292 | 293 | 294 | &Hide WifiAssist 295 | 296 | 297 | 298 | 299 | &Quit 300 | 301 | 302 | 303 | 304 | &Start Wifi 305 | 306 | 307 | 308 | 309 | Apply WifiName Success! 310 | Apply WifiName Success! 311 | 312 | 313 | 314 | Password Should More Than 8 Characters! 315 | Password Should More Than 8 Characters! 316 | 317 | 318 | 319 | Apply Password Success! 320 | Apply Password Success! 321 | 322 | 323 | 324 | Access Point Can't Be Empty! 325 | Access Point Can't Be Empty! 326 | 327 | 328 | 329 | Wifi Interface Can't Be Empty! 330 | Wifi Interface Can't Be Empty! 331 | 332 | 333 | 334 | Shared Interface Can't Be Empty! 335 | Shared Interface Can't Be Empty! 336 | 337 | 338 | 339 | This Wifi Interface May not work,Still Use it? 340 | This Wifi Interface May not work,Still Use it? 341 | 342 | 343 | 344 | This Shared Interface May not work,Still Use it? 345 | This Shared Interface May not work,Still Use it? 346 | 347 | 348 | 349 | Apply Success! 350 | Apply Success! 351 | 352 | 353 | 354 | Reset Success! 355 | Reset Success! 356 | 357 | 358 | 359 | Minmize to SystemTray 360 | Minmize to SystemTray 361 | 362 | 363 | 364 | English 365 | English 366 | 367 | 368 | 369 | Updater 370 | 371 | 372 | Would you like to download the update now? 373 | 374 | 375 | 376 | 377 | Version %1 of %2 has been released! 378 | 379 | 380 | 381 | 382 | No updates are available for the moment 383 | 384 | 385 | 386 | 387 | Congratulations! You are running the latest version of %1 388 | 389 | 390 | 391 | 392 | WSettings 393 | 394 | 395 | 396 | 397 | 398 | Warning! 399 | 400 | 401 | 402 | 403 | Can't Get Interface List 404 | 405 | 406 | 407 | 408 | 409 | 410 | Can't find interface Record 411 | 412 | 413 | 414 | 415 | -------------------------------------------------------------------------------- /resources/i18n/zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/i18n/zh_CN.qm -------------------------------------------------------------------------------- /resources/i18n/zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | About 6 | 7 | 8 | Dialog 9 | 10 | 11 | 12 | 13 | WifiAssist 基于QT5开发,帮助用户在Linux系统上快速建立热点的小工具项目地址:www.github.com/lzjqsdd/WifiAssist 14 | WifiAssist 基于QT5开发,帮助用户在Linux系统上快速建立热点的小工具项目地址:www.github.com/lzjqsdd/WifiAssist 15 | 16 | 17 | 18 | Downloader 19 | 20 | 21 | 22 | Updater 23 | 更新程序 24 | 25 | 26 | 27 | 28 | 29 | Downloading updates 30 | 正在下载更新 31 | 32 | 33 | 34 | Time remaining: 0 minutes 35 | 剩余 0 分钟 36 | 37 | 38 | 39 | Open 40 | 打开 41 | 42 | 43 | 44 | 45 | Stop 46 | 停止 47 | 48 | 49 | 50 | 51 | Time remaining 52 | 剩余时间 53 | 54 | 55 | 56 | unknown 57 | 未知 58 | 59 | 60 | 61 | Error 62 | 错误 63 | 64 | 65 | 66 | Cannot find downloaded update! 67 | 无法找到下载的更新 68 | 69 | 70 | 71 | Click "OK" to begin installing the update 72 | 点击OK开始安装更新 73 | 74 | 75 | 76 | In order to install the update, you may need to quit the application. 77 | 78 | 79 | 80 | 81 | Click the "Open" button to apply the update 82 | 83 | 84 | 85 | 86 | Are you sure you want to cancel the download? 87 | 88 | 89 | 90 | 91 | Close 92 | 93 | 94 | 95 | 96 | Download complete! 97 | 98 | 99 | 100 | 101 | The installer will open separately 102 | 103 | 104 | 105 | 106 | 107 | %1 bytes 108 | 109 | 110 | 111 | 112 | 113 | %1 KB 114 | 115 | 116 | 117 | 118 | 119 | %1 MB 120 | 121 | 122 | 123 | 124 | of 125 | 126 | 127 | 128 | 129 | Downloading Updates 130 | 131 | 132 | 133 | 134 | Time Remaining 135 | 136 | 137 | 138 | 139 | Unknown 140 | 141 | 142 | 143 | 144 | About %1 hours 145 | 146 | 147 | 148 | 149 | About %1 minutes 150 | 151 | 152 | 153 | 154 | %1 seconds 155 | 156 | 157 | 158 | 159 | MainWindow 160 | 161 | 162 | 163 | WifiAssist 164 | Wifi助手 165 | 166 | 167 | 168 | <html><head/><body><p>Show Connected Clients</p></body></html> 169 | 显示连接设备 170 | 171 | 172 | 173 | Wifi 174 | WIFI 175 | 176 | 177 | 178 | 179 | WifiName 180 | Wifi名称 181 | 182 | 183 | 184 | 185 | Password 186 | Wifi密码 187 | 188 | 189 | 190 | Devices 191 | 接入设备 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | Settings 204 | 设置 205 | 206 | 207 | 208 | SAVE 209 | 保存 210 | 211 | 212 | 213 | RESET 214 | 重置 215 | 216 | 217 | 218 | 219 | AccessPoint 220 | 接入点 221 | 222 | 223 | 224 | WifiInterface 225 | Wifi接口 226 | 227 | 228 | 229 | 230 | 231 | SharedInterface 232 | 共享网卡 233 | 234 | 235 | 236 | Option 237 | 首选项 238 | 239 | 240 | 241 | CheckUpdate 242 | 检查更新 243 | 244 | 245 | 246 | About 247 | 关于 248 | 249 | 250 | 251 | APInterface 252 | 热点网卡 253 | 254 | 255 | 256 | Language 257 | 语言 258 | 259 | 260 | 261 | Stop Wifi 262 | 停止 Wifi 263 | 264 | 265 | 266 | Start Wifi 267 | 启动 Wifi 268 | 269 | 270 | 271 | Hide WifiAssist 272 | 隐藏 273 | 274 | 275 | Quit 276 | 退出 277 | 278 | 279 | 280 | Restart Wifi 281 | 重启Wifi 282 | 283 | 284 | 285 | Show WifiAssist 286 | 显示 287 | 288 | 289 | 290 | &Hide WifiAssist 291 | 隐藏 292 | 293 | 294 | 295 | &Quit 296 | 退出 297 | 298 | 299 | 300 | &Start Wifi 301 | 启动 Wifi 302 | 303 | 304 | &Restart Wifi 305 | 重启Wifi 306 | 307 | 308 | &Show WifiAssist 309 | 显示 310 | 311 | 312 | &Stop Wifi 313 | 停止 Wifi 314 | 315 | 316 | 317 | Apply WifiName Success! 318 | 修改Wifi名称成功! 319 | 320 | 321 | 322 | Password Should More Than 8 Characters! 323 | 密码至少需要8个字符! 324 | 325 | 326 | 327 | Apply Password Success! 328 | 修改密码成功! 329 | 330 | 331 | 332 | Access Point Can't Be Empty! 333 | 接入点不能为空! 334 | 335 | 336 | 337 | Wifi Interface Can't Be Empty! 338 | Wifi接口不能为空! 339 | 340 | 341 | 342 | Shared Interface Can't Be Empty! 343 | 共享网卡不能为空! 344 | 345 | 346 | 347 | This Wifi Interface May not work,Still Use it? 348 | 该接口可能无法正常工作,仍要继续么? 349 | 350 | 351 | 352 | This Shared Interface May not work,Still Use it? 353 | 该共享网卡可能无法正常工作,仍要继续么? 354 | 355 | 356 | 357 | Apply Success! 358 | 修改成功! 359 | 360 | 361 | 362 | Reset Success! 363 | 重置成功! 364 | 365 | 366 | 367 | Minmize to SystemTray 368 | 最小化到系统托盘 369 | 370 | 371 | 372 | English 373 | 简体中文 374 | 375 | 376 | 377 | Updater 378 | 379 | 380 | Would you like to download the update now? 381 | 382 | 383 | 384 | 385 | Version %1 of %2 has been released! 386 | 387 | 388 | 389 | 390 | No updates are available for the moment 391 | 392 | 393 | 394 | 395 | Congratulations! You are running the latest version of %1 396 | 397 | 398 | 399 | 400 | WSettings 401 | 402 | 403 | 404 | 405 | 406 | Warning! 407 | 警告! 408 | 409 | 410 | 411 | Can't Get Interface List 412 | 无法获取网络借口列表! 413 | 414 | 415 | 416 | 417 | 418 | Can't find interface Record 419 | 找不到网络接口记录! 420 | 421 | 422 | 423 | -------------------------------------------------------------------------------- /resources/i18n/zh_TW.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/i18n/zh_TW.qm -------------------------------------------------------------------------------- /resources/i18n/zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | About 6 | 7 | 8 | Dialog 9 | 10 | 11 | 12 | 13 | WifiAssist 基于QT5开发,帮助用户在Linux系统上快速建立热点的小工具项目地址:www.github.com/lzjqsdd/WifiAssist 14 | 15 | 16 | 17 | 18 | Downloader 19 | 20 | 21 | 22 | Updater 23 | 24 | 25 | 26 | 27 | 28 | 29 | Downloading updates 30 | 31 | 32 | 33 | 34 | Time remaining: 0 minutes 35 | 36 | 37 | 38 | 39 | Open 40 | 41 | 42 | 43 | 44 | 45 | Stop 46 | 47 | 48 | 49 | 50 | 51 | Time remaining 52 | 53 | 54 | 55 | 56 | unknown 57 | 58 | 59 | 60 | 61 | Error 62 | 63 | 64 | 65 | 66 | Cannot find downloaded update! 67 | 68 | 69 | 70 | 71 | Click "OK" to begin installing the update 72 | 73 | 74 | 75 | 76 | In order to install the update, you may need to quit the application. 77 | 78 | 79 | 80 | 81 | Click the "Open" button to apply the update 82 | 83 | 84 | 85 | 86 | Are you sure you want to cancel the download? 87 | 88 | 89 | 90 | 91 | Close 92 | 93 | 94 | 95 | 96 | Download complete! 97 | 98 | 99 | 100 | 101 | The installer will open separately 102 | 103 | 104 | 105 | 106 | 107 | %1 bytes 108 | 109 | 110 | 111 | 112 | 113 | %1 KB 114 | 115 | 116 | 117 | 118 | 119 | %1 MB 120 | 121 | 122 | 123 | 124 | of 125 | 126 | 127 | 128 | 129 | Downloading Updates 130 | 131 | 132 | 133 | 134 | Time Remaining 135 | 136 | 137 | 138 | 139 | Unknown 140 | 141 | 142 | 143 | 144 | About %1 hours 145 | 146 | 147 | 148 | 149 | About %1 minutes 150 | 151 | 152 | 153 | 154 | %1 seconds 155 | 156 | 157 | 158 | 159 | MainWindow 160 | 161 | 162 | 163 | WifiAssist 164 | 165 | 166 | 167 | 168 | <html><head/><body><p>Show Connected Clients</p></body></html> 169 | 170 | 171 | 172 | 173 | Wifi 174 | 175 | 176 | 177 | 178 | 179 | WifiName 180 | 181 | 182 | 183 | 184 | 185 | Password 186 | 187 | 188 | 189 | 190 | Devices 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | Settings 204 | 設置 205 | 206 | 207 | 208 | SAVE 209 | 210 | 211 | 212 | 213 | RESET 214 | 215 | 216 | 217 | 218 | 219 | AccessPoint 220 | 221 | 222 | 223 | 224 | WifiInterface 225 | 226 | 227 | 228 | 229 | 230 | 231 | SharedInterface 232 | 233 | 234 | 235 | 236 | Option 237 | 238 | 239 | 240 | 241 | CheckUpdate 242 | 243 | 244 | 245 | 246 | About 247 | 248 | 249 | 250 | 251 | APInterface 252 | 253 | 254 | 255 | 256 | Language 257 | 258 | 259 | 260 | 261 | &Hide WifiAssist 262 | 263 | 264 | 265 | 266 | &Quit 267 | 268 | 269 | 270 | 271 | &Start Wifi 272 | 273 | 274 | 275 | 276 | Hide WifiAssist 277 | 278 | 279 | 280 | 281 | Show WifiAssist 282 | 283 | 284 | 285 | 286 | Restart Wifi 287 | 288 | 289 | 290 | 291 | Stop Wifi 292 | 293 | 294 | 295 | 296 | Start Wifi 297 | 298 | 299 | 300 | 301 | Apply WifiName Success! 302 | 303 | 304 | 305 | 306 | Password Should More Than 8 Characters! 307 | 308 | 309 | 310 | 311 | Apply Password Success! 312 | 313 | 314 | 315 | 316 | Access Point Can't Be Empty! 317 | 318 | 319 | 320 | 321 | Wifi Interface Can't Be Empty! 322 | 323 | 324 | 325 | 326 | Shared Interface Can't Be Empty! 327 | 328 | 329 | 330 | 331 | This Wifi Interface May not work,Still Use it? 332 | 333 | 334 | 335 | 336 | This Shared Interface May not work,Still Use it? 337 | 338 | 339 | 340 | 341 | Apply Success! 342 | 343 | 344 | 345 | 346 | Reset Success! 347 | 348 | 349 | 350 | 351 | Minmize to SystemTray 352 | 353 | 354 | 355 | 356 | English 357 | 台湾繁体 358 | 359 | 360 | 361 | Updater 362 | 363 | 364 | Would you like to download the update now? 365 | 366 | 367 | 368 | 369 | Version %1 of %2 has been released! 370 | 371 | 372 | 373 | 374 | No updates are available for the moment 375 | 376 | 377 | 378 | 379 | Congratulations! You are running the latest version of %1 380 | 381 | 382 | 383 | 384 | WSettings 385 | 386 | 387 | 388 | 389 | 390 | Warning! 391 | 392 | 393 | 394 | 395 | Can't Get Interface List 396 | 397 | 398 | 399 | 400 | 401 | 402 | Can't find interface Record 403 | 404 | 405 | 406 | 407 | -------------------------------------------------------------------------------- /resources/icon.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | img/edit.ico 4 | img/WifiAssist.ico 5 | img/Settings.ico 6 | img/Devices.ico 7 | img/WifiAssistIcon_100x100.jpg 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/img/Devices.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/Devices.ico -------------------------------------------------------------------------------- /resources/img/Settings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/Settings.ico -------------------------------------------------------------------------------- /resources/img/WifiAssist.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/WifiAssist.ico -------------------------------------------------------------------------------- /resources/img/WifiAssistIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/WifiAssistIcon.png -------------------------------------------------------------------------------- /resources/img/WifiAssistIcon_100x100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/WifiAssistIcon_100x100.jpg -------------------------------------------------------------------------------- /resources/img/corpicon/Apple.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/Apple.ico -------------------------------------------------------------------------------- /resources/img/corpicon/Apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/Apple.png -------------------------------------------------------------------------------- /resources/img/corpicon/SamsungE.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/SamsungE.ico -------------------------------------------------------------------------------- /resources/img/corpicon/Sony.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/Sony.png -------------------------------------------------------------------------------- /resources/img/corpicon/SonyComp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/SonyComp.ico -------------------------------------------------------------------------------- /resources/img/corpicon/XiaomiCo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/corpicon/XiaomiCo.ico -------------------------------------------------------------------------------- /resources/img/edit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/resources/img/edit.ico -------------------------------------------------------------------------------- /screenshot/ClientNotify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/screenshot/ClientNotify.png -------------------------------------------------------------------------------- /screenshot/WifiAssistForLinux-Device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/screenshot/WifiAssistForLinux-Device.png -------------------------------------------------------------------------------- /screenshot/WifiAssistForLinux-Main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/screenshot/WifiAssistForLinux-Main.png -------------------------------------------------------------------------------- /screenshot/WifiAssistForLinux-Settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzjqsdd/WifiAssist/b457db43cecc8635851efd9525dfe2413777ffc0/screenshot/WifiAssistForLinux-Settings.png -------------------------------------------------------------------------------- /src/about.cpp: -------------------------------------------------------------------------------- 1 | #include "about.h" 2 | #include "ui_about.h" 3 | 4 | About::About(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::About) 7 | { 8 | ui->setupUi(this); 9 | ui->text_About->setEnabled(false); 10 | showAbout(); 11 | } 12 | 13 | About::~About() 14 | { 15 | delete ui; 16 | } 17 | 18 | void About::showAbout() 19 | { 20 | QString text_about = tr("WifiAssist 基于QT5开发,帮助用户在Linux系统上快速建立热点的小工具" 21 | "项目地址:www.github.com/lzjqsdd/WifiAssist"); 22 | 23 | ui->text_About->setText(text_about); 24 | } 25 | -------------------------------------------------------------------------------- /src/about.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUT_H 2 | #define ABOUT_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class About; 8 | } 9 | 10 | class About : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit About(QWidget *parent = 0); 16 | ~About(); 17 | 18 | private: 19 | Ui::About *ui; 20 | void showAbout(); 21 | }; 22 | 23 | #endif // ABOUT_H 24 | -------------------------------------------------------------------------------- /src/about.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | About 4 | 5 | 6 | 7 | 0 8 | 0 9 | 324 10 | 275 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | background-color: rgb(255, 255, 255); 18 | 19 | 20 | 21 | 22 | 220 23 | 240 24 | 80 25 | 30 26 | 27 | 28 | 29 | 30 | 80 31 | 30 32 | 33 | 34 | 35 | 36 | 80 37 | 30 38 | 39 | 40 | 41 | background-color: rgb(21, 126, 251); 42 | border-width:0px; 43 | selection-background-color: rgb(192, 0, 91); 44 | 45 | 46 | Qt::Horizontal 47 | 48 | 49 | QDialogButtonBox::Ok 50 | 51 | 52 | 53 | 54 | 55 | 110 56 | 0 57 | 101 58 | 91 59 | 60 | 61 | 62 | 63 | 64 | 65 | :/img/WifiAssistIcon_100x100.jpg 66 | 67 | 68 | 69 | 70 | 71 | 10 72 | 110 73 | 301 74 | 111 75 | 76 | 77 | 78 | border-radius:8px; 79 | border-width:1px 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | buttonBox_About 89 | accepted() 90 | About 91 | accept() 92 | 93 | 94 | 248 95 | 254 96 | 97 | 98 | 157 99 | 274 100 | 101 | 102 | 103 | 104 | buttonBox_About 105 | rejected() 106 | About 107 | reject() 108 | 109 | 110 | 316 111 | 260 112 | 113 | 114 | 286 115 | 274 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/device.cpp: -------------------------------------------------------------------------------- 1 | #include "device.h" 2 | 3 | Device::Device() 4 | { 5 | 6 | } 7 | 8 | Device::Device(QString mac,QString ip,QString hostname) 9 | { 10 | _mac = mac; 11 | _ip = ip; 12 | _hostname = hostname; 13 | } 14 | 15 | QString Device::ip() const 16 | { 17 | return _ip; 18 | } 19 | 20 | QString Device::mac() const 21 | { 22 | return _mac; 23 | } 24 | 25 | QString Device::hostname() const 26 | { 27 | return _hostname; 28 | } 29 | 30 | QString Device::limitSpeed() const 31 | { 32 | return _limitSpeed; 33 | } 34 | 35 | void Device::setLimitSpeed(const QString &limitSpeed) 36 | { 37 | _limitSpeed = limitSpeed; 38 | } 39 | 40 | QString Device::logo() const 41 | { 42 | return _logo; 43 | } 44 | 45 | void Device::setLogo(const QString &logo) 46 | { 47 | _logo = logo; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/device.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_H 2 | #define DEVICE_H 3 | 4 | #include 5 | 6 | class Device 7 | { 8 | public: 9 | Device(); 10 | Device(QString mac,QString ip,QString hostname); 11 | 12 | QString ip() const; 13 | QString mac() const; 14 | QString hostname() const; 15 | QString limitSpeed() const; 16 | void setLimitSpeed(const QString &limitSpeed); 17 | QString logo() const; 18 | void setLogo(const QString &logo); 19 | 20 | //enum LOGO 21 | //{ 22 | // SONY = ":img/corpicon/Sony.png", 23 | // Xiaomi = ":img/corpicon/XiaomiCo.png", 24 | // Apple = ":img/corpicon/Apple.png" 25 | //}; 26 | 27 | private: 28 | QString _ip; 29 | QString _mac; 30 | QString _hostname; 31 | QString _limitSpeed; 32 | QString _logo; 33 | 34 | }; 35 | 36 | #endif // DEVICE_H 37 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "singleinstance.h" 3 | #include "QSimpleUpdater.h" 4 | #include "wsettings.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | const QString UPDATES_URL = "https://raw.githubusercontent.com/lzjqsdd/WifiAssist/master/etc/UPDATES.json"; 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QApplication::setDesktopSettingsAware(false); 16 | QApplication app(argc, argv); 17 | 18 | //set application information 19 | app.setApplicationName("WifiAssist"); 20 | app.setApplicationVersion("v0.6.2"); 21 | app.setWindowIcon(QIcon("img/WifiAssit.ico")); 22 | 23 | //Prevent many instances of the app to be launcher 24 | QString name = "com.lzjqsdd.wifiassist"; 25 | SingleInstance instance; 26 | if(instance.hasPrevious(name)) 27 | { 28 | return EXIT_SUCCESS; 29 | } 30 | 31 | instance.listen(name); 32 | 33 | //Create and Show the app; 34 | MainWindow w; 35 | w.show(); 36 | w.move ((QApplication::desktop()->width() - w.width())/2,(QApplication::desktop()->height() - w.height())/2); 37 | 38 | // Bring the WifiAssist window to the front 39 | QObject::connect(&instance, &SingleInstance::newInstance, [&](){ 40 | (&w)->setMainWindowVisibility(true); 41 | }); 42 | 43 | 44 | //Update WifiAssist 45 | // Disable the integrated downloader, just open a link in a web browser 46 | QSimpleUpdater::getInstance()->setDownloaderEnabled (UPDATES_URL, false); 47 | 48 | // Only notify the user when an update is available 49 | QSimpleUpdater::getInstance()->setNotifyOnUpdate (UPDATES_URL, true); 50 | QSimpleUpdater::getInstance()->setNotifyOnFinish (UPDATES_URL, false); 51 | 52 | // Check for updates 53 | QSimpleUpdater::getInstance()->checkForUpdates (UPDATES_URL); 54 | return app.exec(); 55 | } 56 | -------------------------------------------------------------------------------- /src/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | MainWindow::MainWindow(QWidget *parent) : 14 | QMainWindow(parent), 15 | ui(new Ui::MainWindow), 16 | m_mutex(0), 17 | m_information_count(0), 18 | m_wifi(new Wifi()), 19 | m_wsettings(new WSettings()), 20 | m_wdevices(new WDevices()), 21 | m_wthread(new WThread()), 22 | m_translator(new QTranslator(this)), 23 | m_trayIcon(new QSystemTrayIcon(this)), 24 | m_restoreAction(new QAction(this)), 25 | m_quitAction(new QAction(this)), 26 | m_controlWifi(new QAction(this)), 27 | m_restartWifi(new QAction(this)), 28 | m_trayIconMenu(new QMenu(this)) 29 | { 30 | setupLanguage(); 31 | ui->setupUi(this); 32 | 33 | initUIValue(); 34 | setupTrayIcon(); 35 | setupSignalsSlots(); 36 | 37 | //setupDevicesForTest(); 38 | } 39 | 40 | MainWindow::~MainWindow() 41 | { 42 | m_wifi->stopWifi(); 43 | delete ui; 44 | } 45 | 46 | void MainWindow::setupSignalsSlots() 47 | { 48 | //signal-slot: 49 | //connect(_thread,SIGNAL(updateUI(QStringList)),this,SLOT(updateClients(QStringList)),Qt::QueuedConnection); 50 | 51 | qRegisterMetaType >("QVector"); 52 | 53 | connect(m_restoreAction, &QAction::triggered, this, [this](){ 54 | setMainWindowVisibility(isHidden() 55 | || windowState() == Qt::WindowMinimized 56 | || (qApp->applicationState() == Qt::ApplicationInactive)); 57 | }); 58 | connect(m_quitAction, &QAction::triggered, this, &MainWindow::close); 59 | connect(m_controlWifi,&QAction::triggered,this,&MainWindow::on_pushButton_clicked); 60 | connect(m_restartWifi,&QAction::triggered,this,[this](){ 61 | ui->pushButton->setText("Restaring..."); 62 | m_wifi->restartWifi(); 63 | ui->pushButton->setText("STOP"); 64 | }); 65 | 66 | connect(m_wthread,SIGNAL(clientAdd(QVector)),this,SLOT(updateNewClients(QVector)),Qt::QueuedConnection); 67 | connect(m_wthread,SIGNAL(clientLeave(QVector)),this,SLOT(updateLeaveClients(QVector)),Qt::QueuedConnection); 68 | connect(m_wthread,SIGNAL(clientUpdate(QVector)),this,SLOT(updateDevicesList(QVector)),Qt::QueuedConnection); 69 | } 70 | 71 | void MainWindow::setMainWindowVisibility(bool state) 72 | { 73 | if(state){ 74 | showNormal(); 75 | setWindowState(Qt::WindowNoState); 76 | qApp->processEvents(); 77 | setWindowState(Qt::WindowActive); 78 | qApp->processEvents(); 79 | qApp->setActiveWindow(this); 80 | qApp->processEvents(); 81 | m_restoreAction->setText(tr("Hide WifiAssist")); 82 | }else{ 83 | m_restoreAction->setText(tr("Show WifiAssist")); 84 | hide(); 85 | } 86 | } 87 | 88 | 89 | void MainWindow::initUIValue() 90 | { 91 | ui->tabWidget->setCurrentIndex(0); 92 | //ui->tabWidget->removeTab(1); 93 | 94 | ui->pushButton->setText("START"); 95 | 96 | ui->lineEdit_name->setText(m_wsettings->APName()); 97 | ui->lineEdit_pwd ->setText(m_wsettings->Password()); 98 | ui->lineEdit_ap->setText(m_wsettings->AccessPoint()); 99 | 100 | 101 | //get interface list 102 | QStringList interface_list = m_wsettings->getInterfaceList(); 103 | 104 | ui->comboBox_createdinterface->clear(); 105 | ui->comboBox_createdinterface->addItems(interface_list); 106 | ui->comboBox_createdinterface->setCurrentText(m_wsettings->Interface_Create()); 107 | ui->comboBox_shareinterface->clear(); 108 | ui->comboBox_shareinterface->addItems(interface_list); 109 | ui->comboBox_shareinterface->setCurrentText(m_wsettings->Interface_Shared()); 110 | 111 | setupLanguageOption(); 112 | ui->label_tip->setHidden(true); 113 | 114 | //init ui text 115 | ui->label_ap->setText(tr("AccessPoint")); 116 | ui->label_name->setText(tr("WifiName")); 117 | ui->label_pwd->setText(tr("Password")); 118 | ui->label_shareinterface->setText(tr("SharedInterface")); 119 | ui->label_createdinterface->setText(tr("APInterface")); 120 | ui->label_language->setText(tr("Language")); 121 | ui->comboBox_language->setCurrentIndex(0); 122 | } 123 | 124 | void MainWindow::setupLanguage() 125 | { 126 | QString languageFile = QString(":/i18n/").append(m_wsettings->Language()).append(".qm"); 127 | m_translator->load(languageFile); 128 | qApp->installTranslator(m_translator); 129 | } 130 | 131 | void MainWindow::setupTrayIcon() 132 | { 133 | //Check if System Support SystemTrayIcon. 134 | //Linux:X11 135 | if(QSystemTrayIcon::isSystemTrayAvailable()) 136 | { 137 | 138 | m_restoreAction->setText(tr("&Hide WifiAssist")); 139 | m_quitAction->setText(tr("&Quit")); 140 | m_controlWifi->setText(tr("&Start Wifi")); 141 | m_restartWifi->setText(tr("Restart Wifi")); 142 | 143 | m_trayIconMenu->addAction(m_restoreAction); 144 | m_trayIconMenu->addSeparator(); 145 | m_trayIconMenu->addAction(m_controlWifi); 146 | m_trayIconMenu->addAction(m_restartWifi); 147 | m_trayIconMenu->addSeparator(); 148 | m_trayIconMenu->addAction(m_quitAction); 149 | 150 | m_trayIcon->setIcon(QIcon(":img/WifiAssist.ico")); 151 | m_trayIcon->setContextMenu(m_trayIconMenu); 152 | m_trayIcon->show(); 153 | } 154 | } 155 | 156 | void MainWindow::on_pushButton_clicked() 157 | { 158 | 159 | QString text = ui->pushButton->text(); 160 | if(QString::compare(text,"START") == 0) 161 | { 162 | if(m_wifi->startWifi()) 163 | { 164 | ui->pushButton->setText("STOP"); 165 | m_controlWifi->setText(tr("Stop Wifi")); 166 | m_wthread->start(); 167 | } 168 | } 169 | else if(QString::compare(text,"STOP") == 0) 170 | { 171 | if(m_wifi->stopWifi()) 172 | { 173 | ui->pushButton->setText("START"); 174 | m_controlWifi->setText(tr("Start Wifi")); 175 | m_wthread->stop(); 176 | } 177 | } 178 | else 179 | { 180 | QMessageBox::warning(NULL,"Error","Wrong!"); 181 | } 182 | } 183 | 184 | void MainWindow::on_pushButton_name_clicked() 185 | { 186 | ui->lineEdit_name->setEnabled(true); 187 | } 188 | 189 | void MainWindow::on_lineEdit_name_editingFinished() 190 | { 191 | 192 | if(m_mutex == 0) 193 | { 194 | m_mutex = 1; 195 | return; 196 | } 197 | else 198 | { 199 | m_mutex = 0; 200 | ui->lineEdit_name->setEnabled(false); 201 | //if config not changed,return 202 | if(ui->lineEdit_name->text() == m_wsettings->APName()) 203 | return; 204 | 205 | ui->lineEdit_name->setEnabled(false); 206 | m_wsettings->setAPName(ui->lineEdit_name->text()); 207 | 208 | //add apply tips 209 | ui->label_tip->setHidden(false); 210 | ui->label_tip->setText(tr("Apply WifiName Success!")); 211 | 212 | QElapsedTimer t; 213 | t.start(); 214 | while(t.elapsed()<3000) 215 | QCoreApplication::processEvents(); 216 | ui->label_tip->setHidden(true); 217 | 218 | 219 | if(QString::compare(ui->pushButton->text(),"STOP") == 0) 220 | { 221 | ui->pushButton->setText("Restaring..."); 222 | m_wifi->restartWifi(); 223 | ui->pushButton->setText("STOP"); 224 | } 225 | } 226 | 227 | } 228 | 229 | void MainWindow::on_pushButton_pwd_clicked() 230 | { 231 | ui->lineEdit_pwd->setEnabled(true); 232 | } 233 | 234 | void MainWindow::on_lineEdit_pwd_editingFinished() 235 | { 236 | 237 | if(m_mutex == 0) 238 | { 239 | m_mutex = 1; 240 | return; 241 | } 242 | else 243 | { 244 | m_mutex = 0; 245 | ui->lineEdit_pwd->setEnabled(false); 246 | if(ui->lineEdit_pwd->text() == m_wsettings->Password()) 247 | return; 248 | if(ui->lineEdit_pwd->text().size() < 8) 249 | QMessageBox::information(this,tr("Settings"),tr("Password Should More Than 8 Characters!"),QMessageBox::Warning); 250 | 251 | ui->lineEdit_pwd->setEnabled(false); 252 | m_wsettings->setPassword(ui->lineEdit_pwd->text()); 253 | 254 | //add apply tips 255 | ui->label_tip->setHidden(false); 256 | ui->label_tip->setText(tr("Apply Password Success!")); 257 | 258 | QElapsedTimer t; 259 | t.start(); 260 | while(t.elapsed()<3000) 261 | QCoreApplication::processEvents(); 262 | ui->label_tip->setHidden(true); 263 | 264 | if(QString::compare(ui->pushButton->text(),"STOP") == 0) 265 | { 266 | ui->pushButton->setText("Restaring..."); 267 | m_wifi->restartWifi(); 268 | ui->pushButton->setText("STOP"); 269 | } 270 | } 271 | } 272 | 273 | void MainWindow::on_pushButton_save_clicked() 274 | { 275 | QString apoint = this->ui->lineEdit_ap->text(); 276 | QString interface_created = this->ui->comboBox_createdinterface->currentText(); 277 | QString interface_shared = this->ui->comboBox_shareinterface->currentText(); 278 | if(apoint.size() == 0) 279 | { 280 | QMessageBox::information(this,tr("Settings"),tr("Access Point Can't Be Empty!"),QMessageBox::Ok); 281 | return; 282 | } 283 | if(interface_created.size() == 0) 284 | { 285 | QMessageBox::information(this,tr("Settings"),tr("Wifi Interface Can't Be Empty!"),QMessageBox::Ok); 286 | return; 287 | } 288 | if(interface_shared.size() == 0) 289 | { 290 | QMessageBox::information(this,tr("Settings"),tr("Shared Interface Can't Be Empty!"),QMessageBox::Ok); 291 | return; 292 | } 293 | 294 | if(!interface_created.startsWith("wl")) 295 | { 296 | QMessageBox::StandardButton stdbtn = QMessageBox::warning(NULL,tr("Settings"), 297 | tr("This Wifi Interface May not work,Still Use it?"), 298 | QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes); 299 | if(stdbtn == QMessageBox::No) 300 | return; 301 | } 302 | if(!(interface_shared.contains("eth") || interface_shared.contains("en")) || interface_shared.contains("wl")) 303 | { 304 | QMessageBox::StandardButton stdbtn = QMessageBox::warning(NULL,tr("Settings"), 305 | tr("This Shared Interface May not work,Still Use it?"), 306 | QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes); 307 | if(stdbtn == QMessageBox::No) 308 | return; 309 | } 310 | 311 | m_wsettings->setAccessPoint(apoint); 312 | m_wsettings->setInterface_Create(interface_created); 313 | m_wsettings->setInterface_Shared(interface_shared); 314 | m_wsettings->setLanguage(m_languageList[ui->comboBox_language->currentIndex()]); 315 | 316 | QMessageBox::information(this,tr("Settings"),tr("Apply Success!"),QMessageBox::Ok); 317 | 318 | } 319 | 320 | void MainWindow::on_pushButton_reset_clicked() 321 | { 322 | m_wsettings->setDefaultConfig(); 323 | this->initUIValue(); 324 | QMessageBox::information(this,tr("Settings"),tr("Reset Success!"),QMessageBox::Ok); 325 | } 326 | 327 | void MainWindow::on_actionAbout_triggered() 328 | { 329 | About *aboutDlg = new About; 330 | aboutDlg->show(); 331 | aboutDlg->exec(); 332 | } 333 | 334 | void MainWindow::closeEvent(QCloseEvent *event) 335 | { 336 | if (m_trayIcon->isVisible() && this->isVisible()) 337 | { 338 | setMainWindowVisibility(false); 339 | if(m_information_count == 0) 340 | { 341 | m_trayIcon->showMessage(tr("WifiAssist"),tr("Minmize to SystemTray"),QSystemTrayIcon::Information,1000); 342 | m_information_count = 1; 343 | } 344 | event->ignore(); 345 | } 346 | else 347 | { 348 | event->accept(); 349 | } 350 | } 351 | 352 | 353 | QStringList MainWindow::findQmFiles() 354 | { 355 | QDir dir(":/i18n/"); 356 | QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, 357 | QDir::Name); 358 | QMutableStringListIterator i(fileNames); 359 | m_languageList.clear(); 360 | while (i.hasNext()) { 361 | i.next(); 362 | i.setValue(dir.filePath(i.value())); 363 | QString s = i.value(); 364 | s.remove(0,7); 365 | s.remove(s.length()-3,3); 366 | m_languageList.push_back(s); 367 | } 368 | return fileNames; 369 | } 370 | 371 | QString MainWindow::languageName(const QString &qmFile) 372 | { 373 | QTranslator translator; 374 | translator.load(qmFile); 375 | QString lan = translator.translate("MainWindow","English"); 376 | return lan; 377 | } 378 | 379 | void MainWindow::setupLanguageOption() 380 | { 381 | QStringList languageFileList = findQmFiles(); 382 | for(int i=0;icomboBox_language->addItem(languageName(languageFileList[i])); 385 | } 386 | } 387 | 388 | void MainWindow::updateNewClients(QVector device) 389 | { 390 | QString hostname; 391 | for(int i=0;ihostname()+"\n"; 393 | 394 | m_trayIcon->showMessage(tr("WifiAssist"),hostname+tr("Connected To Your AP"), 395 | QSystemTrayIcon::Information,1000); 396 | } 397 | 398 | void MainWindow::updateLeaveClients(QVector device) 399 | { 400 | QString hostname; 401 | for(int i=0;ihostname()+"\n"; 403 | 404 | m_trayIcon->showMessage(tr("WifiAssist"),hostname+tr("Left Your AP"),QSystemTrayIcon::Information,1000); 405 | } 406 | 407 | void MainWindow::setupDevicesForTest() 408 | { 409 | // Form *form = new Form(this,"test1","test1"); 410 | // QListWidgetItem *listItem1 = new QListWidgetItem(); 411 | // listItem1->setSizeHint(QSize(0, 50)); 412 | 413 | // ui->listWidget->addItem(listItem1); 414 | // ui->listWidget->setItemWidget(listItem1,form); 415 | 416 | //for(int i=0;i<10;i++) 417 | //{ 418 | // WListWidgetItem *wListWidgetItem = new WListWidgetItem(this,QString("xiaomi"), 419 | // QString("11:21:33:33:34:44")); 420 | // QListWidgetItem *listItem = new QListWidgetItem(); 421 | // listItem->setSizeHint(QSize(0,wListWidgetItem->height()+1)); 422 | // listItem->setBackgroundColor(QColor(0,0,0)); 423 | // ui->listWidget->addItem(listItem); 424 | // ui->listWidget->setItemWidget(listItem,wListWidgetItem); 425 | //} 426 | } 427 | 428 | void MainWindow::updateDevicesList(QVector device) 429 | { 430 | ui->listWidget->clear(); 431 | for(int i=0;imac(); 434 | QString logoname = m_wdevices->getDeviceLogoName(macaddress); 435 | 436 | WListWidgetItem *wListWidgetItem = new WListWidgetItem(this,logoname,device[i]->hostname(), 437 | device[i]->mac()); 438 | QListWidgetItem *listItem = new QListWidgetItem(); 439 | listItem->setSizeHint(QSize(0,wListWidgetItem->height()+1)); 440 | listItem->setBackgroundColor(QColor(0,0,0)); 441 | ui->listWidget->addItem(listItem); 442 | ui->listWidget->setItemWidget(listItem,wListWidgetItem); 443 | } 444 | } 445 | -------------------------------------------------------------------------------- /src/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include "wifi.h" 18 | #include "device.h" 19 | #include "wdevices.h" 20 | #include "wsettings.h" 21 | #include "about.h" 22 | #include "wthread.h" 23 | #include "wlistwidgetitem.h" 24 | 25 | using namespace std; 26 | namespace Ui { 27 | class MainWindow; 28 | } 29 | 30 | class MainWindow : public QMainWindow 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit MainWindow(QWidget *parent = 0); 36 | ~MainWindow(); 37 | void setMainWindowVisibility(bool state); 38 | 39 | protected: 40 | void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; 41 | 42 | private slots: 43 | void on_pushButton_clicked(); 44 | void on_pushButton_name_clicked(); 45 | void on_lineEdit_name_editingFinished(); 46 | void on_pushButton_pwd_clicked(); 47 | void on_lineEdit_pwd_editingFinished(); 48 | void on_pushButton_save_clicked(); 49 | void on_pushButton_reset_clicked(); 50 | void on_actionAbout_triggered(); 51 | void updateNewClients(QVector device); 52 | void updateLeaveClients(QVector device); 53 | void updateDevicesList(QVector device); 54 | 55 | private: 56 | Ui::MainWindow *ui; 57 | 58 | int m_mutex; 59 | int m_information_count; 60 | 61 | Wifi *m_wifi; 62 | WSettings *m_wsettings; 63 | WDevices *m_wdevices; 64 | WThread *m_wthread; 65 | 66 | QTranslator *m_translator; 67 | QStringList m_languageList; 68 | QSystemTrayIcon* m_trayIcon; 69 | QAction* m_restoreAction; 70 | QAction* m_quitAction; 71 | QAction* m_controlWifi; 72 | QAction* m_restartWifi; 73 | QMenu* m_trayIconMenu; 74 | 75 | void createSystemTrayMenu(); //create customize menu 76 | void setupLanguage(); 77 | void initUIValue(); 78 | void setupTrayIcon(); 79 | void setupSignalsSlots(); 80 | QStringList findQmFiles(); 81 | void setupLanguageOption(); 82 | QString languageName(const QString &qmFile); 83 | void setupDevicesForTest(); 84 | }; 85 | 86 | #endif // MAINWINDOW_H 87 | -------------------------------------------------------------------------------- /src/singleinstance.cpp: -------------------------------------------------------------------------------- 1 | #include "singleinstance.h" 2 | 3 | 4 | SingleInstance::SingleInstance(QObject *parent) 5 | : QObject(parent) 6 | { 7 | connect(&m_server, &QLocalServer::newConnection, 8 | [this](){emit newInstance();}); 9 | } 10 | 11 | void SingleInstance::listen(QString name) 12 | { 13 | m_server.removeServer(name); 14 | m_server.listen(name); 15 | } 16 | 17 | bool SingleInstance::hasPrevious(QString name) 18 | { 19 | QLocalSocket socket; 20 | socket.connectToServer(name, QLocalSocket::ReadOnly); 21 | 22 | return socket.waitForConnected(); 23 | } 24 | -------------------------------------------------------------------------------- /src/singleinstance.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLEINSTANCE_H 2 | #define SINGLEINSTANCE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class SingleInstance : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit SingleInstance(QObject *parent = 0); 13 | 14 | void listen(QString name); 15 | bool hasPrevious(QString name); 16 | 17 | signals: 18 | void newInstance(); 19 | 20 | private: 21 | QLocalSocket* m_socket; 22 | QLocalServer m_server; 23 | }; 24 | 25 | #endif // SINGLEINSTANCE_H 26 | -------------------------------------------------------------------------------- /src/wdevices.cpp: -------------------------------------------------------------------------------- 1 | #include "wdevices.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | WDevices::WDevices() 13 | { 14 | } 15 | 16 | QStringList WDevices::getDeviceListStr() 17 | { 18 | 19 | //read ap.pid 20 | QDir dir; 21 | QString config_path = dir.homePath()+"/.WifiAssist"; 22 | QString client_list_filename = config_path+"/client.list"; 23 | 24 | QStringList args = QStringList() << QCoreApplication::applicationDirPath()+"/bin/client.sh"; 25 | QProcess qp; 26 | if(!qp.startDetached("bash",args)) 27 | { 28 | QMessageBox::about(NULL,QT_TR_NOOP("Warning!"),QT_TR_NOOP("Can't Get Client List")); 29 | } 30 | qp.waitForFinished(); 31 | 32 | 33 | QStringList client_list = QStringList(); 34 | 35 | QFile inputFile(client_list_filename); 36 | if(inputFile.open(QIODevice::ReadOnly)) 37 | { 38 | QTextStream in(&inputFile); 39 | if(!in.atEnd()) in.readLine(); 40 | 41 | while (!in.atEnd()) 42 | { 43 | QString line = in.readLine(); 44 | client_list << line; 45 | } 46 | inputFile.close(); 47 | } 48 | return client_list; 49 | } 50 | 51 | QVector WDevices::getDeviceList(QStringList devicesListStr) const 52 | { 53 | QVector deviceList; 54 | //QStringList devicesListStr = getDeviceListStr(); 55 | for(int i=0;i WDevices::getNewDeviceList() const 93 | { 94 | return getDeviceList(m_newDeviceListStr); 95 | } 96 | 97 | QVector WDevices::getLeaveDeviceList() const 98 | { 99 | return getDeviceList(m_leaveDeviceListStr); 100 | } 101 | 102 | QVector WDevices::getUpdateDeviceList() const 103 | { 104 | return getDeviceList(m_oldClientsStr); 105 | } 106 | 107 | void WDevices::loadMacInfo() 108 | { 109 | 110 | QString mac_filename = QCoreApplication::applicationDirPath()+"/etc/macinfo"; 111 | QFile inputFile(mac_filename); 112 | if(inputFile.open(QIODevice::ReadOnly)) 113 | { 114 | QTextStream in(&inputFile); 115 | while (!in.atEnd()) 116 | { 117 | QString line = in.readLine(); 118 | if(line.size() > 0) 119 | { 120 | QStringList minfo = line.split(QRegExp("\\s+")); 121 | m_macinfo.insert(minfo[0],minfo[1]); 122 | } 123 | } 124 | inputFile.close(); 125 | } 126 | } 127 | 128 | QString WDevices::getDeviceLogoName(QString &deviceMac) 129 | { 130 | QString m_mac = deviceMac.remove(8,9).toUpper(); //get first three mac address; 131 | if(m_macinfo.size() == 0) 132 | { 133 | loadMacInfo(); 134 | } 135 | return m_macinfo.value(m_mac); 136 | } 137 | -------------------------------------------------------------------------------- /src/wdevices.h: -------------------------------------------------------------------------------- 1 | #ifndef WDEVICES_H 2 | #define WDEVICES_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "device.h" 11 | 12 | class WDevices 13 | { 14 | public: 15 | WDevices(); 16 | QVector getDeviceList(QStringList devicesListStr) const; 17 | void updateClients(); 18 | 19 | QVector getNewDeviceList() const; 20 | QVector getLeaveDeviceList() const; 21 | QVector getUpdateDeviceList() const; 22 | QString getDeviceLogoName(QString &deviceMac); 23 | 24 | private: 25 | QStringList m_oldClientsStr; 26 | QVector m_oldClients; 27 | QStringList m_newDeviceListStr; 28 | QVector m_newDeviceList; 29 | QStringList m_leaveDeviceListStr; 30 | QVector m_leaveDeviceList; 31 | QStringList getDeviceListStr(); 32 | QMap m_macinfo; 33 | void loadMacInfo(); 34 | 35 | }; 36 | 37 | #endif // WDEVICES_H 38 | -------------------------------------------------------------------------------- /src/wifi.cpp: -------------------------------------------------------------------------------- 1 | #include "wifi.h" 2 | #include 3 | #include 4 | Wifi::Wifi() 5 | { 6 | } 7 | 8 | /** 9 | *lzjqsdd 10 | */ 11 | bool Wifi::startWifi() 12 | { 13 | WSettings m_settings; 14 | QString _g = "-g"; 15 | QString _no_virt = "--no-virt"; 16 | QString _deamon = "--daemon"; 17 | 18 | QStringList args = QStringList() << m_settings.path_exec() 19 | << m_settings.Interface_Create() 20 | << m_settings.Interface_Shared() << m_settings.APName() 21 | << m_settings.Password() 22 | << _g << m_settings.AccessPoint(); 23 | 24 | //use --no-virt option if shared interface is different from create_interface 25 | // this option will be moved to high-level configuration(maybe in version2.0) 26 | //if(m_settings.Interface_Create() != m_settings.Interface_Shared()) 27 | // args << _no_virt; 28 | 29 | //default to run wifiassist in deamon mode. 30 | args << _deamon; 31 | 32 | //use pkexec for first version,there is some questions unsolved with gksu. 33 | if(!QProcess::startDetached("pkexec",args)) 34 | { 35 | return false; 36 | } 37 | else 38 | { 39 | return true; 40 | } 41 | } 42 | /** 43 | *lzjqsdd 44 | */ 45 | bool Wifi::stopWifi() 46 | { 47 | WSettings m_settings ; 48 | QString arg1 = "--stop"; 49 | QStringList args = QStringList() << m_settings.path_exec() << arg1 < 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "wsettings.h" 10 | #include 11 | 12 | class Wifi 13 | { 14 | public: 15 | Wifi(); 16 | bool startWifi(); 17 | bool stopWifi(); 18 | void useWPA1(); 19 | void useWPA2(); 20 | 21 | void restartWifi(); 22 | }; 23 | 24 | #endif // WIFI_H 25 | -------------------------------------------------------------------------------- /src/wlistwidgetitem.cpp: -------------------------------------------------------------------------------- 1 | #include "wlistwidgetitem.h" 2 | #include "ui_wlistwidgetitem.h" 3 | #include 4 | #include 5 | 6 | WListWidgetItem::WListWidgetItem(QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::WListWidgetItem) 9 | { 10 | ui->setupUi(this); 11 | } 12 | 13 | 14 | WListWidgetItem::WListWidgetItem(QWidget *parent,const QString &logoname,const QString &hostname, const QString &mac) : 15 | QWidget(parent), 16 | ui(new Ui::WListWidgetItem) 17 | { 18 | ui->setupUi(this); 19 | ui->label_hostname->setText(hostname); 20 | ui->label_mac->setText(mac); 21 | QPixmap original = QPixmap(":cor/img/corpicon/"+logoname+".ico").scaled(50,50); 22 | ui->label_logo->setPixmap(PixmapToRound(original,15)); 23 | } 24 | 25 | 26 | WListWidgetItem::~WListWidgetItem() 27 | { 28 | delete ui; 29 | } 30 | 31 | QPixmap WListWidgetItem::PixmapToRound(const QPixmap &src, int radius) 32 | { 33 | if (src.isNull()) { 34 | return QPixmap(); 35 | } 36 | 37 | QSize size(2*radius, 2*radius); 38 | QBitmap mask(size); 39 | QPainter painter(&mask); 40 | painter.setRenderHint(QPainter::Antialiasing); 41 | painter.setRenderHint(QPainter::SmoothPixmapTransform); 42 | painter.fillRect(0, 0, size.width(), size.height(), Qt::white); 43 | painter.setBrush(QColor(0, 0, 0)); 44 | painter.drawRoundedRect(0, 0, size.width(), size.height(), 99, 99); 45 | 46 | QPixmap image = src.scaled(size); 47 | image.setMask(mask); 48 | return image; 49 | } 50 | -------------------------------------------------------------------------------- /src/wlistwidgetitem.h: -------------------------------------------------------------------------------- 1 | #ifndef WLISTWIDGETITEM_H 2 | #define WLISTWIDGETITEM_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace Ui { 10 | class WListWidgetItem; 11 | } 12 | 13 | class WListWidgetItem : public QWidget 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit WListWidgetItem(QWidget *parent = 0); 19 | explicit WListWidgetItem(QWidget *parent,const QString &logoname,const QString &hostname,const QString &mac); 20 | ~WListWidgetItem(); 21 | 22 | private: 23 | Ui::WListWidgetItem *ui; 24 | QPixmap PixmapToRound(const QPixmap &src, int radius); 25 | }; 26 | 27 | #endif // WLISTWIDGETITEM_H 28 | -------------------------------------------------------------------------------- /src/wlistwidgetitem.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | WListWidgetItem 4 | 5 | 6 | 7 | 0 8 | 0 9 | 260 10 | 62 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | background-color: rgba(255, 255, 255, 255); 18 | selection-background-color: rgba(7, 166, 223, 157); 19 | selection-color: rgb(0, 153, 153); 20 | 21 | 22 | 23 | 24 | 0 25 | 0 26 | 261 27 | 62 28 | 29 | 30 | 31 | 32 | 1 33 | 34 | 35 | 36 | 37 | 0 38 | 39 | 40 | 0 41 | 42 | 43 | 0 44 | 45 | 46 | 0 47 | 48 | 49 | 0 50 | 51 | 52 | 53 | 54 | Qt::Horizontal 55 | 56 | 57 | 58 | 1 59 | 20 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 0 69 | 0 70 | 71 | 72 | 73 | 74 | 50 75 | 50 76 | 77 | 78 | 79 | 80 | 50 81 | 50 82 | 83 | 84 | 85 | border-radius:25px; 86 | border-color: rgb(0, 0, 0); 87 | background-color: rgba(255, 255, 255, 0); 88 | 89 | 90 | 91 | QFrame::NoFrame 92 | 93 | 94 | QFrame::Plain 95 | 96 | 97 | TextLabel 98 | 99 | 100 | 101 | 102 | 103 | 104 | Qt::Horizontal 105 | 106 | 107 | 108 | 10 109 | 20 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 1 118 | 119 | 120 | QLayout::SetMaximumSize 121 | 122 | 123 | 124 | 125 | color: rgb(41, 191, 217); 126 | 127 | 128 | QFrame::NoFrame 129 | 130 | 131 | TextLabel 132 | 133 | 134 | 135 | 136 | 137 | 138 | false 139 | 140 | 141 | 142 | 143 | 144 | QFrame::NoFrame 145 | 146 | 147 | TextLabel 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Qt::Horizontal 157 | 158 | 159 | 160 | 5 161 | 20 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /src/wsettings.cpp: -------------------------------------------------------------------------------- 1 | #include "wsettings.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | WSettings::WSettings(): 8 | m_settings(new QSettings) 9 | { 10 | setConfigAttrName(); 11 | checkInterfaceListFile(); 12 | checkConfigFile(); 13 | } 14 | 15 | WSettings::WSettings(bool needinit) 16 | { 17 | if(!needinit) 18 | WSettings(); 19 | } 20 | 21 | WSettings::~WSettings() 22 | { 23 | delete this->m_settings; 24 | } 25 | 26 | void WSettings::setConfigAttrName() 27 | { 28 | _path_exec = "PATH"; 29 | _APName = "APNAME"; 30 | _Password = "PASSWORD"; 31 | _Interface_Create = "INTERFACE_CREATED"; 32 | _Interface_Shared = "INTERFACE_SHARED"; 33 | _AccessPoint = "ACCESSPOINT"; 34 | _Language = "LANGUAGE"; 35 | } 36 | 37 | void WSettings::setSettings(const QString &name,const QString &value) 38 | { 39 | QString fullpath = "/settings/"+name; 40 | m_settings->setValue(fullpath,value); 41 | } 42 | 43 | QString WSettings::getSettings(const QString &name) const 44 | { 45 | QString fullpath = "/settings/"+name; 46 | return m_settings->value(fullpath).toString(); 47 | } 48 | 49 | QString WSettings::AccessPoint() const 50 | { 51 | return this->getSettings(_AccessPoint); 52 | } 53 | 54 | void WSettings::setAccessPoint(const QString &AccessPoint) 55 | { 56 | this->setSettings(_AccessPoint,AccessPoint); 57 | } 58 | 59 | QString WSettings::Interface_Shared() const 60 | { 61 | return this->getSettings(_Interface_Shared); 62 | } 63 | 64 | void WSettings::setInterface_Shared(const QString &Interface_Shared) 65 | { 66 | this->setSettings(_Interface_Shared,Interface_Shared); 67 | } 68 | 69 | QString WSettings::Interface_Create() const 70 | { 71 | return this->getSettings(_Interface_Create); 72 | } 73 | 74 | void WSettings::setInterface_Create(const QString &Interface_Create) 75 | { 76 | this->setSettings(_Interface_Create,Interface_Create); 77 | } 78 | 79 | QString WSettings::Password() const 80 | { 81 | return this->getSettings(_Password); 82 | } 83 | 84 | void WSettings::setPassword(const QString &Password) 85 | { 86 | this->setSettings(_Password,Password); 87 | } 88 | 89 | QString WSettings::APName() const 90 | { 91 | return this->getSettings(_APName); 92 | } 93 | 94 | void WSettings::setAPName(const QString &APName) 95 | { 96 | this->setSettings(_APName,APName); 97 | } 98 | 99 | QString WSettings::path_exec() const 100 | { 101 | return this->getSettings(_path_exec); 102 | } 103 | 104 | void WSettings::setPath_exec(const QString &path_exec) 105 | { 106 | this->setSettings(_path_exec,path_exec); 107 | } 108 | 109 | QString WSettings::Language() const 110 | { 111 | return this->getSettings(_Language); 112 | } 113 | 114 | void WSettings::setLanguage(const QString &Language) 115 | { 116 | this->setSettings(_Language,Language); 117 | } 118 | 119 | 120 | void WSettings::checkInterfaceListFile() 121 | { 122 | //default config file "~/.WifiAssist/config.ini" 123 | //check is path exists 124 | QDir dir; 125 | QString config_path = dir.homePath()+"/.WifiAssist"; 126 | 127 | dir.setPath(config_path); 128 | //if not exist,mkdir and Then set default config file. 129 | if(!dir.exists()) 130 | { 131 | dir.mkdir(config_path); 132 | } 133 | 134 | 135 | //run net.sh to get interface list 136 | QString interface_list_filename = config_path+"/interface.list"; 137 | QFile file; 138 | file.setFileName(interface_list_filename); 139 | 140 | if(!file.exists()) 141 | { 142 | QStringList args = QStringList() << QCoreApplication::applicationDirPath()+"/bin/net.sh"; 143 | QProcess qp; 144 | if(!qp.startDetached("bash",args)) 145 | { 146 | QMessageBox::about(NULL,QT_TR_NOOP("Warning!"),QT_TR_NOOP("Can't Get Interface List")); 147 | } 148 | 149 | QElapsedTimer t; 150 | t.start(); 151 | while(t.elapsed()<2000) 152 | QCoreApplication::processEvents(); 153 | } 154 | 155 | } 156 | 157 | 158 | void WSettings::checkConfigFile() 159 | { 160 | //default config file "~/.WifiAssist/config.ini" 161 | //check is path exists 162 | QDir dir; 163 | QString config_path = dir.homePath()+"/.WifiAssist"; 164 | QString filename = config_path+"/config.ini"; 165 | dir.setPath(config_path); 166 | //if not exist,mkdir and Then set default config file. 167 | if(!dir.exists()) 168 | { 169 | dir.mkdir(config_path); 170 | } 171 | QFile file; 172 | file.setFileName(filename); 173 | if(!file.exists()) 174 | { 175 | 176 | m_settings = new QSettings(filename,QSettings::IniFormat); 177 | setDefaultConfig(); 178 | } 179 | else 180 | m_settings = new QSettings(filename,QSettings::IniFormat); 181 | 182 | QString clientfile = config_path+"/client.list"; 183 | QFile::remove(clientfile); 184 | } 185 | 186 | void WSettings::setDefaultConfig() 187 | { 188 | this->setPassword("1234567890"); 189 | this->setAccessPoint("192.168.12.1"); 190 | this->setAPName("WifiAssistForLinux"); 191 | 192 | QStringList interface_list = getInterfaceList(); 193 | if(interface_list.contains("eth0")) 194 | this->setInterface_Shared("eth0"); 195 | else 196 | this->setInterface_Shared(interface_list.at(0)); 197 | 198 | if(interface_list.contains("wlan0")) 199 | this->setInterface_Create("wlan0"); 200 | else 201 | this->setInterface_Create(interface_list.at(interface_list.size()-1)); 202 | 203 | QString absolute_path = QCoreApplication::applicationDirPath()+"/bin/wifi.sh"; 204 | this->setPath_exec(absolute_path); 205 | 206 | this->setLanguage("en_US"); 207 | } 208 | 209 | QStringList WSettings::getInterfaceList() 210 | { 211 | //read interface.list 212 | QDir dir; 213 | QString config_path = dir.homePath()+"/.WifiAssist"; 214 | QString interface_list_filename = config_path+"/interface.list"; 215 | 216 | QStringList interface_list = QStringList(); 217 | 218 | QFile inputFile(interface_list_filename); 219 | if(inputFile.open(QIODevice::ReadOnly)) 220 | { 221 | QTextStream in(&inputFile); 222 | while (!in.atEnd()) 223 | { 224 | QString line = in.readLine(); 225 | interface_list << line; 226 | } 227 | inputFile.close(); 228 | } 229 | else 230 | { 231 | QMessageBox::warning(NULL,QT_TR_NOOP("Warning!"),QT_TR_NOOP("Can't find interface Record")); 232 | } 233 | return interface_list; 234 | } 235 | 236 | bool WSettings::getAPStatus() 237 | { 238 | //read ap.pid 239 | QDir dir; 240 | QString config_path = dir.homePath()+"/.WifiAssist"; 241 | QString ap_list_filename = config_path+"/ap.pid"; 242 | 243 | QStringList ap_list = QStringList(); 244 | 245 | QFile inputFile(ap_list_filename); 246 | if(inputFile.open(QIODevice::ReadOnly)) 247 | { 248 | QTextStream in(&inputFile); 249 | while (!in.atEnd()) 250 | { 251 | QString line = in.readLine(); 252 | ap_list << line; 253 | } 254 | inputFile.close(); 255 | } 256 | else 257 | { 258 | QMessageBox::warning(NULL,QT_TR_NOOP("Warning!"),QT_TR_NOOP("Can't find interface Record")); 259 | } 260 | if(ap_list.size() > 0) 261 | return true; 262 | return false; 263 | } 264 | -------------------------------------------------------------------------------- /src/wsettings.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WSETTINGS_H 3 | #define WSETTINGS_H 4 | #include "QString" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | /** 11 | * @brief The WSettings class 12 | * 13 | */ 14 | class WSettings 15 | { 16 | public: 17 | WSettings(); 18 | WSettings(bool ifinit); 19 | ~WSettings(); 20 | 21 | QSettings *m_settings; 22 | 23 | QString _path_exec; 24 | QString _APName; 25 | QString _Password; 26 | QString _Interface_Create; 27 | QString _Interface_Shared; 28 | QString _AccessPoint; 29 | QString _Language; 30 | 31 | 32 | 33 | QString path_exec() const; 34 | void setPath_exec(const QString &path_exec); 35 | QString APName() const; 36 | void setAPName(const QString &APName); 37 | QString Password() const; 38 | void setPassword(const QString &Password); 39 | QString Interface_Create() const; 40 | void setInterface_Create(const QString &Interface_Create); 41 | QString Interface_Shared() const; 42 | void setInterface_Shared(const QString &Interface_Shared); 43 | QString AccessPoint() const; 44 | void setAccessPoint(const QString &AccessPoint); 45 | QString Language() const; 46 | void setLanguage(const QString &Language); 47 | 48 | void setSettings(const QString &name,const QString &value); 49 | QString getSettings(const QString&name) const; 50 | 51 | void setConfigAttrName(); 52 | 53 | void checkInterfaceListFile(); 54 | void checkConfigFile(); 55 | void setDefaultConfig(); 56 | QStringList getInterfaceList(); 57 | bool getAPStatus(); 58 | QStringList getClientList(); 59 | }; 60 | 61 | #endif // WSETTINGS_H 62 | 63 | -------------------------------------------------------------------------------- /src/wthread.cpp: -------------------------------------------------------------------------------- 1 | #include "wthread.h" 2 | #include 3 | 4 | WThread::WThread(): 5 | m_wdevices(new WDevices()), 6 | m_stop(false) 7 | { 8 | } 9 | 10 | WThread::~WThread() 11 | { 12 | this->~QThread(); 13 | } 14 | 15 | void WThread::run() 16 | { 17 | while(!m_stop) 18 | { 19 | sleep(1); 20 | //std::cout<<"running..."<updateClients(); 23 | QVector update_devices = m_wdevices->getUpdateDeviceList(); 24 | QVector new_devices = m_wdevices->getNewDeviceList(); 25 | QVector leave_devices = m_wdevices->getLeaveDeviceList(); 26 | 27 | if(!(new_devices.size()==0 && leave_devices.size()==0)) 28 | emit clientUpdate(update_devices); 29 | if(new_devices.size() > 0) 30 | emit clientAdd(new_devices); 31 | if(leave_devices.size() > 0) 32 | emit clientLeave(leave_devices); 33 | } 34 | m_stop = false; 35 | } 36 | 37 | void WThread::stop() 38 | { 39 | m_stop = true; 40 | } 41 | -------------------------------------------------------------------------------- /src/wthread.h: -------------------------------------------------------------------------------- 1 | #ifndef WTHREAD_H 2 | #define WTHREAD_H 3 | #include 4 | #include 5 | 6 | #include "device.h" 7 | #include "wdevices.h" 8 | 9 | class WThread : public QThread 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | WThread(); 15 | ~WThread(); 16 | void stop(); 17 | 18 | private: 19 | WDevices *m_wdevices; 20 | bool m_stop; 21 | 22 | signals: 23 | void clientAdd(QVector devices); 24 | void clientLeave(QVector devices); 25 | void clientUpdate(QVector devices); 26 | protected: 27 | void run(); 28 | }; 29 | 30 | #endif // WTHREAD_H 31 | --------------------------------------------------------------------------------