示例#1
0
void SteamClient::updateLocation(QString status, QUrl locationUrl) {
    if (!initialized) {
        return;
    }

    auto connectStr = locationUrl.isEmpty() ? "" : CONNECT_PREFIX + locationUrl.toString() + CONNECT_SUFFIX;

    SteamFriends()->SetRichPresence("status", status.toLocal8Bit().data());
    SteamFriends()->SetRichPresence("connect", connectStr.toLocal8Bit().data());
}
示例#2
0
std::ofstream openBinaryOStream(const QString& file)
{
#if defined(WINDOWS_OS)
    std::ofstream out(file.toStdWString(), std::ios::out | std::ios::binary | std::ios::trunc);
#elif defined(LINUX_OS)
    std::ofstream out(toLocal8Bit(file), std::ios::out | std::ios::binary | std::ios::trunc);
#else
#  error Unimplemented function
#endif
    return out;
}
示例#3
0
std::ifstream openBinaryIStream(const QString& file)
{
#if defined(WINDOWS_OS)
    std::ifstream in(file.toStdWString(), std::ios::in | std::ios::binary);
#elif defined(LINUX_OS)
    std::ifstream in(toLocal8Bit(file), std::ios::in | std::ios::binary);
#else
    error unimplemented function
#endif
    return in;

}
示例#4
0
void FileFormatTest::saveAndLoad_data()
{
	// Add all file formats which support import and export
	QTest::addColumn<QString>("format_id");
	QTest::addColumn<QString>("map_filename");
	
	for (auto format : FileFormats.formats())
	{
		if (format->supportsExport() && format->supportsImport())
		{
			for (const auto& filename : map_filenames)
			{
				auto id = QString { QFileInfo(filename).fileName() % " <> " % format->id() };
				QTest::newRow(id.toLocal8Bit()) << format->id() << filename;
			}
		}
	}
}
示例#5
0
void ProcessForker::run()
{
    ReceiveBuffer buffer;

    while (_processMessages)
    {
        const auto result = _communicator.probe();
        if (!result.isValid())
        {
            print_log(LOG_ERROR, LOG_MPI, "Invalid probe result size: %d",
                      result.size);
            continue;
        }

        buffer.setSize(result.size);
        _communicator.receive(result.src, buffer.data(), buffer.size(),
                              int(result.messageType));

        switch (result.messageType)
        {
        case MessageType::START_PROCESS:
        {
            const auto string = serialization::get<QString>(buffer);
            const auto args = string.split('#');
            if (args.length() != 3)
            {
                print_log(LOG_WARN, LOG_MPI, "Invalid command: '%d'",
                          string.toLocal8Bit().constData());
                break;
            }
            _launch(args[0], args[1], args[2].split(';'));
            break;
        }
        case MessageType::QUIT:
            _processMessages = false;
            break;
        default:
            print_log(LOG_WARN, LOG_MPI, "Invalid message type: '%d'",
                      result.messageType);
            break;
        }
    }
}
示例#6
0
static std::string getFormat( QString path ){
	auto ext = QFileInfo(path).suffix().toLower();
	
	return {ext.toLocal8Bit().constData()};
}