Use QtConcurrent::run() in ShellIntegration class instead of manually managing the thread. ShellIntegration is now completely static and must not be instantiated.
This commit is contained in:
parent
54c6cae91b
commit
c5606cf45a
@ -29,8 +29,8 @@
|
|||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 3
|
#define VER_LAMEXP_MINOR_LO 3
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 4
|
||||||
#define VER_LAMEXP_BUILD 602
|
#define VER_LAMEXP_BUILD 603
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
#include <Shlobj.h>
|
#include <Shlobj.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
@ -49,15 +50,9 @@ QMutex ShellIntegration::m_mutex;
|
|||||||
// Constructor
|
// Constructor
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ShellIntegration::ShellIntegration(bool install)
|
ShellIntegration::ShellIntegration(void)
|
||||||
:
|
|
||||||
QThread(),
|
|
||||||
m_install(install)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ShellIntegration::~ShellIntegration(void)
|
|
||||||
{
|
{
|
||||||
|
throw "Cannot create instance of this class, sorry!";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -69,9 +64,7 @@ void ShellIntegration::install(bool async)
|
|||||||
//Install asynchronously
|
//Install asynchronously
|
||||||
if(async)
|
if(async)
|
||||||
{
|
{
|
||||||
ShellIntegration *shellIntegration = new ShellIntegration(true);
|
QFuture<void>(QtConcurrent::run(install, false));
|
||||||
connect(shellIntegration, SIGNAL(finished()), shellIntegration, SLOT(deleteLater()));
|
|
||||||
shellIntegration->start();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,9 +136,7 @@ void ShellIntegration::remove(bool async)
|
|||||||
//Remove asynchronously
|
//Remove asynchronously
|
||||||
if(async)
|
if(async)
|
||||||
{
|
{
|
||||||
ShellIntegration *shellIntegration = new ShellIntegration(false);
|
QFuture<void>(QtConcurrent::run(remove, false));
|
||||||
connect(shellIntegration, SIGNAL(finished()), shellIntegration, SLOT(deleteLater()));
|
|
||||||
shellIntegration->start();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QThread>
|
#include <QObject>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
|
|
||||||
class ShellIntegration : public QThread
|
class ShellIntegration : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -35,18 +35,9 @@ public:
|
|||||||
static void install(bool async = true);
|
static void install(bool async = true);
|
||||||
static void remove(bool async = true);
|
static void remove(bool async = true);
|
||||||
|
|
||||||
protected:
|
|
||||||
void run()
|
|
||||||
{
|
|
||||||
if(m_install) install(false); else remove(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ShellIntegration(bool install = true);
|
ShellIntegration(void);
|
||||||
~ShellIntegration(void);
|
|
||||||
|
|
||||||
static QStringList *detectTypes(const QString &lamexpFileType, const QString &lamexpShellAction);
|
static QStringList *detectTypes(const QString &lamexpFileType, const QString &lamexpShellAction);
|
||||||
static QMutex m_mutex;
|
static QMutex m_mutex;
|
||||||
|
|
||||||
bool m_install;
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user