From 1db8d270e0d4e07d41a43ebe9f27640d6c8a1643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 18 Mar 2015 16:08:35 +0100 Subject: [PATCH 1/4] merged --- YACReaderLibrary/server_config_dialog.cpp | 37 ++++++++++++++++------- YACReaderLibrary/server_config_dialog.h | 3 +- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 73761624..04b87071 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -13,6 +13,22 @@ #include "startup.h" #include "yacreader_global.h" +#include + +bool ipComparator(const QString & ip1, const QString & ip2) +{ + if(ip1.startsWith("192.168") && ip2.startsWith("192.168")) + return ip1 < ip2; + + if(ip1.startsWith("192.168")) + return true; + + if(ip2.startsWith("192.168")) + return false; + + return ip1 < ip2; +} + #ifndef Q_OS_WIN32 #include @@ -166,7 +182,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent) settings->endGroup(); - connect(check,SIGNAL(stateChanged(int)),this,SLOT(enableServer(int))); + connect(check,SIGNAL(stateChanged(int)),this,SLOT(enableServer(int))); } void ServerConfigDialog::enableServer(int status) @@ -205,6 +221,7 @@ void ServerConfigDialog::generateQR() //} ip->clear(); QString dir; + #ifdef Q_OS_WIN32 QList list = QHostInfo::fromName( QHostInfo::localHostName() ).addresses(); @@ -214,11 +231,7 @@ void ServerConfigDialog::generateQR() QString tmp = add.toString(); if(tmp.contains(".") && !tmp.startsWith("127")) { - if(dir.isEmpty() && tmp.startsWith("192.168.2.")) - dir = tmp; - else - otherAddresses.push_back(tmp); - + otherAddresses.push_back(tmp); } } @@ -231,14 +244,16 @@ void ServerConfigDialog::generateQR() QString tmp = add; if(tmp.contains(".") && !tmp.startsWith("127")) { - if(dir.isEmpty() && tmp.startsWith("192.168.2.")) - dir = tmp; - else - otherAddresses.push_back(tmp); - + otherAddresses.push_back(tmp); } } #endif + + stl::sort(otherAddresses.begin(),otherAddresses.end(),ipComparator); + + if(otherAddresses.length()>0) + dir = otherAddresses.pop_front(); + if(otherAddresses.length()>0 || !dir.isEmpty()) { if(!dir.isEmpty()) diff --git a/YACReaderLibrary/server_config_dialog.h b/YACReaderLibrary/server_config_dialog.h index b21c96ee..dfe441b5 100644 --- a/YACReaderLibrary/server_config_dialog.h +++ b/YACReaderLibrary/server_config_dialog.h @@ -28,6 +28,7 @@ Q_OBJECT QPixmap * qrCodeImage; QProcess * qrGenerator; + public slots: void generateQR(); void generateQR(const QString & serverAddress); @@ -41,4 +42,4 @@ signals: }; -#endif \ No newline at end of file +#endif From 366f880fdefa5894a6d5e4319d5c2722db6c30c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 18 Mar 2015 18:46:19 +0100 Subject: [PATCH 2/4] merged --- YACReaderLibrary/server_config_dialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 04b87071..a44a5271 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -249,10 +249,13 @@ void ServerConfigDialog::generateQR() } #endif - stl::sort(otherAddresses.begin(),otherAddresses.end(),ipComparator); + std::sort(otherAddresses.begin(),otherAddresses.end(),ipComparator); - if(otherAddresses.length()>0) - dir = otherAddresses.pop_front(); + if(!otherAddresses.isEmpty()) + { + dir = otherAddresses.first(); + otherAddresses.pop_front(); + } if(otherAddresses.length()>0 || !dir.isEmpty()) { From ad320659863cc4910ba192a42e91f0ee6cd9c996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 18 Mar 2015 23:46:18 +0100 Subject: [PATCH 3/4] merged --- YACReaderLibrary/import_widget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index eb22ebcf..0e325e26 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -211,6 +211,7 @@ ImportWidget::ImportWidget(QWidget *parent) : previousWidth = 10; updatingCovers = false; elapsedTimer = new QElapsedTimer(); + elapsedTimer->start(); } void ImportWidget::newComic(const QString & path, const QString & coverPath) From e2af591e891683fe4199cd2b1b2ab0e5eef3a392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 19 Mar 2015 22:11:26 +0100 Subject: [PATCH 4/4] merged --- compressed_archive/compressed_archive.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index 25bcc2ee..797bb644 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -178,12 +178,16 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) CompressedArchive::~CompressedArchive() { + #ifdef Q_OS_UNIX if(isRar) //TODO: fix this!!! Possible memory leak. If AddRef is not used, a crash occurs in "delete szInterface" szInterface->archive->AddRef(); #endif if(valid) //TODO: fix this!!! Memory leak. + { + szInterface->archive->Close(); delete szInterface; + } #ifdef Q_OS_UNIX delete rarLib; #endif