Moved timeout constants to appsettings in preparatino for adding to user configuratio...
[vlc-remote] / src / appsettings.cpp
index babef8c..dc2472c 100644 (file)
@@ -16,6 +16,7 @@
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
 #include <QStringList>
+#include <QNetworkInterface>
 #include "appsettings.h"
 
 AppSettings::AppSettings() {
@@ -24,7 +25,19 @@ AppSettings::AppSettings() {
 AppSettings::~AppSettings() {
     ;
 }
+bool AppSettings::isConnected() {
+    QNetworkInterface wlan = QNetworkInterface::interfaceFromName("wlan0");
+    QNetworkInterface gprs = QNetworkInterface::interfaceFromName("gprs0");
 
+    if( (wlan.isValid() && wlan.flags().testFlag(QNetworkInterface::IsUp)) || (gprs.isValid() && gprs.flags().testFlag(QNetworkInterface::IsUp)) )
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
 QString AppSettings::getCurrentKey() {
     QSettings sets;
     return sets.value("config/currentKey", "").toString();
@@ -78,6 +91,24 @@ bool AppSettings::deleteFavourite(VlcDirectory dir) {
     sets.remove("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name);
     return true;
 }
+int AppSettings::getStatusPollTimeout() {
+    return STATUS_POLL_TIMEOUT;
+}
+int AppSettings::getPingTimeout() {
+    return PING_TIMEOUT;
+}
+int AppSettings::getConnectionTimeout() {
+    return CONNECTION_TIMEOUT;
+}
+int AppSettings::getRetrieveArtTimeout() {
+    return RETRIEVE_ART_TIMEOUT;
+}
+int AppSettings::getRetryNetworkTimeout() {
+    return RETRY_NETWORK_TIMEOUT;
+}
+bool AppSettings::getShowUnknownFileTypes() {
+    return SHOW_UNKNOWN_FILETYPES;
+}
 Orientation AppSettings::setOrientation(Orientation orientation) {
     QSettings sets;
     sets.setValue("config/orientation", (int)orientation);