Files
lmms/plugins/HydrogenImport/LocalFileMng.h
Dalton Messmer e6776bcfe5 Remove usage of QTextCodec in Hydrogen Import plugin (#7562)
* Remove QTextCodec

QTextCodec was removed from Qt6 and is only available through the
Qt5Compat module.

QTextCodec was only used by the HydrogenImport plugin when importing old
Hydrogen files that were saved using TinyXML before it supported UTF-8.
HydrogenImport would use QTextCodec to try to get the current encoding
from the locale, and then use that as a best guess for interpreting the
XML data in the unspecified encoding it was saved in. None of this was
ever reliable, since the encoding of the computer that saved the
Hydrogen file might not be the same as the computer running LMMS and
importing that file.

There is no good solution here, so I decided to simply assume the old
Hydrogen files are UTF-8 encoded. The worst that can happen is someone's
ancient Hydrogen files containing non-ASCII text of some random encoding
becomes mojibake'd after importing into LMMS, which is something that
already could have happened.

* Clean up a little
2024-10-23 13:17:14 -04:00

31 lines
1.1 KiB
C++

#ifndef LFILEMNG_H
#define LFILEMNG_H
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <QDomDocument>
namespace lmms
{
class LocalFileMng
{
public:
static QString readXmlString( QDomNode , const QString& nodeName, const QString& defaultValue, bool bCanBeEmpty = false, bool bShouldExists = true , bool tinyXmlCompatMode = false);
static float readXmlFloat( QDomNode , const QString& nodeName, float defaultValue, bool bCanBeEmpty = false, bool bShouldExists = true , bool tinyXmlCompatMode = false);
static int readXmlInt( QDomNode , const QString& nodeName, int defaultValue, bool bCanBeEmpty = false, bool bShouldExists = true , bool tinyXmlCompatMode = false);
static bool readXmlBool( QDomNode , const QString& nodeName, bool defaultValue, bool bShouldExists = true , bool tinyXmlCompatMode = false );
static void convertFromTinyXMLString( QByteArray* str );
static bool checkTinyXMLCompatMode( const QString& filename );
static QDomDocument openXmlDocument( const QString& filename );
};
} // namespace lmms
#endif //LFILEMNG_H