1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'master' into profiles

get the last few commits from master

Conflicts:
	core.cpp
This commit is contained in:
Dubslow 2014-09-05 04:20:15 -05:00
commit f21d8d50b7
6 changed files with 60 additions and 17 deletions

View File

@ -943,7 +943,6 @@ void Core::saveConfiguration(const QString& path)
delete[] data; delete[] data;
} }
qDebug() << "Core: writing settings";
Settings::getInstance().save(); Settings::getInstance().save();
} }

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
qtox (0.01pre-alpha-1) UNRELEASED; urgency=medium local package qtox (1.0-1) UNRELEASED; urgency=medium local package
* Initial release. * Initial release.

View File

@ -1,6 +1,6 @@
[DHT%20Server] [DHT%20Server]
dhtServerList\size=9 dhtServerList\size=9
dhtServerList\1\name=stqism dhtServerList\1\name=Nikolai Toryzin
dhtServerList\1\userId=951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F dhtServerList\1\userId=951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F
dhtServerList\1\address=192.254.75.98 dhtServerList\1\address=192.254.75.98
dhtServerList\1\port=33445 dhtServerList\1\port=33445
@ -36,3 +36,7 @@ dhtServerList\9\name=SylvieLorxu
dhtServerList\9\userId=4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057 dhtServerList\9\userId=4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057
dhtServerList\9\address=178.21.112.187 dhtServerList\9\address=178.21.112.187
dhtServerList\9\port=33445 dhtServerList\9\port=33445
dhtServerList\10\name=Unknown (uTox)
dhtServerList\10\userId=7187969BB10B54C98538BAE94C069CE5C84E650D54F7E596543D8FB1ECF4CF23
dhtServerList\10\address=95.85.13.245
dhtServerList\10\port=33445

View File

@ -30,7 +30,7 @@ const QString Settings::FILENAME = "settings.ini";
bool Settings::makeToxPortable{false}; bool Settings::makeToxPortable{false};
Settings::Settings() : Settings::Settings() :
loaded(false) loaded(false), useCustomDhtList{false}
{ {
load(); load();
} }
@ -54,7 +54,14 @@ void Settings::load()
QFile portableSettings(FILENAME); QFile portableSettings(FILENAME);
if (portableSettings.exists()) if (portableSettings.exists())
makeToxPortable=true; {
QSettings ps(FILENAME, QSettings::IniFormat);
ps.beginGroup("General");
makeToxPortable = ps.value("makeToxPortable", false).toBool();
ps.endGroup();
}
else
makeToxPortable = false;
QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME); QString filePath = QDir(getSettingsDirPath()).filePath(FILENAME);
@ -65,8 +72,14 @@ void Settings::load()
filePath = ":/conf/" + FILENAME; filePath = ":/conf/" + FILENAME;
} }
qDebug() << "Settings: Loading from "<<filePath;
QSettings s(filePath, QSettings::IniFormat); QSettings s(filePath, QSettings::IniFormat);
s.beginGroup("DHT Server"); s.beginGroup("DHT Server");
if (s.value("useCustomList").toBool())
{
useCustomDhtList = true;
qDebug() << "Using custom bootstrap nodes list";
int serverListSize = s.beginReadArray("dhtServerList"); int serverListSize = s.beginReadArray("dhtServerList");
for (int i = 0; i < serverListSize; i ++) { for (int i = 0; i < serverListSize; i ++) {
s.setArrayIndex(i); s.setArrayIndex(i);
@ -78,6 +91,9 @@ void Settings::load()
dhtServerList << server; dhtServerList << server;
} }
s.endArray(); s.endArray();
}
else
useCustomDhtList=false;
s.endGroup(); s.endGroup();
friendAddresses.clear(); friendAddresses.clear();
@ -132,6 +148,26 @@ void Settings::load()
if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty()) if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty())
smileyPack = SmileyPack::listSmileyPacks()[0].second; smileyPack = SmileyPack::listSmileyPacks()[0].second;
// Read the embedded DHT bootsrap nodes list if needed
if (dhtServerList.isEmpty())
{
qDebug() << "Using embeded bootstrap nodes list";
QSettings rcs(":/conf/settings.ini", QSettings::IniFormat);
rcs.beginGroup("DHT Server");
int serverListSize = rcs.beginReadArray("dhtServerList");
for (int i = 0; i < serverListSize; i ++) {
rcs.setArrayIndex(i);
DhtServer server;
server.name = rcs.value("name").toString();
server.userId = rcs.value("userId").toString();
server.address = rcs.value("address").toString();
server.port = rcs.value("port").toInt();
dhtServerList << server;
}
rcs.endArray();
rcs.endGroup();
}
loaded = true; loaded = true;
} }
@ -143,11 +179,14 @@ void Settings::save()
void Settings::save(QString path) void Settings::save(QString path)
{ {
qDebug() << "Settings: Saving in "<<path;
QSettings s(path, QSettings::IniFormat); QSettings s(path, QSettings::IniFormat);
s.clear(); s.clear();
s.beginGroup("DHT Server"); s.beginGroup("DHT Server");
s.setValue("useCustomList", useCustomDhtList);
s.beginWriteArray("dhtServerList", dhtServerList.size()); s.beginWriteArray("dhtServerList", dhtServerList.size());
for (int i = 0; i < dhtServerList.size(); i ++) { for (int i = 0; i < dhtServerList.size(); i ++) {
s.setArrayIndex(i); s.setArrayIndex(i);

View File

@ -145,6 +145,7 @@ private:
bool loaded; bool loaded;
bool useCustomDhtList;
QList<DhtServer> dhtServerList; QList<DhtServer> dhtServerList;
int dhtServerId; int dhtServerId;
bool dontShowDhtDialog; bool dontShowDhtDialog;

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Config (Update me if needed !) # Config (Update me if needed !)
VERSION_UPSTREAM="0.01pre-alpha" VERSION_UPSTREAM="1.0"
VERSION_PACKAGE="1" VERSION_PACKAGE="1"
PACKAGENAME="qtox" PACKAGENAME="qtox"
UPSTREAM_URL="https://github.com/tux3/qTox/archive/master.tar.gz" UPSTREAM_URL="https://github.com/tux3/qTox/archive/master.tar.gz"