mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
More Qt cleanup.
This commit is contained in:
parent
bf2457594e
commit
df7afb956a
9 changed files with 72 additions and 105 deletions
|
@ -79,6 +79,32 @@ void lcApplication::SetClipboard(const QByteArray& Clipboard)
|
|||
gMainWindow->UpdatePaste(!mClipboard.isEmpty());
|
||||
}
|
||||
|
||||
void lcApplication::ExportClipboard(const QByteArray& Clipboard)
|
||||
{
|
||||
QMimeData* MimeData = new QMimeData();
|
||||
|
||||
MimeData->setData("application/vnd.leocad-clipboard", Clipboard);
|
||||
QApplication::clipboard()->setMimeData(MimeData);
|
||||
|
||||
SetClipboard(Clipboard);
|
||||
}
|
||||
|
||||
void lcApplication::GetFileList(const char* Path, lcArray<String>& FileList)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryInstallPath, const char* LDrawPath, const char* LibraryCachePath)
|
||||
{
|
||||
if (mLibrary == NULL)
|
||||
|
|
|
@ -48,8 +48,6 @@ public:
|
|||
|
||||
bool LoadPiecesLibrary(const char* LibPath, const char* LibraryInstallPath, const char* LDrawPath, const char* LibraryCachePath);
|
||||
|
||||
void OpenURL(const char* URL);
|
||||
void RunProcess(const char* ExecutablePath, const lcArray<String>& Arguments);
|
||||
void GetFileList(const char* Path, lcArray<String>& FileList);
|
||||
void SetClipboard(const QByteArray& Clipboard);
|
||||
void ExportClipboard(const QByteArray& Clipboard);
|
||||
|
|
|
@ -283,7 +283,7 @@ protected:
|
|||
|
||||
NumRead = ReadBuffer(Buffer, Count * 2) / 2;
|
||||
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
lcuint8 Temp[2];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
||||
|
@ -306,7 +306,7 @@ protected:
|
|||
|
||||
NumRead = ReadBuffer(Buffer, Count * 4) / 4;
|
||||
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
lcuint8 Temp[4];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
||||
|
@ -333,7 +333,7 @@ protected:
|
|||
|
||||
NumRead = ReadBuffer(Buffer, Count * 8) / 8;
|
||||
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
lcuint8 Temp[8];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
||||
|
@ -369,7 +369,7 @@ protected:
|
|||
|
||||
size_t Write16(const void* Buffer, size_t Count)
|
||||
{
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
size_t BytesWritten = 0;
|
||||
lcuint8 Temp[2];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
@ -390,7 +390,7 @@ protected:
|
|||
|
||||
size_t Write32(const void* Buffer, size_t Count)
|
||||
{
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
size_t BytesWritten = 0;
|
||||
lcuint8 Temp[4];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
@ -413,7 +413,7 @@ protected:
|
|||
|
||||
size_t Write64(const void* Buffer, size_t Count)
|
||||
{
|
||||
#ifdef LC_BIG_ENDIAN
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
size_t BytesWritten = 0;
|
||||
lcuint8 Temp[8];
|
||||
lcuint8* Bytes = (lcuint8*)Buffer;
|
||||
|
|
|
@ -1,7 +1,38 @@
|
|||
#ifndef _LC_GLOBAL_H_
|
||||
#define _LC_GLOBAL_H_
|
||||
|
||||
#include "lc_config.h"
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QtOpenGL>
|
||||
#include <QGLWidget>
|
||||
#include <QtGui>
|
||||
|
||||
// Old defines and declarations.
|
||||
#define LC_MAXPATH 1024
|
||||
|
||||
#define LC_POINTER_TO_INT(p) ((lcint32) (quintptr) (p))
|
||||
|
||||
typedef qint8 lcint8;
|
||||
typedef quint8 lcuint8;
|
||||
typedef qint16 lcint16;
|
||||
typedef quint16 lcuint16;
|
||||
typedef qint32 lcint32;
|
||||
typedef quint32 lcuint32;
|
||||
typedef qint64 lcint64;
|
||||
typedef quint64 lcuint64;
|
||||
typedef quintptr lcuintptr;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define snprintf _snprintf
|
||||
#define isnan _isnan
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
char* strcasestr(const char *s, const char *find);
|
||||
#else
|
||||
char* strupr(char* string);
|
||||
char* strlwr(char* string);
|
||||
int stricmp(const char* str1, const char* str2);
|
||||
#endif
|
||||
|
||||
// Version number.
|
||||
#define LC_VERSION_MAJOR 0
|
||||
|
|
|
@ -2140,11 +2140,11 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
break;
|
||||
|
||||
case LC_HELP_HOMEPAGE:
|
||||
g_App->OpenURL("http://www.leocad.org/");
|
||||
QDesktopServices::openUrl(QUrl("http://www.leocad.org/"));
|
||||
break;
|
||||
|
||||
case LC_HELP_EMAIL:
|
||||
g_App->OpenURL("mailto:leozide@gmail.com?subject=LeoCAD");
|
||||
QDesktopServices::openUrl(QUrl("mailto:leozide@gmail.com?subject=LeoCAD"));
|
||||
break;
|
||||
|
||||
case LC_HELP_UPDATES:
|
||||
|
|
|
@ -1521,18 +1521,18 @@ void Project::ExportPOVRay()
|
|||
|
||||
if (Options.Render)
|
||||
{
|
||||
lcArray<String> Arguments;
|
||||
QStringList Arguments;
|
||||
char Argument[LC_MAXPATH + 32];
|
||||
|
||||
sprintf(Argument, "+I%s", Options.FileName);
|
||||
Arguments.Add(Argument);
|
||||
Arguments.append(Argument);
|
||||
|
||||
if (Options.LGEOPath[0])
|
||||
{
|
||||
sprintf(Argument, "+L%slg/", Options.LGEOPath);
|
||||
Arguments.Add(Argument);
|
||||
Arguments.append(Argument);
|
||||
sprintf(Argument, "+L%sar/", Options.LGEOPath);
|
||||
Arguments.Add(Argument);
|
||||
Arguments.append(Argument);
|
||||
}
|
||||
|
||||
sprintf(Argument, "+o%s", Options.FileName);
|
||||
|
@ -1545,10 +1545,10 @@ void Project::ExportPOVRay()
|
|||
else
|
||||
*(Slash2 + 1) = 0;
|
||||
|
||||
Arguments.Add(Argument);
|
||||
Arguments.append(Argument);
|
||||
}
|
||||
|
||||
g_App->RunProcess(Options.POVRayPath, Arguments);
|
||||
QProcess::execute(Options.POVRayPath, Arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,6 @@ SOURCES += common/view.cpp \
|
|||
qt/lc_qpreferencesdialog.cpp \
|
||||
qt/lc_qcategorydialog.cpp \
|
||||
qt/lc_qimagedialog.cpp \
|
||||
qt/lc_qapplication.cpp \
|
||||
qt/lc_qupdatedialog.cpp \
|
||||
qt/lc_qutils.cpp \
|
||||
qt/lc_qpropertiestree.cpp \
|
||||
|
@ -207,7 +206,6 @@ HEADERS += \
|
|||
common/group.h \
|
||||
common/debug.h \
|
||||
common/camera.h \
|
||||
qt/lc_config.h \
|
||||
qt/lc_qpovraydialog.h \
|
||||
qt/lc_qarraydialog.h \
|
||||
qt/lc_qgroupdialog.h \
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef _LC_CONFIG_H_
|
||||
#define _LC_CONFIG_H_
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QtOpenGL>
|
||||
#include <QGLWidget>
|
||||
#include <QtGui>
|
||||
|
||||
#define LC_MAXPATH 1024
|
||||
|
||||
#define LC_POINTER_TO_INT(p) ((lcint32) (quintptr) (p))
|
||||
|
||||
typedef qint8 lcint8;
|
||||
typedef quint8 lcuint8;
|
||||
typedef qint16 lcint16;
|
||||
typedef quint16 lcuint16;
|
||||
typedef qint32 lcint32;
|
||||
typedef quint32 lcuint32;
|
||||
typedef qint64 lcint64;
|
||||
typedef quint64 lcuint64;
|
||||
typedef quintptr lcuintptr;
|
||||
|
||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
#define LC_LITTLE_ENDIAN
|
||||
#else
|
||||
#define LC_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define snprintf _snprintf
|
||||
#define isnan _isnan
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
char* strcasestr(const char *s, const char *find);
|
||||
#else
|
||||
char* strupr(char* string);
|
||||
char* strlwr(char* string);
|
||||
int stricmp(const char* str1, const char* str2);
|
||||
#endif
|
||||
|
||||
#endif // _LC_CONFIG_H_
|
|
@ -1,44 +0,0 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_application.h"
|
||||
#include "lc_file.h"
|
||||
|
||||
void lcApplication::OpenURL(const char* URL)
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(URL));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void lcApplication::ExportClipboard(const QByteArray& Clipboard)
|
||||
{
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
|
||||
mimeData->setData("application/vnd.leocad-clipboard", Clipboard);
|
||||
QApplication::clipboard()->setMimeData(mimeData);
|
||||
|
||||
SetClipboard(Clipboard);
|
||||
}
|
||||
|
||||
void lcApplication::GetFileList(const char* Path, lcArray<String>& FileList)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue