30 lines
698 B
C++
30 lines
698 B
C++
#include "importmidi_inner.h"
|
|
#include "preferences.h"
|
|
|
|
|
|
namespace Ms {
|
|
namespace MidiCharset {
|
|
|
|
QString convertToCharset(const std::string &text)
|
|
{
|
|
// charset for the current MIDI file
|
|
QString charset = preferences.midiImportOperations.charset();
|
|
auto *codec = QTextCodec::codecForName(charset.toLatin1());
|
|
if (codec)
|
|
return codec->toUnicode(text.c_str());
|
|
else
|
|
return QString::fromStdString(text);
|
|
}
|
|
|
|
QString defaultCharset()
|
|
{
|
|
return "UTF-8";
|
|
}
|
|
|
|
std::string fromUchar(const uchar *text)
|
|
{
|
|
return reinterpret_cast<const char*>(text);
|
|
}
|
|
|
|
} // namespace MidiCharset
|
|
} // namespace Ms
|