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

cleaning in settings.cpp filetransferinstance.cpp and friendwidget.cpp, global autoaccept, per friend and qmenunu simplificated

This commit is contained in:
agilob 2014-11-05 22:34:28 +00:00
parent c702e18ccf
commit d9a3f1a5e2
No known key found for this signature in database
GPG Key ID: 34568050DBCCB997
3 changed files with 17 additions and 20 deletions

View File

@ -104,7 +104,7 @@ void Settings::load()
s.beginGroup("General");
enableIPv6 = s.value("enableIPv6", true).toBool();
translation = s.value("translation", "").toString();
translation = s.value("translation", "en").toString();
makeToxPortable = s.value("makeToxPortable", false).toBool();
autostartInTray = s.value("autostartInTray", false).toBool();
closeToTray = s.value("closeToTray", false).toBool();
@ -168,10 +168,6 @@ void Settings::load()
outDev = s.value("outDev", "").toString();
s.endGroup();
// try to set a smiley pack if none is selected
if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty())
smileyPack = SmileyPack::listSmileyPacks()[0].second;
// Read the embedded DHT bootsrap nodes list if needed
if (dhtServerList.isEmpty())
{
@ -283,7 +279,7 @@ void Settings::save(QString path)
s.endGroup();
s.beginGroup("AutoAccept");
s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
for (auto& id : autoAccept.keys())
s.setValue(id, autoAccept.value(id));

View File

@ -184,16 +184,12 @@ void GeneralForm::onAutoAwayChanged()
void GeneralForm::onAutoAcceptFileChange()
{
Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked());
if(bodyUI->autoacceptFiles->isChecked() == true)
{
Settings::getInstance().setAutoSaveEnabled(true);
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
}
else
{
Settings::getInstance().setAutoSaveEnabled(false);
disconnect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()),this, SLOT(onAutoSaveDirChange()));
}
}
void GeneralForm::onAutoSaveDirChange()

View File

@ -65,10 +65,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
menu.addSeparator();
QAction* autoAccept = menu.addAction(tr("Auto accept files from this friend", "context menu entry"));
QAction* disableAutoAccept = menu.addAction(tr("Manually accept files from this friend", "context menu entry"));
if (dir.isEmpty())
disableAutoAccept->setEnabled(false);
autoAccept->setCheckable(true);
autoAccept->setChecked(!dir.isEmpty());
menu.addSeparator();
QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
@ -91,11 +89,18 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
}
else if (selectedItem == autoAccept)
{
if (dir.isEmpty())
dir = QDir::homePath();
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
if (!dir.isEmpty())
if (!autoAccept->isChecked())
{
qDebug() << "not checked";
dir = QDir::homePath();
autoAccept->setChecked(false);
Settings::getInstance().setAutoAcceptDir(id, "");
}
if (autoAccept->isChecked())
{
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
autoAccept->setChecked(true);
qDebug() << "FriendWidget: setting auto accept dir for" << friendId << "to" << dir;
Settings::getInstance().setAutoAcceptDir(id, dir);
}