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

implement sanitize, one tweak

This commit is contained in:
dubslow 2014-09-12 14:38:14 -05:00
parent d16b6cd283
commit 72a76dba03
2 changed files with 11 additions and 1 deletions

View File

@ -888,7 +888,15 @@ void Core::checkConnection()
QString Core::sanitize(QString name)
{
// do things
// these are pretty much Windows banned filename characters
QList<QChar> banned = {'/', '\\', ':', '<', '>', '"', '|', '?', '*'};
for (QChar c : banned)
name.replace(c, '_');
// also remove leading and trailing periods
if (name[0] == '.')
name[0] = '_';
if (name.endsWith('.'))
name[name.length()-1] = '_';
return name;
}

View File

@ -141,6 +141,8 @@ void SettingsForm::show(Ui::MainWindow &ui)
{
profiles.addItem(profile);
}
if (QString current = Settings::getInstance().getCurrentProfile())
profiles.setCurrentText(current);
ui.mainContent->layout()->addWidget(main);
ui.mainHead->layout()->addWidget(head);
main->show();