Files
86Box/src/qt/qt_util.cpp

48 lines
1008 B
C++
Raw Normal View History

2022-02-07 15:00:02 +06:00
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Utility functions.
*
*
*
* Authors: Teemu Korhonen
*
* Copyright 2022 Teemu Korhonen
*/
#include <QStringBuilder>
#include <QStringList>
#include "qt_util.hpp"
namespace util
{
QString DlgFilter(std::initializer_list<QString> extensions, bool last)
{
QStringList temp;
for (auto ext : extensions)
{
#ifdef Q_OS_UNIX
if (ext == "*")
{
temp.append("*");
continue;
}
temp.append("*." % ext.toUpper());
#endif
temp.append("*." % ext);
}
#ifdef Q_OS_UNIX
temp.removeDuplicates();
#endif
return " (" % temp.join(' ') % ")" % (!last ? ";;" : "");
}
2022-02-07 15:00:02 +06:00
}