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

style(chatlog, persistence): Style fixes

This commit is contained in:
Diadlo 2016-07-07 13:08:32 +03:00
parent 2258748d28
commit 20d3225f29
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 21 additions and 15 deletions

View File

@ -69,20 +69,29 @@ ChatLog::ChatLog(QWidget* parent)
copyAction->setIcon(QIcon::fromTheme("edit-copy"));
copyAction->setShortcut(QKeySequence::Copy);
copyAction->setEnabled(false);
connect(copyAction, &QAction::triggered, this, [this]() { copySelectedText(); });
connect(copyAction, &QAction::triggered, this, [this]()
{
copySelectedText();
});
addAction(copyAction);
#ifdef Q_OS_LINUX
// Ctrl+Insert shortcut
QShortcut* copyCtrlInsShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Insert), this);
connect(copyCtrlInsShortcut, &QShortcut::activated, this, [this]() { copySelectedText(); });
connect(copyCtrlInsShortcut, &QShortcut::activated, this, [this]()
{
copySelectedText();
});
#endif
// select all action (ie. Ctrl+A)
selectAllAction = new QAction(this);
selectAllAction->setIcon(QIcon::fromTheme("edit-select-all"));
selectAllAction->setShortcut(QKeySequence::SelectAll);
connect(selectAllAction, &QAction::triggered, this, [this]() { selectAll(); });
connect(selectAllAction, &QAction::triggered, this, [this]()
{
selectAll();
});
addAction(selectAllAction);
// This timer is used to scroll the view while the user is

View File

@ -328,7 +328,7 @@ void Profile::saveToxSave(QByteArray data)
saveFile.write(data);
// check if everything got written
if(saveFile.flush())
if (saveFile.flush())
{
saveFile.commit();
newProfile = false;
@ -511,23 +511,23 @@ QVector<QString> Profile::remove()
QVector<QString> ret;
if(!profileMain.remove() && profileMain.exists())
if (!profileMain.remove() && profileMain.exists())
{
ret.push_back(profileMain.fileName());
qWarning() << "Could not remove file " << profileMain.fileName();
}
if(!profileConfig.remove() && profileConfig.exists())
if (!profileConfig.remove() && profileConfig.exists())
{
ret.push_back(profileConfig.fileName());
qWarning() << "Could not remove file " << profileConfig.fileName();
}
if(!historyLegacyUnencrypted.remove() && historyLegacyUnencrypted.exists())
if (!historyLegacyUnencrypted.remove() && historyLegacyUnencrypted.exists())
{
ret.push_back(historyLegacyUnencrypted.fileName());
qWarning() << "Could not remove file " << historyLegacyUnencrypted.fileName();
}
if(!historyLegacyEncrypted.remove() && historyLegacyEncrypted.exists())
if (!historyLegacyEncrypted.remove() && historyLegacyEncrypted.exists())
{
ret.push_back(historyLegacyEncrypted.fileName());
qWarning() << "Could not remove file " << historyLegacyUnencrypted.fileName();
@ -535,7 +535,7 @@ QVector<QString> Profile::remove()
if (history)
{
if(!history->remove() && QFile::exists(History::getDbPath(name)))
if (!history->remove() && QFile::exists(History::getDbPath(name)))
{
ret.push_back(History::getDbPath(name));
qWarning() << "Could not remove file " << History::getDbPath(name);

View File

@ -283,7 +283,7 @@ void SettingsSerializer::save()
f.write(data);
// check if everything got written
if(f.flush())
if (f.flush())
{
f.commit();
}
@ -412,10 +412,10 @@ void SettingsSerializer::readIni()
// Add all keys
if (!s.group().isEmpty())
beginGroup(s.group());
for (QString k : s.childKeys())
{
setValue(k, s.value(k));
//qDebug() << "Read key "<<k<<" in group "<<group<<":\""<<groups[group]<<"\"";
}
// Add all groups
@ -492,7 +492,6 @@ void SettingsSerializer::readIni()
groupsToKill.append(v.group);
arrays.append(a);
values.removeAt(i);
//qDebug() << "Found array"<<a.name<<"in group"<<a.group<<"size"<<a.size;
}
// Associate each array's values with the array
@ -514,7 +513,6 @@ void SettingsSerializer::readIni()
if (!ok)
continue;
groupsToKill.append(g);
//qDebug() << "Found element"<<groupArrayIndex<<"of array"<<a.name;
if (groupArrayIndex > a.size)
a.size = groupArrayIndex;
@ -530,7 +528,6 @@ void SettingsSerializer::readIni()
v.array = ai;
v.arrayIndex = groupArrayIndex;
a.values.append(vi);
//qDebug() << "Found key"<<v.key<<"at index"<<groupArrayIndex<<"of array"<<a.name;
}
}
}
@ -541,7 +538,7 @@ void SettingsSerializer::readIni()
{
if (groupSizes[g])
continue;
//qDebug() << "Removing spurious array group"<<g<<groupSizes[g];
removeGroup(g);
}