leocad/qt/lc_qapplication.cpp

45 lines
1.1 KiB
C++
Raw Normal View History

2013-08-09 06:57:18 +02:00
#include "lc_global.h"
#include "lc_application.h"
#include "lc_file.h"
void lcApplication::OpenURL(const char* URL)
{
QDesktopServices::openUrl(QUrl(URL));
}
2013-08-17 01:17:25 +02:00
void lcApplication::RunProcess(const char* ExecutablePath, const lcArray<String>& Arguments)
{
QStringList argumentList;
for (int argIdx = 0; argIdx < Arguments.GetSize(); argIdx++)
argumentList << (const char*)Arguments[argIdx];
QProcess::execute(ExecutablePath, argumentList);
}
2014-12-16 00:55:17 +01:00
void lcApplication::ExportClipboard(const QByteArray& Clipboard)
2013-08-09 06:57:18 +02:00
{
QMimeData *mimeData = new QMimeData();
2014-12-16 00:55:17 +01:00
mimeData->setData("application/vnd.leocad-clipboard", Clipboard);
2013-08-09 06:57:18 +02:00
QApplication::clipboard()->setMimeData(mimeData);
SetClipboard(Clipboard);
}
2013-08-16 01:43:18 +02:00
void lcApplication::GetFileList(const char* Path, lcArray<String>& FileList)
2013-08-09 06:57:18 +02:00
{
QDir dir(Path);
dir.setFilter(QDir::Files | QDir::Hidden | QDir::Readable);
FileList.RemoveAll();
QStringList files = dir.entryList();
for (int fileIdx = 0; fileIdx < files.size(); fileIdx++)
{
QString absolutePath = dir.absoluteFilePath(files[fileIdx]);
FileList.Add(absolutePath.toLocal8Bit().data());
}
}