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:
parent
d16b6cd283
commit
72a76dba03
10
core.cpp
10
core.cpp
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user