Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-06-14 20:18:10 +02:00
commit 1aea0f981c
16 changed files with 407 additions and 161 deletions

View file

@ -6,7 +6,7 @@ extern "C" {
#endif #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 ** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the ** 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 ** used to make the header, and the header can be found at
** http://www.opengl.org/registry/ ** 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__) #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -53,7 +53,7 @@ extern "C" {
#define GLAPI extern #define GLAPI extern
#endif #endif
#define GL_GLEXT_VERSION 20151022 #define GL_GLEXT_VERSION 20160609
/* Generated C header for: /* Generated C header for:
* API: gl * API: gl
@ -5596,6 +5596,10 @@ GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLf
#define GL_AMD_shader_atomic_counter_ops 1 #define GL_AMD_shader_atomic_counter_ops 1
#endif /* GL_AMD_shader_atomic_counter_ops */ #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 #ifndef GL_AMD_shader_stencil_export
#define GL_AMD_shader_stencil_export 1 #define GL_AMD_shader_stencil_export 1
#endif /* GL_AMD_shader_stencil_export */ #endif /* GL_AMD_shader_stencil_export */
@ -8636,6 +8640,20 @@ GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei s
#endif #endif
#endif /* GL_EXT_vertex_weighting */ #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 #ifndef GL_EXT_x11_sync_object
#define GL_EXT_x11_sync_object 1 #define GL_EXT_x11_sync_object 1
#define GL_SYNC_X11_FENCE_EXT 0x90E1 #define GL_SYNC_X11_FENCE_EXT 0x90E1
@ -9129,6 +9147,17 @@ GLAPI void APIENTRY glBlendBarrierNV (void);
#define GL_NV_blend_square 1 #define GL_NV_blend_square 1
#endif /* GL_NV_blend_square */ #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 #ifndef GL_NV_command_list
#define GL_NV_command_list 1 #define GL_NV_command_list 1
#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 #define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000
@ -9231,6 +9260,17 @@ GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat valu
#endif #endif
#endif /* GL_NV_conservative_raster_dilate */ #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 #ifndef GL_NV_copy_depth_to_color
#define GL_NV_copy_depth_to_color 1 #define GL_NV_copy_depth_to_color 1
#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
@ -10223,6 +10263,11 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname,
#endif #endif
#endif /* GL_NV_register_combiners2 */ #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 #ifndef GL_NV_sample_locations
#define GL_NV_sample_locations 1 #define GL_NV_sample_locations 1
#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D #define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
@ -10255,6 +10300,10 @@ GLAPI void APIENTRY glResolveDepthValuesNV (void);
#define GL_NV_shader_atomic_float 1 #define GL_NV_shader_atomic_float 1
#endif /* GL_NV_shader_atomic_float */ #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 #ifndef GL_NV_shader_atomic_fp16_vector
#define GL_NV_shader_atomic_fp16_vector 1 #define GL_NV_shader_atomic_fp16_vector 1
#endif /* GL_NV_shader_atomic_fp16_vector */ #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 #define GL_NV_shader_thread_shuffle 1
#endif /* GL_NV_shader_thread_shuffle */ #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 #ifndef GL_NV_tessellation_program5
#define GL_NV_tessellation_program5 1 #define GL_NV_tessellation_program5 1
#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 #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 #define GL_NV_viewport_array2 1
#endif /* GL_NV_viewport_array2 */ #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 #ifndef GL_OML_interlace
#define GL_OML_interlace 1 #define GL_OML_interlace 1
#define GL_INTERLACE_OML 0x8980 #define GL_INTERLACE_OML 0x8980

View file

@ -6,7 +6,7 @@ extern "C" {
#endif #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 ** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the ** 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 ** used to make the header, and the header can be found at
** http://www.opengl.org/registry/ ** 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: /* Generated C header for:
* API: glx * API: glx
@ -317,6 +317,11 @@ void glXFreeContextEXT (Display *dpy, GLXContext context);
#endif #endif
#endif /* GLX_EXT_import_context */ #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 #ifndef GLX_EXT_stereo_tree
#define GLX_EXT_stereo_tree 1 #define GLX_EXT_stereo_tree 1
typedef struct { typedef struct {
@ -543,6 +548,11 @@ int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int vi
#endif #endif
#endif /* GLX_NV_present_video */ #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 #ifndef GLX_NV_swap_group
#define GLX_NV_swap_group 1 #define GLX_NV_swap_group 1
typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group); typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);

View file

@ -6,7 +6,7 @@ extern "C" {
#endif #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 ** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the ** 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 ** used to make the header, and the header can be found at
** http://www.opengl.org/registry/ ** 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__) #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -41,7 +41,7 @@ extern "C" {
#include <windows.h> #include <windows.h>
#endif #endif
#define WGL_WGLEXT_VERSION 20150623 #define WGL_WGLEXT_VERSION 20160419
/* Generated C header for: /* Generated C header for:
* API: wgl * API: wgl

View file

@ -1991,24 +1991,29 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
if (ext.WGLNVGPUAffinity) if (ext.WGLNVGPUAffinity)
{ {
uint i = 0; uint gpuIndex = 0;
HGPUNV hGPU; HGPUNV hGPU;
while(nwglEnumGpusNV(i, &hGPU)) // list all GPUs
while (nwglEnumGpusNV(gpuIndex, &hGPU))
{ {
uint j = 0; 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; ++j;
} }
++i; ++gpuIndex;
} }
} }

View file

@ -27,6 +27,16 @@
const CServer NoServer; const CServer NoServer;
const CProfile NoProfile; 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::s_instance = NULL;
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true) 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); 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) void CConfigFile::setProfile(int i, const CProfile &profile)
{ {
m_profiles[i] = profile; m_profiles[i] = profile;
@ -292,8 +313,14 @@ int CConfigFile::addProfile(const CProfile &profile)
void CConfigFile::removeProfile(int i) void CConfigFile::removeProfile(int i)
{ {
m_profiles.removeAt(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() bool CConfigFile::has64bitsOS()
@ -603,7 +630,7 @@ QString CConfigFile::getServerClientFullPath(const QString &serverId) const
if (server.clientFilename.isEmpty()) return ""; if (server.clientFilename.isEmpty()) return "";
return getInstallationDirectory() + "/" + server.id + "/" + server.clientFilename; return server.getDirectory() + "/" + server.clientFilename;
} }
QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) const QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) const
@ -612,7 +639,7 @@ QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) con
if (server.configurationFilename.isEmpty()) return ""; if (server.configurationFilename.isEmpty()) return "";
return getInstallationDirectory() + "/" + server.id + "/" + server.configurationFilename; return server.getDirectory() + "/" + server.configurationFilename;
} }
QString CConfigFile::getSrcServerClientBNPFullPath() const QString CConfigFile::getSrcServerClientBNPFullPath() const
@ -620,7 +647,7 @@ QString CConfigFile::getSrcServerClientBNPFullPath() const
return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch()); return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch());
} }
CConfigFile::InstallationStep CConfigFile::getNextStep() const OperationStep CConfigFile::getInstallNextStep() const
{ {
// get last used profile // get last used profile
const CProfile &profile = getProfile(); const CProfile &profile = getProfile();
@ -669,7 +696,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard; return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard;
} }
QString serverDirectory = getInstallationDirectory() + "/" + server.id; QString serverDirectory = server.getDirectory();
if (getSrcServerDirectory().isEmpty()) if (getSrcServerDirectory().isEmpty())
{ {
@ -712,7 +739,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
// selected directory contains Ryzom files (shouldn't fail) // selected directory contains Ryzom files (shouldn't fail)
if (areRyzomDataInstalledIn(getSrcServerDirectory())) if (areRyzomDataInstalledIn(getSrcServerDirectory()))
{ {
return CopyServerFiles; return CopyDataFiles;
} }
else else
{ {

View file

@ -17,8 +17,11 @@
#ifndef CONFIGFILE_H #ifndef CONFIGFILE_H
#define CONFIGFILE_H #define CONFIGFILE_H
struct CServer #include "operation.h"
class CServer
{ {
public:
CServer() CServer()
{ {
dataCompressedSize = 0; dataCompressedSize = 0;
@ -39,14 +42,18 @@ struct CServer
QString configurationFilename; QString configurationFilename;
QString installerFilename; QString installerFilename;
QString comments; QString comments;
// helpers
QString getDirectory() const;
}; };
extern const CServer NoServer; extern const CServer NoServer;
typedef QVector<CServer> CServers; typedef QVector<CServer> CServers;
struct CProfile class CProfile
{ {
public:
CProfile() CProfile()
{ {
desktopShortcut = false; desktopShortcut = false;
@ -61,6 +68,9 @@ struct CProfile
QString comments; QString comments;
bool desktopShortcut; bool desktopShortcut;
bool menuShortcut; bool menuShortcut;
// helpers
QString getDirectory() const;
}; };
extern const CProfile NoProfile; extern const CProfile NoProfile;
@ -78,27 +88,6 @@ class CConfigFile : public QObject
Q_OBJECT Q_OBJECT
public: public:
enum InstallationStep
{
DisplayNoServerError,
ShowInstallWizard,
ShowMigrateWizard,
DownloadData,
ExtractDownloadedData,
DownloadClient,
ExtractDownloadedClient,
CopyServerFiles,
CopyProfileFiles,
CleanFiles,
ExtractBnpClient,
CopyInstaller,
UninstallOldClient,
CreateProfile,
CreateShortcuts,
CreateAddRemoveEntry,
Done
};
CConfigFile(QObject *parent = NULL); CConfigFile(QObject *parent = NULL);
virtual ~CConfigFile(); virtual ~CConfigFile();
@ -123,9 +112,11 @@ public:
int getProfilesCount() const; int getProfilesCount() const;
CProfile getProfile(int i = -1) const; CProfile getProfile(int i = -1) const;
CProfile getProfile(const QString &id) const;
void setProfile(int i, const CProfile &profile); void setProfile(int i, const CProfile &profile);
int addProfile(const CProfile &profile); int addProfile(const CProfile &profile);
void removeProfile(int i); void removeProfile(int i);
void removeProfile(const QString &id);
int getDefaultServerIndex() const; int getDefaultServerIndex() const;
void setDefaultServerIndex(int index); void setDefaultServerIndex(int index);
@ -180,7 +171,7 @@ public:
QString getSrcServerClientBNPFullPath() const; QString getSrcServerClientBNPFullPath() const;
InstallationStep getNextStep() const; OperationStep getInstallNextStep() const;
// product details // product details
QString getProductName() const; QString getProductName() const;

View file

@ -245,7 +245,7 @@ void CFilesExtractor::setSourceFile(const QString &src)
m_sourceFile = src; m_sourceFile = src;
} }
void CFilesExtractor::setDesinationDirectory(const QString &dst) void CFilesExtractor::setDestinationDirectory(const QString &dst)
{ {
m_destinationDirectory = dst; m_destinationDirectory = dst;
} }

View file

@ -32,7 +32,7 @@ public:
virtual ~CFilesExtractor(); virtual ~CFilesExtractor();
void setSourceFile(const QString &src); void setSourceFile(const QString &src);
void setDesinationDirectory(const QString &src); void setDestinationDirectory(const QString &src);
bool exec(); bool exec();

View file

@ -80,9 +80,9 @@ int main(int argc, char *argv[])
// instanciate ConfigFile // instanciate ConfigFile
CConfigFile config; 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")); QMessageBox::critical(NULL, QApplication::tr("Error"), QApplication::tr("Unable to find installer.ini"));
return 1; return 1;
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
// add all servers by default // add all servers by default
for (int i = 0; i < config.getServersCount(); ++i) 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 // show uninstall wizard dialog if not in silent mode
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
COperationDialog dialog; COperationDialog dialog;
dialog.setOperation(COperationDialog::OperationUninstall); dialog.setOperation(OperationUninstall);
dialog.setUninstallComponents(components); dialog.setUninstallComponents(components);
// TODO: set all components to uninstall // TODO: set all components to uninstall
@ -140,31 +140,31 @@ int main(int argc, char *argv[])
return dialog.exec() ? 0 : 1; return dialog.exec() ? 0 : 1;
} }
if (step == CConfigFile::ShowMigrateWizard) if (step == ShowMigrateWizard)
{ {
CMigrateDialog dialog; CMigrateDialog dialog;
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
step = config.getNextStep(); step = config.getInstallNextStep();
} }
else if (step == CConfigFile::ShowInstallWizard) else if (step == ShowInstallWizard)
{ {
CInstallDialog dialog; CInstallDialog dialog;
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
step = config.getNextStep(); step = config.getInstallNextStep();
} }
if (step != CConfigFile::Done) if (step != Done)
{ {
COperationDialog dialog; COperationDialog dialog;
dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? COperationDialog::OperationInstall: COperationDialog::OperationMigrate); dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? OperationInstall:OperationMigrate);
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
step = config.getNextStep(); step = config.getInstallNextStep();
} }
CMainWindow mainWindow; CMainWindow mainWindow;

View file

@ -153,7 +153,7 @@ void CMainWindow::onProfiles()
{ {
COperationDialog dialog(this); COperationDialog dialog(this);
dialog.setOperation(COperationDialog::OperationUpdateProfiles); dialog.setOperation(OperationUpdateProfiles);
if (!dialog.exec()) if (!dialog.exec())
{ {
@ -197,7 +197,7 @@ void CMainWindow::onUninstall()
// add all servers by default // add all servers by default
for (int i = 0; i < config->getServersCount(); ++i) 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; COperationDialog dialog;
dialog.setOperation(COperationDialog::OperationUninstall); dialog.setOperation(OperationUninstall);
dialog.setUninstallComponents(components); dialog.setUninstallComponents(components);
if (dialog.exec()) if (dialog.exec())

View file

@ -40,10 +40,40 @@ struct SUninstallComponents
installer = true; installer = true;
} }
QVector<int> servers; QStringList servers;
QVector<int> profiles; QStringList profiles;
bool installer; 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 #endif

View file

@ -51,9 +51,6 @@ COperationDialog::COperationDialog(QWidget *parent):QDialog(parent), m_aborting(
m_button = new QWinTaskbarButton(this); m_button = new QWinTaskbarButton(this);
#endif #endif
// connect(resumeButton, SIGNAL(clicked()), SLOT(onResumeClicked()));
// connect(stopButton, SIGNAL(clicked()), SLOT(onStopClicked()));
// downloader // downloader
m_downloader = new CDownloader(this, this); 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; m_operation = operation;
} }
@ -91,17 +88,14 @@ void COperationDialog::processNextStep()
switch (m_operation) switch (m_operation)
{ {
case OperationMigrate: case OperationMigrate:
processMigrateNextStep(); case OperationInstall:
processInstallNextStep();
break; break;
case OperationUpdateProfiles: case OperationUpdateProfiles:
processUpdateProfilesNextStep(); processUpdateProfilesNextStep();
break; break;
case OperationInstall:
processInstallNextStep();
break;
case OperationUninstall: case OperationUninstall:
processUninstallNextStep(); processUninstallNextStep();
break; break;
@ -111,7 +105,7 @@ void COperationDialog::processNextStep()
} }
} }
void COperationDialog::processMigrateNextStep() void COperationDialog::processInstallNextStep()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
@ -122,77 +116,69 @@ void COperationDialog::processMigrateNextStep()
const CProfile &configuration = config->getProfile(); const CProfile &configuration = config->getProfile();
// long operations are done in a thread // long operations are done in a thread
CConfigFile::InstallationStep step = config->getNextStep(); OperationStep step = config->getInstallNextStep();
switch(step) switch(step)
{ {
case CConfigFile::DisplayNoServerError: case DownloadData:
break;
case CConfigFile::ShowMigrateWizard:
break;
case CConfigFile::ShowInstallWizard:
break;
case CConfigFile::DownloadData:
downloadData(); downloadData();
break; break;
case CConfigFile::ExtractDownloadedData: case ExtractDownloadedData:
// TODO QtConcurrent::run(this, &COperationDialog::extractDownloadedData);
break; break;
case CConfigFile::DownloadClient: case DownloadClient:
downloadClient(); downloadClient();
break; break;
case CConfigFile::ExtractDownloadedClient: case ExtractDownloadedClient:
// TODO QtConcurrent::run(this, &COperationDialog::extractDownloadedClient);
break; break;
case CConfigFile::CopyServerFiles: case CopyDataFiles:
QtConcurrent::run(this, &COperationDialog::copyServerFiles); QtConcurrent::run(this, &COperationDialog::copyDataFiles);
break; break;
case CConfigFile::CopyProfileFiles: case CopyProfileFiles:
QtConcurrent::run(this, &COperationDialog::copyProfileFiles); QtConcurrent::run(this, &COperationDialog::copyProfileFiles);
break; break;
case CConfigFile::CleanFiles: case CleanFiles:
QtConcurrent::run(this, &COperationDialog::cleanFiles); QtConcurrent::run(this, &COperationDialog::cleanFiles);
break; break;
case CConfigFile::ExtractBnpClient: case ExtractBnpClient:
QtConcurrent::run(this, &COperationDialog::extractBnpClient); QtConcurrent::run(this, &COperationDialog::extractBnpClient);
break; break;
case CConfigFile::CopyInstaller: case CopyInstaller:
QtConcurrent::run(this, &COperationDialog::copyInstaller); QtConcurrent::run(this, &COperationDialog::copyInstaller);
break; break;
case CConfigFile::UninstallOldClient: case UninstallOldClient:
uninstallOldClient(); uninstallOldClient();
break; break;
case CConfigFile::CreateProfile: case CreateProfile:
createDefaultProfile(); createDefaultProfile();
break; break;
case CConfigFile::CreateShortcuts: case CreateShortcuts:
createDefaultShortcuts(); createDefaultShortcuts();
break; break;
case CConfigFile::CreateAddRemoveEntry: case CreateAddRemoveEntry:
createAddRemoveEntry(); createAddRemoveEntry();
break; break;
case CConfigFile::Done: case Done:
accept(); accept();
break; break;
default: default:
// cases already managed in main.cpp // cases already managed in main.cpp
qDebug() << "Shouldn't happen, step" << step;
break; break;
} }
} }
@ -202,11 +188,99 @@ void COperationDialog::processUpdateProfilesNextStep()
// TODO: check all servers are downloaded // TODO: check all servers are downloaded
// TODO: delete profiles directories that are not used anymore // TODO: delete profiles directories that are not used anymore
// TODO: create shortcuts // TODO: create shortcuts
}
void COperationDialog::processInstallNextStep() QStringList serversToUpdate;
{ QStringList profilesToDelete;
// TODO: implement
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() void COperationDialog::processUninstallNextStep()
@ -343,8 +417,7 @@ void COperationDialog::downloadData()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
// default server const CServer &server = config->getServer(m_currentServerId);
const CServer &server = config->getServer();
m_currentOperation = QApplication::tr("Download data required by server %1").arg(server.name); m_currentOperation = QApplication::tr("Download data required by server %1").arg(server.name);
m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); 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"); m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part");
} }
void COperationDialog::extractDownloadedData()
{
// TODO: implement
}
void COperationDialog::downloadClient() void COperationDialog::downloadClient()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
// default server const CServer &server = config->getServer(m_currentServerId);
const CServer &server = config->getServer();
m_currentOperation = QApplication::tr("Download client required by server %1").arg(server.name); m_currentOperation = QApplication::tr("Download client required by server %1").arg(server.name);
m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); 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"); 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(); CConfigFile *config = CConfigFile::getInstance();
// default server // 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..."); m_currentOperationProgressFormat = QApplication::tr("Copying %1...");
QStringList serverFiles; QStringList serverFiles;
@ -381,11 +481,10 @@ void COperationDialog::copyServerFiles()
serverFiles << "examples"; serverFiles << "examples";
serverFiles << "patch"; serverFiles << "patch";
serverFiles << "unpack"; serverFiles << "unpack";
serverFiles << "client_default.cfg";
CFilesCopier copier(this); CFilesCopier copier(this);
copier.setSourceDirectory(config->getSrcServerDirectory()); copier.setSourceDirectory(config->getSrcServerDirectory());
copier.setDestinationDirectory(config->getInstallationDirectory() + "/" + server.id); copier.setDestinationDirectory(server.getDirectory());
copier.setIncludeFilter(serverFiles); copier.setIncludeFilter(serverFiles);
if (copier.exec()) if (copier.exec())
@ -421,7 +520,7 @@ void COperationDialog::copyProfileFiles()
CFilesCopier copier(this); CFilesCopier copier(this);
copier.setSourceDirectory(config->getSrcProfileDirectory()); copier.setSourceDirectory(config->getSrcProfileDirectory());
copier.setDestinationDirectory(config->getProfileDirectory() + "/" + profile.id); copier.setDestinationDirectory(profile.getDirectory());
copier.setIncludeFilter(profileFiles); copier.setIncludeFilter(profileFiles);
if (copier.exec()) if (copier.exec())
@ -444,11 +543,11 @@ void COperationDialog::extractBnpClient()
m_currentOperation = QApplication::tr("Extract client to new location"); m_currentOperation = QApplication::tr("Extract client to new location");
m_currentOperationProgressFormat = QApplication::tr("Extracting %1..."); m_currentOperationProgressFormat = QApplication::tr("Extracting %1...");
QString destinationDirectory = config->getInstallationDirectory() + "/" + server.id; QString destinationDirectory = server.getDirectory();
CFilesExtractor extractor(this); CFilesExtractor extractor(this);
extractor.setSourceFile(config->getSrcServerClientBNPFullPath()); extractor.setSourceFile(config->getSrcServerClientBNPFullPath());
extractor.setDesinationDirectory(destinationDirectory); extractor.setDestinationDirectory(destinationDirectory);
extractor.exec(); extractor.exec();
QString upgradeScript = destinationDirectory + "/upgd_nl."; QString upgradeScript = destinationDirectory + "/upgd_nl.";
@ -592,7 +691,7 @@ void COperationDialog::cleanFiles()
m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); m_currentOperationProgressFormat = QApplication::tr("Deleting %1...");
CFilesCleaner cleaner(this); CFilesCleaner cleaner(this);
cleaner.setDirectory(config->getInstallationDirectory() + "/" + server.id); cleaner.setDirectory(server.getDirectory());
cleaner.exec(); cleaner.exec();
emit done(); emit done();
@ -602,7 +701,7 @@ bool COperationDialog::createDefaultProfile()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
CServer server = config->getServer(config->getDefaultServerIndex()); CServer server = config->getServer();
m_currentOperation = QApplication::tr("Create default profile"); m_currentOperation = QApplication::tr("Create default profile");
@ -631,6 +730,10 @@ bool COperationDialog::createDefaultProfile()
bool COperationDialog::createDefaultShortcuts() bool COperationDialog::createDefaultShortcuts()
{ {
CConfigFile *config = CConfigFile::getInstance();
CServer server = config->getServer();
emit done(); emit done();
return true; return true;
@ -711,7 +814,7 @@ void COperationDialog::deleteComponentsServers()
int i = 0; int i = 0;
foreach(int serverIndex, m_components.servers) foreach(const QString &serverId, m_components.servers)
{ {
if (operationShouldStop()) if (operationShouldStop())
{ {
@ -719,12 +822,14 @@ void COperationDialog::deleteComponentsServers()
return; return;
} }
const CServer &server = config->getServer(serverIndex); const CServer &server = config->getServer(serverId);
emit progress(i++, server.name); emit progress(i++, server.name);
QString path = config->getInstallationDirectory() + "/" + server.id; QString path = server.getDirectory();
if (!path.isEmpty())
{
QDir dir(path); QDir dir(path);
if (dir.exists() && !dir.removeRecursively()) if (dir.exists() && !dir.removeRecursively())
@ -733,6 +838,7 @@ void COperationDialog::deleteComponentsServers()
return; return;
} }
} }
}
emit success(m_components.servers.size()); emit success(m_components.servers.size());
emit done(); emit done();
@ -750,7 +856,7 @@ void COperationDialog::deleteComponentsProfiles()
int i = 0; int i = 0;
foreach(int profileIndex, m_components.profiles) foreach(const QString &profileId, m_components.profiles)
{ {
if (operationShouldStop()) if (operationShouldStop())
{ {
@ -758,12 +864,14 @@ void COperationDialog::deleteComponentsProfiles()
return; return;
} }
const CProfile &profile = config->getProfile(profileIndex); const CProfile &profile = config->getProfile(profileId);
emit progress(i++, profile.name); emit progress(i++, profile.name);
QString path = config->getProfileDirectory() + "/" + profile.id; QString path = profile.getDirectory();
if (!path.isEmpty())
{
QDir dir(path); QDir dir(path);
if (dir.exists() && !dir.removeRecursively()) if (dir.exists() && !dir.removeRecursively())
@ -773,6 +881,13 @@ void COperationDialog::deleteComponentsProfiles()
} }
} }
// delete profile
config->removeProfile(profileId);
}
// clear list of all profiles to uninstall
m_components.profiles.clear();
emit success(m_components.servers.size()); emit success(m_components.servers.size());
emit done(); emit done();
} }

View file

@ -38,16 +38,7 @@ public:
COperationDialog(QWidget *parent = NULL); COperationDialog(QWidget *parent = NULL);
virtual ~COperationDialog(); virtual ~COperationDialog();
enum Operation void setOperation(OperationType operation);
{
OperationNone,
OperationMigrate,
OperationUpdateProfiles,
OperationInstall,
OperationUninstall
};
void setOperation(Operation operation);
void setUninstallComponents(const SUninstallComponents &components); void setUninstallComponents(const SUninstallComponents &components);
public slots: public slots:
@ -92,15 +83,16 @@ protected:
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
void processNextStep(); void processNextStep();
void processMigrateNextStep();
void processUpdateProfilesNextStep();
void processInstallNextStep(); void processInstallNextStep();
void processUninstallNextStep(); void processUninstallNextStep();
void processUpdateProfilesNextStep();
// operations // operations
void downloadData(); void downloadData();
void extractDownloadedData();
void downloadClient(); void downloadClient();
void copyServerFiles(); void extractDownloadedClient();
void copyDataFiles();
void copyProfileFiles(); void copyProfileFiles();
void cleanFiles(); void cleanFiles();
void extractBnpClient(); void extractBnpClient();
@ -134,8 +126,9 @@ protected:
QMutex m_abortingMutex; QMutex m_abortingMutex;
bool m_aborting; bool m_aborting;
Operation m_operation; OperationType m_operation;
SUninstallComponents m_components; SUninstallComponents m_components;
QString m_currentServerId;
}; };
#endif #endif

View file

@ -105,7 +105,7 @@ void CProfilesDialog::displayProfile(int index)
executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server); executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server);
} }
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id; QString profileDirectory = profile.getDirectory();
// update all widgets with content of profile // update all widgets with content of profile
profileIdLabel->setText(profile.id); profileIdLabel->setText(profile.id);
@ -283,7 +283,7 @@ void CProfilesDialog::onProfileDirectoryClicked()
const CProfile &profile = m_model->getProfiles()[m_currentProfileIndex]; const CProfile &profile = m_model->getProfiles()[m_currentProfileIndex];
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id; QString profileDirectory = profile.getDirectory();
QDesktopServices::openUrl(QUrl::fromLocalFile(profileDirectory)); QDesktopServices::openUrl(QUrl::fromLocalFile(profileDirectory));
} }

View file

@ -51,9 +51,9 @@ CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installer
{ {
const CServer &server = config->getServer(row); 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 = new QStandardItem(tr("Client for %1").arg(server.name));
item->setCheckable(true); item->setCheckable(true);
@ -66,10 +66,10 @@ CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installer
// profiles // profiles
for (int row = 0; row < profilesCount; ++row) for (int row = 0; row < profilesCount; ++row)
{ {
m_profilesIndices[row] = model->rowCount();
const CProfile &profile = config->getProfile(row); 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 = new QStandardItem(tr("Profile #%1: %2").arg(profile.id).arg(profile.name));
item->setCheckable(true); item->setCheckable(true);
model->appendRow(item); model->appendRow(item);
@ -122,7 +122,7 @@ void CUninstallDialog::setSelectedComponents(const SUninstallComponents &compone
QStandardItem *item = NULL; QStandardItem *item = NULL;
// servers // 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) while (it != iend)
{ {
@ -160,7 +160,7 @@ SUninstallComponents CUninstallDialog::getSelectedCompenents() const
QStandardItem *item = NULL; QStandardItem *item = NULL;
// servers // 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) while (it != iend)
{ {
@ -222,13 +222,13 @@ void CUninstallDialog::updateSizes()
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
// clients // 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) while(it != iend)
{ {
const CServer &server = config->getServer(it.key()); 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)); emit updateSize(it.value(), qBytesToHumanReadable(bytes));
@ -242,7 +242,7 @@ void CUninstallDialog::updateSizes()
{ {
const CProfile &profile = config->getProfile(it.key()); 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)); emit updateSize(it.value(), qBytesToHumanReadable(bytes));

View file

@ -55,8 +55,10 @@ private:
void updateButtons(); void updateButtons();
// key is original ID, value is row index // key is original ID, value is row index
QMap<int, int> m_serversIndices; typedef QMap<QString, int> IDIndicesMap;
QMap<int, int> m_profilesIndices;
IDIndicesMap m_serversIndices;
IDIndicesMap m_profilesIndices;
int m_installerIndex; int m_installerIndex;
}; };