mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-25 10:20:54 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
1aea0f981c
16 changed files with 407 additions and 161 deletions
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2016 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 32155 $ on $Date: 2015-10-22 23:25:39 -0400 (Thu, 22 Oct 2015) $
|
||||
** Khronos $Revision: 32957 $ on $Date: 2016-06-09 17:03:08 -0400 (Thu, 09 Jun 2016) $
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
|||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
#define GL_GLEXT_VERSION 20151022
|
||||
#define GL_GLEXT_VERSION 20160609
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gl
|
||||
|
@ -5596,6 +5596,10 @@ GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLf
|
|||
#define GL_AMD_shader_atomic_counter_ops 1
|
||||
#endif /* GL_AMD_shader_atomic_counter_ops */
|
||||
|
||||
#ifndef GL_AMD_shader_explicit_vertex_parameter
|
||||
#define GL_AMD_shader_explicit_vertex_parameter 1
|
||||
#endif /* GL_AMD_shader_explicit_vertex_parameter */
|
||||
|
||||
#ifndef GL_AMD_shader_stencil_export
|
||||
#define GL_AMD_shader_stencil_export 1
|
||||
#endif /* GL_AMD_shader_stencil_export */
|
||||
|
@ -8636,6 +8640,20 @@ GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei s
|
|||
#endif
|
||||
#endif /* GL_EXT_vertex_weighting */
|
||||
|
||||
#ifndef GL_EXT_window_rectangles
|
||||
#define GL_EXT_window_rectangles 1
|
||||
#define GL_INCLUSIVE_EXT 0x8F10
|
||||
#define GL_EXCLUSIVE_EXT 0x8F11
|
||||
#define GL_WINDOW_RECTANGLE_EXT 0x8F12
|
||||
#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
|
||||
#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
|
||||
#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
|
||||
typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
|
||||
#endif
|
||||
#endif /* GL_EXT_window_rectangles */
|
||||
|
||||
#ifndef GL_EXT_x11_sync_object
|
||||
#define GL_EXT_x11_sync_object 1
|
||||
#define GL_SYNC_X11_FENCE_EXT 0x90E1
|
||||
|
@ -9129,6 +9147,17 @@ GLAPI void APIENTRY glBlendBarrierNV (void);
|
|||
#define GL_NV_blend_square 1
|
||||
#endif /* GL_NV_blend_square */
|
||||
|
||||
#ifndef GL_NV_clip_space_w_scaling
|
||||
#define GL_NV_clip_space_w_scaling 1
|
||||
#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
|
||||
#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
|
||||
#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
|
||||
typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
|
||||
#endif
|
||||
#endif /* GL_NV_clip_space_w_scaling */
|
||||
|
||||
#ifndef GL_NV_command_list
|
||||
#define GL_NV_command_list 1
|
||||
#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000
|
||||
|
@ -9231,6 +9260,17 @@ GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat valu
|
|||
#endif
|
||||
#endif /* GL_NV_conservative_raster_dilate */
|
||||
|
||||
#ifndef GL_NV_conservative_raster_pre_snap_triangles
|
||||
#define GL_NV_conservative_raster_pre_snap_triangles 1
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
|
||||
#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
|
||||
typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
|
||||
#endif
|
||||
#endif /* GL_NV_conservative_raster_pre_snap_triangles */
|
||||
|
||||
#ifndef GL_NV_copy_depth_to_color
|
||||
#define GL_NV_copy_depth_to_color 1
|
||||
#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
|
||||
|
@ -10223,6 +10263,11 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname,
|
|||
#endif
|
||||
#endif /* GL_NV_register_combiners2 */
|
||||
|
||||
#ifndef GL_NV_robustness_video_memory_purge
|
||||
#define GL_NV_robustness_video_memory_purge 1
|
||||
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
|
||||
#endif /* GL_NV_robustness_video_memory_purge */
|
||||
|
||||
#ifndef GL_NV_sample_locations
|
||||
#define GL_NV_sample_locations 1
|
||||
#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
|
||||
|
@ -10255,6 +10300,10 @@ GLAPI void APIENTRY glResolveDepthValuesNV (void);
|
|||
#define GL_NV_shader_atomic_float 1
|
||||
#endif /* GL_NV_shader_atomic_float */
|
||||
|
||||
#ifndef GL_NV_shader_atomic_float64
|
||||
#define GL_NV_shader_atomic_float64 1
|
||||
#endif /* GL_NV_shader_atomic_float64 */
|
||||
|
||||
#ifndef GL_NV_shader_atomic_fp16_vector
|
||||
#define GL_NV_shader_atomic_fp16_vector 1
|
||||
#endif /* GL_NV_shader_atomic_fp16_vector */
|
||||
|
@ -10318,6 +10367,10 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs
|
|||
#define GL_NV_shader_thread_shuffle 1
|
||||
#endif /* GL_NV_shader_thread_shuffle */
|
||||
|
||||
#ifndef GL_NV_stereo_view_rendering
|
||||
#define GL_NV_stereo_view_rendering 1
|
||||
#endif /* GL_NV_stereo_view_rendering */
|
||||
|
||||
#ifndef GL_NV_tessellation_program5
|
||||
#define GL_NV_tessellation_program5 1
|
||||
#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
|
||||
|
@ -11088,6 +11141,26 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot
|
|||
#define GL_NV_viewport_array2 1
|
||||
#endif /* GL_NV_viewport_array2 */
|
||||
|
||||
#ifndef GL_NV_viewport_swizzle
|
||||
#define GL_NV_viewport_swizzle 1
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
|
||||
#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
|
||||
#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
|
||||
#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
|
||||
#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
|
||||
#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
|
||||
#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
|
||||
typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
|
||||
#endif
|
||||
#endif /* GL_NV_viewport_swizzle */
|
||||
|
||||
#ifndef GL_OML_interlace
|
||||
#define GL_OML_interlace 1
|
||||
#define GL_INTERLACE_OML 0x8980
|
||||
|
|
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2016 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -33,10 +33,10 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||
** Khronos $Revision: 32889 $ on $Date: 2016-05-31 07:09:51 -0400 (Tue, 31 May 2016) $
|
||||
*/
|
||||
|
||||
#define GLX_GLXEXT_VERSION 20150623
|
||||
#define GLX_GLXEXT_VERSION 20160531
|
||||
|
||||
/* Generated C header for:
|
||||
* API: glx
|
||||
|
@ -317,6 +317,11 @@ void glXFreeContextEXT (Display *dpy, GLXContext context);
|
|||
#endif
|
||||
#endif /* GLX_EXT_import_context */
|
||||
|
||||
#ifndef GLX_EXT_libglvnd
|
||||
#define GLX_EXT_libglvnd 1
|
||||
#define GLX_VENDOR_NAMES_EXT 0x20F6
|
||||
#endif /* GLX_EXT_libglvnd */
|
||||
|
||||
#ifndef GLX_EXT_stereo_tree
|
||||
#define GLX_EXT_stereo_tree 1
|
||||
typedef struct {
|
||||
|
@ -543,6 +548,11 @@ int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int vi
|
|||
#endif
|
||||
#endif /* GLX_NV_present_video */
|
||||
|
||||
#ifndef GLX_NV_robustness_video_memory_purge
|
||||
#define GLX_NV_robustness_video_memory_purge 1
|
||||
#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7
|
||||
#endif /* GLX_NV_robustness_video_memory_purge */
|
||||
|
||||
#ifndef GLX_NV_swap_group
|
||||
#define GLX_NV_swap_group 1
|
||||
typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
|
||||
|
|
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2016 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||
** Khronos $Revision: 32686 $ on $Date: 2016-04-19 21:08:44 -0400 (Tue, 19 Apr 2016) $
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define WGL_WGLEXT_VERSION 20150623
|
||||
#define WGL_WGLEXT_VERSION 20160419
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
|
|
|
@ -1991,24 +1991,29 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
|
|||
|
||||
if (ext.WGLNVGPUAffinity)
|
||||
{
|
||||
uint i = 0;
|
||||
uint gpuIndex = 0;
|
||||
|
||||
HGPUNV hGPU;
|
||||
|
||||
while(nwglEnumGpusNV(i, &hGPU))
|
||||
// list all GPUs
|
||||
while (nwglEnumGpusNV(gpuIndex, &hGPU))
|
||||
{
|
||||
uint j = 0;
|
||||
|
||||
PGPU_DEVICE lpGpuDevice = NULL;
|
||||
_GPU_DEVICE gpuDevice;
|
||||
gpuDevice.cb = sizeof(gpuDevice);
|
||||
|
||||
while(nwglEnumGpuDevicesNV(hGPU, j, lpGpuDevice))
|
||||
// list all devices connected to GPU
|
||||
while(nwglEnumGpuDevicesNV(hGPU, j, &gpuDevice))
|
||||
{
|
||||
nlinfo("Device: %s - %s - flags: %u", lpGpuDevice->DeviceName, lpGpuDevice->DeviceString, lpGpuDevice->Flags);
|
||||
nlinfo("Device: %s - %s - flags: %u - rect: (%u,%u)-(%u,%u)", gpuDevice.DeviceName, gpuDevice.DeviceString, (uint)gpuDevice.Flags,
|
||||
(uint)gpuDevice.rcVirtualScreen.left, (uint)gpuDevice.rcVirtualScreen.top,
|
||||
(uint)gpuDevice.rcVirtualScreen.right, (uint)gpuDevice.rcVirtualScreen.bottom);
|
||||
|
||||
++j;
|
||||
}
|
||||
|
||||
++i;
|
||||
++gpuIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,16 @@
|
|||
const CServer NoServer;
|
||||
const CProfile NoProfile;
|
||||
|
||||
QString CServer::getDirectory() const
|
||||
{
|
||||
return CConfigFile::getInstance()->getInstallationDirectory() + "/" + id;
|
||||
}
|
||||
|
||||
QString CProfile::getDirectory() const
|
||||
{
|
||||
return CConfigFile::getInstance()->getProfileDirectory() + "/" + id;
|
||||
}
|
||||
|
||||
CConfigFile *CConfigFile::s_instance = NULL;
|
||||
|
||||
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
|
||||
|
@ -277,6 +287,17 @@ CProfile CConfigFile::getProfile(int i) const
|
|||
return m_profiles.at(i);
|
||||
}
|
||||
|
||||
CProfile CConfigFile::getProfile(const QString &id) const
|
||||
{
|
||||
for (int i = 0; i < m_profiles.size(); ++i)
|
||||
{
|
||||
if (m_profiles[i].id == id) return m_profiles[i];
|
||||
}
|
||||
|
||||
// default profile
|
||||
return getProfile();
|
||||
}
|
||||
|
||||
void CConfigFile::setProfile(int i, const CProfile &profile)
|
||||
{
|
||||
m_profiles[i] = profile;
|
||||
|
@ -292,8 +313,14 @@ int CConfigFile::addProfile(const CProfile &profile)
|
|||
void CConfigFile::removeProfile(int i)
|
||||
{
|
||||
m_profiles.removeAt(i);
|
||||
}
|
||||
|
||||
// TODO: decalle all profiles and move files
|
||||
void CConfigFile::removeProfile(const QString &id)
|
||||
{
|
||||
for (int i = 0; i < m_profiles.size(); ++i)
|
||||
{
|
||||
if (m_profiles[i].id == id) removeProfile(i);
|
||||
}
|
||||
}
|
||||
|
||||
bool CConfigFile::has64bitsOS()
|
||||
|
@ -603,7 +630,7 @@ QString CConfigFile::getServerClientFullPath(const QString &serverId) const
|
|||
|
||||
if (server.clientFilename.isEmpty()) return "";
|
||||
|
||||
return getInstallationDirectory() + "/" + server.id + "/" + server.clientFilename;
|
||||
return server.getDirectory() + "/" + server.clientFilename;
|
||||
}
|
||||
|
||||
QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) const
|
||||
|
@ -612,7 +639,7 @@ QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) con
|
|||
|
||||
if (server.configurationFilename.isEmpty()) return "";
|
||||
|
||||
return getInstallationDirectory() + "/" + server.id + "/" + server.configurationFilename;
|
||||
return server.getDirectory() + "/" + server.configurationFilename;
|
||||
}
|
||||
|
||||
QString CConfigFile::getSrcServerClientBNPFullPath() const
|
||||
|
@ -620,7 +647,7 @@ QString CConfigFile::getSrcServerClientBNPFullPath() const
|
|||
return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch());
|
||||
}
|
||||
|
||||
CConfigFile::InstallationStep CConfigFile::getNextStep() const
|
||||
OperationStep CConfigFile::getInstallNextStep() const
|
||||
{
|
||||
// get last used profile
|
||||
const CProfile &profile = getProfile();
|
||||
|
@ -669,7 +696,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
|
|||
return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard;
|
||||
}
|
||||
|
||||
QString serverDirectory = getInstallationDirectory() + "/" + server.id;
|
||||
QString serverDirectory = server.getDirectory();
|
||||
|
||||
if (getSrcServerDirectory().isEmpty())
|
||||
{
|
||||
|
@ -712,7 +739,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
|
|||
// selected directory contains Ryzom files (shouldn't fail)
|
||||
if (areRyzomDataInstalledIn(getSrcServerDirectory()))
|
||||
{
|
||||
return CopyServerFiles;
|
||||
return CopyDataFiles;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
#ifndef CONFIGFILE_H
|
||||
#define CONFIGFILE_H
|
||||
|
||||
struct CServer
|
||||
#include "operation.h"
|
||||
|
||||
class CServer
|
||||
{
|
||||
public:
|
||||
CServer()
|
||||
{
|
||||
dataCompressedSize = 0;
|
||||
|
@ -39,14 +42,18 @@ struct CServer
|
|||
QString configurationFilename;
|
||||
QString installerFilename;
|
||||
QString comments;
|
||||
|
||||
// helpers
|
||||
QString getDirectory() const;
|
||||
};
|
||||
|
||||
extern const CServer NoServer;
|
||||
|
||||
typedef QVector<CServer> CServers;
|
||||
|
||||
struct CProfile
|
||||
class CProfile
|
||||
{
|
||||
public:
|
||||
CProfile()
|
||||
{
|
||||
desktopShortcut = false;
|
||||
|
@ -61,6 +68,9 @@ struct CProfile
|
|||
QString comments;
|
||||
bool desktopShortcut;
|
||||
bool menuShortcut;
|
||||
|
||||
// helpers
|
||||
QString getDirectory() const;
|
||||
};
|
||||
|
||||
extern const CProfile NoProfile;
|
||||
|
@ -78,27 +88,6 @@ class CConfigFile : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum InstallationStep
|
||||
{
|
||||
DisplayNoServerError,
|
||||
ShowInstallWizard,
|
||||
ShowMigrateWizard,
|
||||
DownloadData,
|
||||
ExtractDownloadedData,
|
||||
DownloadClient,
|
||||
ExtractDownloadedClient,
|
||||
CopyServerFiles,
|
||||
CopyProfileFiles,
|
||||
CleanFiles,
|
||||
ExtractBnpClient,
|
||||
CopyInstaller,
|
||||
UninstallOldClient,
|
||||
CreateProfile,
|
||||
CreateShortcuts,
|
||||
CreateAddRemoveEntry,
|
||||
Done
|
||||
};
|
||||
|
||||
CConfigFile(QObject *parent = NULL);
|
||||
virtual ~CConfigFile();
|
||||
|
||||
|
@ -123,9 +112,11 @@ public:
|
|||
|
||||
int getProfilesCount() const;
|
||||
CProfile getProfile(int i = -1) const;
|
||||
CProfile getProfile(const QString &id) const;
|
||||
void setProfile(int i, const CProfile &profile);
|
||||
int addProfile(const CProfile &profile);
|
||||
void removeProfile(int i);
|
||||
void removeProfile(const QString &id);
|
||||
|
||||
int getDefaultServerIndex() const;
|
||||
void setDefaultServerIndex(int index);
|
||||
|
@ -180,7 +171,7 @@ public:
|
|||
|
||||
QString getSrcServerClientBNPFullPath() const;
|
||||
|
||||
InstallationStep getNextStep() const;
|
||||
OperationStep getInstallNextStep() const;
|
||||
|
||||
// product details
|
||||
QString getProductName() const;
|
||||
|
|
|
@ -245,7 +245,7 @@ void CFilesExtractor::setSourceFile(const QString &src)
|
|||
m_sourceFile = src;
|
||||
}
|
||||
|
||||
void CFilesExtractor::setDesinationDirectory(const QString &dst)
|
||||
void CFilesExtractor::setDestinationDirectory(const QString &dst)
|
||||
{
|
||||
m_destinationDirectory = dst;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
virtual ~CFilesExtractor();
|
||||
|
||||
void setSourceFile(const QString &src);
|
||||
void setDesinationDirectory(const QString &src);
|
||||
void setDestinationDirectory(const QString &src);
|
||||
|
||||
bool exec();
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
// instanciate ConfigFile
|
||||
CConfigFile config;
|
||||
CConfigFile::InstallationStep step = config.load() ? config.getNextStep():CConfigFile::DisplayNoServerError;
|
||||
OperationStep step = config.load() ? config.getInstallNextStep():DisplayNoServerError;
|
||||
|
||||
if (step == CConfigFile::DisplayNoServerError)
|
||||
if (step == DisplayNoServerError)
|
||||
{
|
||||
QMessageBox::critical(NULL, QApplication::tr("Error"), QApplication::tr("Unable to find installer.ini"));
|
||||
return 1;
|
||||
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
|||
// add all servers by default
|
||||
for (int i = 0; i < config.getServersCount(); ++i)
|
||||
{
|
||||
components.servers << i;
|
||||
components.servers << config.getServer(i).id;
|
||||
}
|
||||
|
||||
// show uninstall wizard dialog if not in silent mode
|
||||
|
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
COperationDialog dialog;
|
||||
|
||||
dialog.setOperation(COperationDialog::OperationUninstall);
|
||||
dialog.setOperation(OperationUninstall);
|
||||
dialog.setUninstallComponents(components);
|
||||
|
||||
// TODO: set all components to uninstall
|
||||
|
@ -140,31 +140,31 @@ int main(int argc, char *argv[])
|
|||
return dialog.exec() ? 0 : 1;
|
||||
}
|
||||
|
||||
if (step == CConfigFile::ShowMigrateWizard)
|
||||
if (step == ShowMigrateWizard)
|
||||
{
|
||||
CMigrateDialog dialog;
|
||||
|
||||
if (!dialog.exec()) return 1;
|
||||
|
||||
step = config.getNextStep();
|
||||
step = config.getInstallNextStep();
|
||||
}
|
||||
else if (step == CConfigFile::ShowInstallWizard)
|
||||
else if (step == ShowInstallWizard)
|
||||
{
|
||||
CInstallDialog dialog;
|
||||
|
||||
if (!dialog.exec()) return 1;
|
||||
|
||||
step = config.getNextStep();
|
||||
step = config.getInstallNextStep();
|
||||
}
|
||||
|
||||
if (step != CConfigFile::Done)
|
||||
if (step != Done)
|
||||
{
|
||||
COperationDialog dialog;
|
||||
dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? COperationDialog::OperationInstall: COperationDialog::OperationMigrate);
|
||||
dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? OperationInstall:OperationMigrate);
|
||||
|
||||
if (!dialog.exec()) return 1;
|
||||
|
||||
step = config.getNextStep();
|
||||
step = config.getInstallNextStep();
|
||||
}
|
||||
|
||||
CMainWindow mainWindow;
|
||||
|
|
|
@ -153,7 +153,7 @@ void CMainWindow::onProfiles()
|
|||
{
|
||||
COperationDialog dialog(this);
|
||||
|
||||
dialog.setOperation(COperationDialog::OperationUpdateProfiles);
|
||||
dialog.setOperation(OperationUpdateProfiles);
|
||||
|
||||
if (!dialog.exec())
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ void CMainWindow::onUninstall()
|
|||
// add all servers by default
|
||||
for (int i = 0; i < config->getServersCount(); ++i)
|
||||
{
|
||||
components.servers << i;
|
||||
components.servers << config->getServer(i).id;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ void CMainWindow::onUninstall()
|
|||
|
||||
COperationDialog dialog;
|
||||
|
||||
dialog.setOperation(COperationDialog::OperationUninstall);
|
||||
dialog.setOperation(OperationUninstall);
|
||||
dialog.setUninstallComponents(components);
|
||||
|
||||
if (dialog.exec())
|
||||
|
|
|
@ -40,10 +40,40 @@ struct SUninstallComponents
|
|||
installer = true;
|
||||
}
|
||||
|
||||
QVector<int> servers;
|
||||
QVector<int> profiles;
|
||||
QStringList servers;
|
||||
QStringList profiles;
|
||||
|
||||
bool installer;
|
||||
};
|
||||
|
||||
enum OperationStep
|
||||
{
|
||||
DisplayNoServerError,
|
||||
ShowInstallWizard,
|
||||
ShowMigrateWizard,
|
||||
DownloadData,
|
||||
ExtractDownloadedData,
|
||||
DownloadClient,
|
||||
ExtractDownloadedClient,
|
||||
CopyDataFiles,
|
||||
CopyProfileFiles,
|
||||
CleanFiles,
|
||||
ExtractBnpClient,
|
||||
CopyInstaller,
|
||||
UninstallOldClient,
|
||||
CreateProfile,
|
||||
CreateShortcuts,
|
||||
CreateAddRemoveEntry,
|
||||
Done
|
||||
};
|
||||
|
||||
enum OperationType
|
||||
{
|
||||
OperationNone,
|
||||
OperationMigrate,
|
||||
OperationUpdateProfiles,
|
||||
OperationInstall,
|
||||
OperationUninstall
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,9 +51,6 @@ COperationDialog::COperationDialog(QWidget *parent):QDialog(parent), m_aborting(
|
|||
m_button = new QWinTaskbarButton(this);
|
||||
#endif
|
||||
|
||||
// connect(resumeButton, SIGNAL(clicked()), SLOT(onResumeClicked()));
|
||||
// connect(stopButton, SIGNAL(clicked()), SLOT(onStopClicked()));
|
||||
|
||||
// downloader
|
||||
m_downloader = new CDownloader(this, this);
|
||||
|
||||
|
@ -76,7 +73,7 @@ COperationDialog::~COperationDialog()
|
|||
{
|
||||
}
|
||||
|
||||
void COperationDialog::setOperation(Operation operation)
|
||||
void COperationDialog::setOperation(OperationType operation)
|
||||
{
|
||||
m_operation = operation;
|
||||
}
|
||||
|
@ -91,17 +88,14 @@ void COperationDialog::processNextStep()
|
|||
switch (m_operation)
|
||||
{
|
||||
case OperationMigrate:
|
||||
processMigrateNextStep();
|
||||
case OperationInstall:
|
||||
processInstallNextStep();
|
||||
break;
|
||||
|
||||
case OperationUpdateProfiles:
|
||||
processUpdateProfilesNextStep();
|
||||
break;
|
||||
|
||||
case OperationInstall:
|
||||
processInstallNextStep();
|
||||
break;
|
||||
|
||||
case OperationUninstall:
|
||||
processUninstallNextStep();
|
||||
break;
|
||||
|
@ -111,7 +105,7 @@ void COperationDialog::processNextStep()
|
|||
}
|
||||
}
|
||||
|
||||
void COperationDialog::processMigrateNextStep()
|
||||
void COperationDialog::processInstallNextStep()
|
||||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
|
@ -122,77 +116,69 @@ void COperationDialog::processMigrateNextStep()
|
|||
const CProfile &configuration = config->getProfile();
|
||||
|
||||
// long operations are done in a thread
|
||||
CConfigFile::InstallationStep step = config->getNextStep();
|
||||
OperationStep step = config->getInstallNextStep();
|
||||
|
||||
switch(step)
|
||||
{
|
||||
case CConfigFile::DisplayNoServerError:
|
||||
break;
|
||||
|
||||
case CConfigFile::ShowMigrateWizard:
|
||||
break;
|
||||
|
||||
case CConfigFile::ShowInstallWizard:
|
||||
break;
|
||||
|
||||
case CConfigFile::DownloadData:
|
||||
case DownloadData:
|
||||
downloadData();
|
||||
break;
|
||||
|
||||
case CConfigFile::ExtractDownloadedData:
|
||||
// TODO
|
||||
case ExtractDownloadedData:
|
||||
QtConcurrent::run(this, &COperationDialog::extractDownloadedData);
|
||||
break;
|
||||
|
||||
case CConfigFile::DownloadClient:
|
||||
case DownloadClient:
|
||||
downloadClient();
|
||||
break;
|
||||
|
||||
case CConfigFile::ExtractDownloadedClient:
|
||||
// TODO
|
||||
case ExtractDownloadedClient:
|
||||
QtConcurrent::run(this, &COperationDialog::extractDownloadedClient);
|
||||
break;
|
||||
|
||||
case CConfigFile::CopyServerFiles:
|
||||
QtConcurrent::run(this, &COperationDialog::copyServerFiles);
|
||||
case CopyDataFiles:
|
||||
QtConcurrent::run(this, &COperationDialog::copyDataFiles);
|
||||
break;
|
||||
|
||||
case CConfigFile::CopyProfileFiles:
|
||||
case CopyProfileFiles:
|
||||
QtConcurrent::run(this, &COperationDialog::copyProfileFiles);
|
||||
break;
|
||||
|
||||
case CConfigFile::CleanFiles:
|
||||
case CleanFiles:
|
||||
QtConcurrent::run(this, &COperationDialog::cleanFiles);
|
||||
break;
|
||||
|
||||
case CConfigFile::ExtractBnpClient:
|
||||
case ExtractBnpClient:
|
||||
QtConcurrent::run(this, &COperationDialog::extractBnpClient);
|
||||
break;
|
||||
|
||||
case CConfigFile::CopyInstaller:
|
||||
case CopyInstaller:
|
||||
QtConcurrent::run(this, &COperationDialog::copyInstaller);
|
||||
break;
|
||||
|
||||
case CConfigFile::UninstallOldClient:
|
||||
case UninstallOldClient:
|
||||
uninstallOldClient();
|
||||
break;
|
||||
|
||||
case CConfigFile::CreateProfile:
|
||||
case CreateProfile:
|
||||
createDefaultProfile();
|
||||
break;
|
||||
|
||||
case CConfigFile::CreateShortcuts:
|
||||
case CreateShortcuts:
|
||||
createDefaultShortcuts();
|
||||
break;
|
||||
|
||||
case CConfigFile::CreateAddRemoveEntry:
|
||||
case CreateAddRemoveEntry:
|
||||
createAddRemoveEntry();
|
||||
break;
|
||||
|
||||
case CConfigFile::Done:
|
||||
case Done:
|
||||
accept();
|
||||
break;
|
||||
|
||||
default:
|
||||
// cases already managed in main.cpp
|
||||
qDebug() << "Shouldn't happen, step" << step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,11 +188,99 @@ void COperationDialog::processUpdateProfilesNextStep()
|
|||
// TODO: check all servers are downloaded
|
||||
// TODO: delete profiles directories that are not used anymore
|
||||
// TODO: create shortcuts
|
||||
}
|
||||
|
||||
void COperationDialog::processInstallNextStep()
|
||||
{
|
||||
// TODO: implement
|
||||
QStringList serversToUpdate;
|
||||
QStringList profilesToDelete;
|
||||
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// append all old profiles
|
||||
foreach(const CProfile &profile, config->getBackupProfiles())
|
||||
{
|
||||
if (QFile::exists(profile.getDirectory())) profilesToDelete << profile.id;
|
||||
}
|
||||
|
||||
const CServer &defaultServer = config->getServer();
|
||||
|
||||
foreach(const CProfile &profile, config->getProfiles())
|
||||
{
|
||||
const CServer &server = config->getServer(profile.server);
|
||||
|
||||
QString serverDirectory = server.getDirectory();
|
||||
|
||||
// check if Ryzom is installed in new server directory
|
||||
if (server.id != defaultServer.id && !config->isRyzomInstalledIn(serverDirectory) && serversToUpdate.indexOf(server.id) == -1)
|
||||
{
|
||||
serversToUpdate << server.id;
|
||||
}
|
||||
|
||||
// remove profiles that still exist
|
||||
profilesToDelete.removeAll(profile.id);
|
||||
}
|
||||
|
||||
if (!profilesToDelete.isEmpty())
|
||||
{
|
||||
m_components.profiles << profilesToDelete;
|
||||
|
||||
// delete profiles in another thread
|
||||
QtConcurrent::run(this, &COperationDialog::deleteComponentsProfiles);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// servers files to download/update
|
||||
foreach(const QString &serverId, serversToUpdate)
|
||||
{
|
||||
const CServer &server = config->getServer(serverId);
|
||||
|
||||
// data
|
||||
if (!config->areRyzomDataInstalledIn(server.getDirectory()))
|
||||
{
|
||||
QString dataFile = config->getInstallationDirectory() + "/" + server.dataDownloadFilename;
|
||||
|
||||
// archive already downloaded
|
||||
if (QFile::exists(dataFile))
|
||||
{
|
||||
// make server current
|
||||
m_currentServerId = server.id;
|
||||
|
||||
// uncompress it
|
||||
QtConcurrent::run(this, &COperationDialog::extractDownloadedData);
|
||||
return;
|
||||
}
|
||||
|
||||
// data download URLs are different, can't copy data from default server
|
||||
if (server.dataDownloadUrl != defaultServer.dataDownloadUrl)
|
||||
{
|
||||
// download it
|
||||
// TODO
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// same data used
|
||||
|
||||
// copy them
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
// client
|
||||
if (!config->isRyzomClientInstalledIn(server.getDirectory()))
|
||||
{
|
||||
// client download URLs are different, can't copy client from default server
|
||||
if (server.clientDownloadUrl == defaultServer.clientDownloadUrl)
|
||||
{
|
||||
if (QFile::exists(""))
|
||||
downloadData();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString clientFile = config->getInstallationDirectory() + "/" + server.clientDownloadFilename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COperationDialog::processUninstallNextStep()
|
||||
|
@ -343,8 +417,7 @@ void COperationDialog::downloadData()
|
|||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// default server
|
||||
const CServer &server = config->getServer();
|
||||
const CServer &server = config->getServer(m_currentServerId);
|
||||
|
||||
m_currentOperation = QApplication::tr("Download data required by server %1").arg(server.name);
|
||||
m_currentOperationProgressFormat = QApplication::tr("Downloading %1...");
|
||||
|
@ -352,12 +425,16 @@ void COperationDialog::downloadData()
|
|||
m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part");
|
||||
}
|
||||
|
||||
void COperationDialog::extractDownloadedData()
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
void COperationDialog::downloadClient()
|
||||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// default server
|
||||
const CServer &server = config->getServer();
|
||||
const CServer &server = config->getServer(m_currentServerId);
|
||||
|
||||
m_currentOperation = QApplication::tr("Download client required by server %1").arg(server.name);
|
||||
m_currentOperationProgressFormat = QApplication::tr("Downloading %1...");
|
||||
|
@ -365,14 +442,37 @@ void COperationDialog::downloadClient()
|
|||
m_downloader->prepareFile(config->expandVariables(server.clientDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename) + ".part");
|
||||
}
|
||||
|
||||
void COperationDialog::copyServerFiles()
|
||||
void COperationDialog::extractDownloadedClient()
|
||||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
const CServer &server = config->getServer(m_currentServerId);
|
||||
|
||||
m_currentOperation = QApplication::tr("Extract data files required by server %1").arg(server.name);
|
||||
m_currentOperationProgressFormat = QApplication::tr("Extracting %1...");
|
||||
|
||||
CFilesExtractor extractor(this);
|
||||
extractor.setSourceFile(config->getInstallationDirectory() + "/" + server.clientDownloadFilename);
|
||||
extractor.setDestinationDirectory(server.getDirectory());
|
||||
|
||||
if (extractor.exec())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
emit done();
|
||||
}
|
||||
|
||||
void COperationDialog::copyDataFiles()
|
||||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// default server
|
||||
const CServer &server = config->getServer();
|
||||
const CServer &server = config->getServer(m_currentServerId);
|
||||
|
||||
m_currentOperation = QApplication::tr("Copy client files required by server %1").arg(server.name);
|
||||
m_currentOperation = QApplication::tr("Copy data files required by server %1").arg(server.name);
|
||||
m_currentOperationProgressFormat = QApplication::tr("Copying %1...");
|
||||
|
||||
QStringList serverFiles;
|
||||
|
@ -381,11 +481,10 @@ void COperationDialog::copyServerFiles()
|
|||
serverFiles << "examples";
|
||||
serverFiles << "patch";
|
||||
serverFiles << "unpack";
|
||||
serverFiles << "client_default.cfg";
|
||||
|
||||
CFilesCopier copier(this);
|
||||
copier.setSourceDirectory(config->getSrcServerDirectory());
|
||||
copier.setDestinationDirectory(config->getInstallationDirectory() + "/" + server.id);
|
||||
copier.setDestinationDirectory(server.getDirectory());
|
||||
copier.setIncludeFilter(serverFiles);
|
||||
|
||||
if (copier.exec())
|
||||
|
@ -421,7 +520,7 @@ void COperationDialog::copyProfileFiles()
|
|||
|
||||
CFilesCopier copier(this);
|
||||
copier.setSourceDirectory(config->getSrcProfileDirectory());
|
||||
copier.setDestinationDirectory(config->getProfileDirectory() + "/" + profile.id);
|
||||
copier.setDestinationDirectory(profile.getDirectory());
|
||||
copier.setIncludeFilter(profileFiles);
|
||||
|
||||
if (copier.exec())
|
||||
|
@ -444,11 +543,11 @@ void COperationDialog::extractBnpClient()
|
|||
m_currentOperation = QApplication::tr("Extract client to new location");
|
||||
m_currentOperationProgressFormat = QApplication::tr("Extracting %1...");
|
||||
|
||||
QString destinationDirectory = config->getInstallationDirectory() + "/" + server.id;
|
||||
QString destinationDirectory = server.getDirectory();
|
||||
|
||||
CFilesExtractor extractor(this);
|
||||
extractor.setSourceFile(config->getSrcServerClientBNPFullPath());
|
||||
extractor.setDesinationDirectory(destinationDirectory);
|
||||
extractor.setDestinationDirectory(destinationDirectory);
|
||||
extractor.exec();
|
||||
|
||||
QString upgradeScript = destinationDirectory + "/upgd_nl.";
|
||||
|
@ -592,7 +691,7 @@ void COperationDialog::cleanFiles()
|
|||
m_currentOperationProgressFormat = QApplication::tr("Deleting %1...");
|
||||
|
||||
CFilesCleaner cleaner(this);
|
||||
cleaner.setDirectory(config->getInstallationDirectory() + "/" + server.id);
|
||||
cleaner.setDirectory(server.getDirectory());
|
||||
cleaner.exec();
|
||||
|
||||
emit done();
|
||||
|
@ -602,7 +701,7 @@ bool COperationDialog::createDefaultProfile()
|
|||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
CServer server = config->getServer(config->getDefaultServerIndex());
|
||||
CServer server = config->getServer();
|
||||
|
||||
m_currentOperation = QApplication::tr("Create default profile");
|
||||
|
||||
|
@ -631,6 +730,10 @@ bool COperationDialog::createDefaultProfile()
|
|||
|
||||
bool COperationDialog::createDefaultShortcuts()
|
||||
{
|
||||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
CServer server = config->getServer();
|
||||
|
||||
emit done();
|
||||
|
||||
return true;
|
||||
|
@ -711,7 +814,7 @@ void COperationDialog::deleteComponentsServers()
|
|||
|
||||
int i = 0;
|
||||
|
||||
foreach(int serverIndex, m_components.servers)
|
||||
foreach(const QString &serverId, m_components.servers)
|
||||
{
|
||||
if (operationShouldStop())
|
||||
{
|
||||
|
@ -719,18 +822,21 @@ void COperationDialog::deleteComponentsServers()
|
|||
return;
|
||||
}
|
||||
|
||||
const CServer &server = config->getServer(serverIndex);
|
||||
const CServer &server = config->getServer(serverId);
|
||||
|
||||
emit progress(i++, server.name);
|
||||
|
||||
QString path = config->getInstallationDirectory() + "/" + server.id;
|
||||
QString path = server.getDirectory();
|
||||
|
||||
QDir dir(path);
|
||||
|
||||
if (dir.exists() && !dir.removeRecursively())
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
emit fail(tr("Unable to delete files for client %1").arg(server.name));
|
||||
return;
|
||||
QDir dir(path);
|
||||
|
||||
if (dir.exists() && !dir.removeRecursively())
|
||||
{
|
||||
emit fail(tr("Unable to delete files for client %1").arg(server.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -750,7 +856,7 @@ void COperationDialog::deleteComponentsProfiles()
|
|||
|
||||
int i = 0;
|
||||
|
||||
foreach(int profileIndex, m_components.profiles)
|
||||
foreach(const QString &profileId, m_components.profiles)
|
||||
{
|
||||
if (operationShouldStop())
|
||||
{
|
||||
|
@ -758,21 +864,30 @@ void COperationDialog::deleteComponentsProfiles()
|
|||
return;
|
||||
}
|
||||
|
||||
const CProfile &profile = config->getProfile(profileIndex);
|
||||
const CProfile &profile = config->getProfile(profileId);
|
||||
|
||||
emit progress(i++, profile.name);
|
||||
|
||||
QString path = config->getProfileDirectory() + "/" + profile.id;
|
||||
QString path = profile.getDirectory();
|
||||
|
||||
QDir dir(path);
|
||||
|
||||
if (dir.exists() && !dir.removeRecursively())
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
emit fail(tr("Unable to delete files for profile %1").arg(profile.name));
|
||||
return;
|
||||
QDir dir(path);
|
||||
|
||||
if (dir.exists() && !dir.removeRecursively())
|
||||
{
|
||||
emit fail(tr("Unable to delete files for profile %1").arg(profile.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// delete profile
|
||||
config->removeProfile(profileId);
|
||||
}
|
||||
|
||||
// clear list of all profiles to uninstall
|
||||
m_components.profiles.clear();
|
||||
|
||||
emit success(m_components.servers.size());
|
||||
emit done();
|
||||
}
|
||||
|
|
|
@ -38,16 +38,7 @@ public:
|
|||
COperationDialog(QWidget *parent = NULL);
|
||||
virtual ~COperationDialog();
|
||||
|
||||
enum Operation
|
||||
{
|
||||
OperationNone,
|
||||
OperationMigrate,
|
||||
OperationUpdateProfiles,
|
||||
OperationInstall,
|
||||
OperationUninstall
|
||||
};
|
||||
|
||||
void setOperation(Operation operation);
|
||||
void setOperation(OperationType operation);
|
||||
void setUninstallComponents(const SUninstallComponents &components);
|
||||
|
||||
public slots:
|
||||
|
@ -92,15 +83,16 @@ protected:
|
|||
void closeEvent(QCloseEvent *e);
|
||||
|
||||
void processNextStep();
|
||||
void processMigrateNextStep();
|
||||
void processUpdateProfilesNextStep();
|
||||
void processInstallNextStep();
|
||||
void processUninstallNextStep();
|
||||
void processUpdateProfilesNextStep();
|
||||
|
||||
// operations
|
||||
void downloadData();
|
||||
void extractDownloadedData();
|
||||
void downloadClient();
|
||||
void copyServerFiles();
|
||||
void extractDownloadedClient();
|
||||
void copyDataFiles();
|
||||
void copyProfileFiles();
|
||||
void cleanFiles();
|
||||
void extractBnpClient();
|
||||
|
@ -134,8 +126,9 @@ protected:
|
|||
QMutex m_abortingMutex;
|
||||
bool m_aborting;
|
||||
|
||||
Operation m_operation;
|
||||
OperationType m_operation;
|
||||
SUninstallComponents m_components;
|
||||
QString m_currentServerId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -105,7 +105,7 @@ void CProfilesDialog::displayProfile(int index)
|
|||
executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server);
|
||||
}
|
||||
|
||||
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id;
|
||||
QString profileDirectory = profile.getDirectory();
|
||||
|
||||
// update all widgets with content of profile
|
||||
profileIdLabel->setText(profile.id);
|
||||
|
@ -283,7 +283,7 @@ void CProfilesDialog::onProfileDirectoryClicked()
|
|||
|
||||
const CProfile &profile = m_model->getProfiles()[m_currentProfileIndex];
|
||||
|
||||
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id;
|
||||
QString profileDirectory = profile.getDirectory();
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(profileDirectory));
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@ CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installer
|
|||
{
|
||||
const CServer &server = config->getServer(row);
|
||||
|
||||
if (QFile::exists(config->getInstallationDirectory() + "/" + server.id))
|
||||
if (QFile::exists(server.getDirectory()))
|
||||
{
|
||||
m_serversIndices[row] = model->rowCount();
|
||||
m_serversIndices[server.id] = model->rowCount();
|
||||
|
||||
item = new QStandardItem(tr("Client for %1").arg(server.name));
|
||||
item->setCheckable(true);
|
||||
|
@ -66,10 +66,10 @@ CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installer
|
|||
// profiles
|
||||
for (int row = 0; row < profilesCount; ++row)
|
||||
{
|
||||
m_profilesIndices[row] = model->rowCount();
|
||||
|
||||
const CProfile &profile = config->getProfile(row);
|
||||
|
||||
m_profilesIndices[profile.id] = model->rowCount();
|
||||
|
||||
item = new QStandardItem(tr("Profile #%1: %2").arg(profile.id).arg(profile.name));
|
||||
item->setCheckable(true);
|
||||
model->appendRow(item);
|
||||
|
@ -122,7 +122,7 @@ void CUninstallDialog::setSelectedComponents(const SUninstallComponents &compone
|
|||
QStandardItem *item = NULL;
|
||||
|
||||
// servers
|
||||
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
IDIndicesMap::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
|
||||
while (it != iend)
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ SUninstallComponents CUninstallDialog::getSelectedCompenents() const
|
|||
QStandardItem *item = NULL;
|
||||
|
||||
// servers
|
||||
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
IDIndicesMap::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
|
||||
while (it != iend)
|
||||
{
|
||||
|
@ -222,13 +222,13 @@ void CUninstallDialog::updateSizes()
|
|||
CConfigFile *config = CConfigFile::getInstance();
|
||||
|
||||
// clients
|
||||
QMap<int, int>::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
IDIndicesMap::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end();
|
||||
|
||||
while(it != iend)
|
||||
{
|
||||
const CServer &server = config->getServer(it.key());
|
||||
|
||||
qint64 bytes = getDirectorySize(config->getInstallationDirectory() + "/" + server.id);
|
||||
qint64 bytes = getDirectorySize(server.getDirectory());
|
||||
|
||||
emit updateSize(it.value(), qBytesToHumanReadable(bytes));
|
||||
|
||||
|
@ -242,7 +242,7 @@ void CUninstallDialog::updateSizes()
|
|||
{
|
||||
const CProfile &profile = config->getProfile(it.key());
|
||||
|
||||
qint64 bytes = getDirectorySize(config->getProfileDirectory() + "/" + profile.id);
|
||||
qint64 bytes = getDirectorySize(profile.getDirectory());
|
||||
|
||||
emit updateSize(it.value(), qBytesToHumanReadable(bytes));
|
||||
|
||||
|
|
|
@ -55,8 +55,10 @@ private:
|
|||
void updateButtons();
|
||||
|
||||
// key is original ID, value is row index
|
||||
QMap<int, int> m_serversIndices;
|
||||
QMap<int, int> m_profilesIndices;
|
||||
typedef QMap<QString, int> IDIndicesMap;
|
||||
|
||||
IDIndicesMap m_serversIndices;
|
||||
IDIndicesMap m_profilesIndices;
|
||||
|
||||
int m_installerIndex;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue