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:
parent
c702e18ccf
commit
d9a3f1a5e2
|
@ -104,7 +104,7 @@ void Settings::load()
|
||||||
|
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
enableIPv6 = s.value("enableIPv6", true).toBool();
|
enableIPv6 = s.value("enableIPv6", true).toBool();
|
||||||
translation = s.value("translation", "").toString();
|
translation = s.value("translation", "en").toString();
|
||||||
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
||||||
autostartInTray = s.value("autostartInTray", false).toBool();
|
autostartInTray = s.value("autostartInTray", false).toBool();
|
||||||
closeToTray = s.value("closeToTray", false).toBool();
|
closeToTray = s.value("closeToTray", false).toBool();
|
||||||
|
@ -168,10 +168,6 @@ void Settings::load()
|
||||||
outDev = s.value("outDev", "").toString();
|
outDev = s.value("outDev", "").toString();
|
||||||
s.endGroup();
|
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
|
// Read the embedded DHT bootsrap nodes list if needed
|
||||||
if (dhtServerList.isEmpty())
|
if (dhtServerList.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -184,16 +184,12 @@ void GeneralForm::onAutoAwayChanged()
|
||||||
|
|
||||||
void GeneralForm::onAutoAcceptFileChange()
|
void GeneralForm::onAutoAcceptFileChange()
|
||||||
{
|
{
|
||||||
|
Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked());
|
||||||
|
|
||||||
if(bodyUI->autoacceptFiles->isChecked() == true)
|
if(bodyUI->autoacceptFiles->isChecked() == true)
|
||||||
{
|
|
||||||
Settings::getInstance().setAutoSaveEnabled(true);
|
|
||||||
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
|
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Settings::getInstance().setAutoSaveEnabled(false);
|
|
||||||
disconnect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()),this, SLOT(onAutoSaveDirChange()));
|
disconnect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()),this, SLOT(onAutoSaveDirChange()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoSaveDirChange()
|
void GeneralForm::onAutoSaveDirChange()
|
||||||
|
|
|
@ -65,10 +65,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QAction* autoAccept = menu.addAction(tr("Auto accept files from this friend", "context menu entry"));
|
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"));
|
autoAccept->setCheckable(true);
|
||||||
|
autoAccept->setChecked(!dir.isEmpty());
|
||||||
if (dir.isEmpty())
|
|
||||||
disableAutoAccept->setEnabled(false);
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
QAction* removeFriendAction = menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
|
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)
|
else if (selectedItem == autoAccept)
|
||||||
{
|
{
|
||||||
if (dir.isEmpty())
|
if (!autoAccept->isChecked())
|
||||||
dir = QDir::homePath();
|
|
||||||
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
|
|
||||||
if (!dir.isEmpty())
|
|
||||||
{
|
{
|
||||||
|
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;
|
qDebug() << "FriendWidget: setting auto accept dir for" << friendId << "to" << dir;
|
||||||
Settings::getInstance().setAutoAcceptDir(id, dir);
|
Settings::getInstance().setAutoAcceptDir(id, dir);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user