From 2ab16f61efa89d92673804dc805eff9b1366cb24 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:33:41 +0200 Subject: [PATCH 01/17] Changed: Updated OpenGL headers --HG-- branch : develop --- code/nel/src/3d/driver/opengl/GL/glext.h | 79 ++++++++++++++++++++++- code/nel/src/3d/driver/opengl/GL/glxext.h | 16 ++++- code/nel/src/3d/driver/opengl/GL/wglext.h | 6 +- 3 files changed, 92 insertions(+), 9 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/GL/glext.h b/code/nel/src/3d/driver/opengl/GL/glext.h index ea6c7c396..47b435bce 100644 --- a/code/nel/src/3d/driver/opengl/GL/glext.h +++ b/code/nel/src/3d/driver/opengl/GL/glext.h @@ -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 diff --git a/code/nel/src/3d/driver/opengl/GL/glxext.h b/code/nel/src/3d/driver/opengl/GL/glxext.h index 227045ad9..dce029046 100644 --- a/code/nel/src/3d/driver/opengl/GL/glxext.h +++ b/code/nel/src/3d/driver/opengl/GL/glxext.h @@ -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); diff --git a/code/nel/src/3d/driver/opengl/GL/wglext.h b/code/nel/src/3d/driver/opengl/GL/wglext.h index 912e31c64..8c39b96cf 100644 --- a/code/nel/src/3d/driver/opengl/GL/wglext.h +++ b/code/nel/src/3d/driver/opengl/GL/wglext.h @@ -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 #endif -#define WGL_WGLEXT_VERSION 20150623 +#define WGL_WGLEXT_VERSION 20160419 /* Generated C header for: * API: wgl From 995120317d2337e4feb3b122a3e711d1421b6113 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:34:43 +0200 Subject: [PATCH 02/17] Fixed: Usage of wglEnumGpuDevicesNV --HG-- branch : develop --- .../driver/opengl/driver_opengl_extension.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index d9850a039..9fbee7518 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -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; } } From 97624ee719db2b7ed170735d55d8aadb634a22dc Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:36:26 +0200 Subject: [PATCH 03/17] Fixed: Typo --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp | 2 +- code/ryzom/tools/client/ryzom_installer/src/filesextractor.h | 2 +- code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index 87b3d4896..ab3c7d929 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -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; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.h b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.h index 276e4a847..8ac094b3d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.h +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.h @@ -32,7 +32,7 @@ public: virtual ~CFilesExtractor(); void setSourceFile(const QString &src); - void setDesinationDirectory(const QString &src); + void setDestinationDirectory(const QString &src); bool exec(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 31c12f872..ec5381a57 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -448,7 +448,7 @@ void COperationDialog::extractBnpClient() CFilesExtractor extractor(this); extractor.setSourceFile(config->getSrcServerClientBNPFullPath()); - extractor.setDesinationDirectory(destinationDirectory); + extractor.setDestinationDirectory(destinationDirectory); extractor.exec(); QString upgradeScript = destinationDirectory + "/upgd_nl."; From b952b51d05e5427ee006cb2abafc91f3877bd67d Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:39:39 +0200 Subject: [PATCH 04/17] Changed: Moved Operation steps enum --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 4 +- .../client/ryzom_installer/src/configfile.h | 31 +++-------- .../tools/client/ryzom_installer/src/main.cpp | 14 ++--- .../client/ryzom_installer/src/mainwindow.cpp | 4 +- .../client/ryzom_installer/src/operation.h | 30 +++++++++++ .../ryzom_installer/src/operationdialog.cpp | 51 +++++++++---------- .../ryzom_installer/src/operationdialog.h | 13 +---- 7 files changed, 74 insertions(+), 73 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 8815396f7..7367cddba 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -620,7 +620,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(); @@ -712,7 +712,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const // selected directory contains Ryzom files (shouldn't fail) if (areRyzomDataInstalledIn(getSrcServerDirectory())) { - return CopyServerFiles; + return CopyDataFiles; } else { diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 67c1a5547..1122ca78e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -17,8 +17,11 @@ #ifndef CONFIGFILE_H #define CONFIGFILE_H -struct CServer +#include "operation.h" + +class CServer { +public: CServer() { dataCompressedSize = 0; @@ -45,8 +48,9 @@ extern const CServer NoServer; typedef QVector CServers; -struct CProfile +class CProfile { +public: CProfile() { desktopShortcut = false; @@ -78,27 +82,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(); @@ -180,7 +163,7 @@ public: QString getSrcServerClientBNPFullPath() const; - InstallationStep getNextStep() const; + OperationStep getInstallNextStep() const; // product details QString getProductName() const; diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index e66115485..be15c75c3 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -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; @@ -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,7 +140,7 @@ int main(int argc, char *argv[]) return dialog.exec() ? 0 : 1; } - if (step == CConfigFile::ShowMigrateWizard) + if (step == ShowMigrateWizard) { CMigrateDialog dialog; @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) step = config.getNextStep(); } - else if (step == CConfigFile::ShowInstallWizard) + else if (step == ShowInstallWizard) { CInstallDialog dialog; @@ -157,10 +157,10 @@ int main(int argc, char *argv[]) step = config.getNextStep(); } - 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; diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index a69426ffa..cbdea44b0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -153,7 +153,7 @@ void CMainWindow::onProfiles() { COperationDialog dialog(this); - dialog.setOperation(COperationDialog::OperationUpdateProfiles); + dialog.setOperation(OperationUpdateProfiles); if (!dialog.exec()) { @@ -212,7 +212,7 @@ void CMainWindow::onUninstall() COperationDialog dialog; - dialog.setOperation(COperationDialog::OperationUninstall); + dialog.setOperation(OperationUninstall); dialog.setUninstallComponents(components); if (dialog.exec()) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operation.h b/code/ryzom/tools/client/ryzom_installer/src/operation.h index 344e9e8ba..cdcd64a93 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operation.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operation.h @@ -46,4 +46,34 @@ struct SUninstallComponents 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 diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index ec5381a57..0f2c2d731 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -76,7 +76,7 @@ COperationDialog::~COperationDialog() { } -void COperationDialog::setOperation(Operation operation) +void COperationDialog::setOperation(OperationType operation) { m_operation = operation; } @@ -126,73 +126,65 @@ void COperationDialog::processMigrateNextStep() 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; } } @@ -352,6 +344,11 @@ 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(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 8aef3ec02..916eb319f 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -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: @@ -134,7 +125,7 @@ protected: QMutex m_abortingMutex; bool m_aborting; - Operation m_operation; + OperationType m_operation; SUninstallComponents m_components; }; From 5a6a596eea44bb7d554c5bf7e5077702ff53df44 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:43:45 +0200 Subject: [PATCH 05/17] Changed: Use servers and profiles ID instead of indices for uninstall --HG-- branch : develop --- .../tools/client/ryzom_installer/src/configfile.cpp | 11 +++++++++++ .../tools/client/ryzom_installer/src/configfile.h | 1 + code/ryzom/tools/client/ryzom_installer/src/main.cpp | 2 +- .../tools/client/ryzom_installer/src/mainwindow.cpp | 2 +- .../tools/client/ryzom_installer/src/operation.h | 4 ++-- .../client/ryzom_installer/src/operationdialog.cpp | 8 ++++---- .../client/ryzom_installer/src/uninstalldialog.cpp | 12 ++++++------ .../client/ryzom_installer/src/uninstalldialog.h | 6 ++++-- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 7367cddba..6756515ab 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -277,6 +277,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; diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 1122ca78e..0edfee0ed 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -106,6 +106,7 @@ 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); diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index be15c75c3..4d91fa088 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -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 diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index cbdea44b0..52109f703 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -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; } { diff --git a/code/ryzom/tools/client/ryzom_installer/src/operation.h b/code/ryzom/tools/client/ryzom_installer/src/operation.h index cdcd64a93..e8e0af678 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operation.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operation.h @@ -40,8 +40,8 @@ struct SUninstallComponents installer = true; } - QVector servers; - QVector profiles; + QStringList servers; + QStringList profiles; bool installer; }; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 0f2c2d731..912fc51eb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -708,7 +708,7 @@ void COperationDialog::deleteComponentsServers() int i = 0; - foreach(int serverIndex, m_components.servers) + foreach(const QString &serverId, m_components.servers) { if (operationShouldStop()) { @@ -716,7 +716,7 @@ void COperationDialog::deleteComponentsServers() return; } - const CServer &server = config->getServer(serverIndex); + const CServer &server = config->getServer(serverId); emit progress(i++, server.name); @@ -747,7 +747,7 @@ void COperationDialog::deleteComponentsProfiles() int i = 0; - foreach(int profileIndex, m_components.profiles) + foreach(const QString &profileId, m_components.profiles) { if (operationShouldStop()) { @@ -755,7 +755,7 @@ void COperationDialog::deleteComponentsProfiles() return; } - const CProfile &profile = config->getProfile(profileIndex); + const CProfile &profile = config->getProfile(profileId); emit progress(i++, profile.name); diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp index aee6290f1..bb514d7bc 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp @@ -53,7 +53,7 @@ CUninstallDialog::CUninstallDialog(QWidget *parent):QDialog(parent), m_installer if (QFile::exists(config->getInstallationDirectory() + "/" + server.id)) { - 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::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::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,7 +222,7 @@ void CUninstallDialog::updateSizes() CConfigFile *config = CConfigFile::getInstance(); // clients - QMap::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end(); + IDIndicesMap::const_iterator it = m_serversIndices.begin(), iend = m_serversIndices.end(); while(it != iend) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.h b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.h index d9bea4449..08f7f536d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.h @@ -55,8 +55,10 @@ private: void updateButtons(); // key is original ID, value is row index - QMap m_serversIndices; - QMap m_profilesIndices; + typedef QMap IDIndicesMap; + + IDIndicesMap m_serversIndices; + IDIndicesMap m_profilesIndices; int m_installerIndex; }; From d6400c9d4ebefebfb56c5f2a04fbe7eb32f13917 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:45:29 +0200 Subject: [PATCH 06/17] Changed: Helpers to get full path of a server or profile --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 16 +++++++++++++--- .../client/ryzom_installer/src/configfile.h | 6 ++++++ .../ryzom_installer/src/operationdialog.cpp | 14 ++++++-------- .../ryzom_installer/src/profilesdialog.cpp | 4 ++-- .../ryzom_installer/src/uninstalldialog.cpp | 6 +++--- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 6756515ab..4c1ea179c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -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) @@ -614,7 +624,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 @@ -623,7 +633,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 @@ -680,7 +690,7 @@ OperationStep CConfigFile::getInstallNextStep() const return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard; } - QString serverDirectory = getInstallationDirectory() + "/" + server.id; + QString serverDirectory = server.getDirectory(); if (getSrcServerDirectory().isEmpty()) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 0edfee0ed..7f1ea301e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -42,6 +42,9 @@ public: QString configurationFilename; QString installerFilename; QString comments; + + // helpers + QString getDirectory() const; }; extern const CServer NoServer; @@ -65,6 +68,9 @@ public: QString comments; bool desktopShortcut; bool menuShortcut; + + // helpers + QString getDirectory() const; }; extern const CProfile NoProfile; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 912fc51eb..3f3a787db 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -382,7 +382,7 @@ void COperationDialog::copyServerFiles() CFilesCopier copier(this); copier.setSourceDirectory(config->getSrcServerDirectory()); - copier.setDestinationDirectory(config->getInstallationDirectory() + "/" + server.id); + copier.setDestinationDirectory(server.getDirectory()); copier.setIncludeFilter(serverFiles); if (copier.exec()) @@ -418,7 +418,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()) @@ -441,7 +441,7 @@ 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()); @@ -589,7 +589,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(); @@ -720,7 +720,7 @@ void COperationDialog::deleteComponentsServers() emit progress(i++, server.name); - QString path = config->getInstallationDirectory() + "/" + server.id; + QString path = server.getDirectory(); QDir dir(path); @@ -759,9 +759,7 @@ void COperationDialog::deleteComponentsProfiles() emit progress(i++, profile.name); - QString path = config->getProfileDirectory() + "/" + profile.id; - - QDir dir(path); + QString path = profile.getDirectory(); if (dir.exists() && !dir.removeRecursively()) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index ac126a1b6..85c176219 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -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)); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp index bb514d7bc..62763063b 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp @@ -51,7 +51,7 @@ 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[server.id] = model->rowCount(); @@ -228,7 +228,7 @@ void CUninstallDialog::updateSizes() { 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)); From f36c00cd00580ea1882b19be2e5f4fc020e4d402 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:46:18 +0200 Subject: [PATCH 07/17] Changed: Remove a profile --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/configfile.cpp | 8 +++++++- code/ryzom/tools/client/ryzom_installer/src/configfile.h | 1 + .../tools/client/ryzom_installer/src/operationdialog.cpp | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 4c1ea179c..4cb77cfff 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -313,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() diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 7f1ea301e..2ecd3e211 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -116,6 +116,7 @@ public: 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); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 3f3a787db..0786e01e0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -766,6 +766,9 @@ void COperationDialog::deleteComponentsProfiles() emit fail(tr("Unable to delete files for profile %1").arg(profile.name)); return; } + + // delete profile + config->removeProfile(profileId); } emit success(m_components.servers.size()); From 7535b41f45b3c063cf6868b2d2622df585ed0fb1 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:49:03 +0200 Subject: [PATCH 08/17] Changed: Only remove directories if not empty path --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 0786e01e0..2b7c9ea98 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -722,12 +722,15 @@ void COperationDialog::deleteComponentsServers() 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; + } } } @@ -761,10 +764,15 @@ void COperationDialog::deleteComponentsProfiles() QString path = profile.getDirectory(); - 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 From c1d471cb195d574b9c831eb12192b1a9f7cc0e2b Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:50:19 +0200 Subject: [PATCH 09/17] Changed: Implement downloaded client extraction --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 2b7c9ea98..2a7c80ae1 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -362,7 +362,30 @@ 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(); From 0d65dea8bac8f04bf8b1369087abc10721ff2a09 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:51:28 +0200 Subject: [PATCH 10/17] Changed: Profiles update --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 95 ++++++++++++++++++- .../ryzom_installer/src/operationdialog.h | 1 + 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 2a7c80ae1..a3fdd1e4a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -196,9 +196,98 @@ void COperationDialog::processUpdateProfilesNextStep() // 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() diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 916eb319f..fdee8b404 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -87,6 +87,7 @@ protected: void processUpdateProfilesNextStep(); void processInstallNextStep(); void processUninstallNextStep(); + void processUpdateProfilesNextStep(); // operations void downloadData(); From 79632a204d61917045f4881ab87bff9d4ed9e6f3 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:52:48 +0200 Subject: [PATCH 11/17] Changed: client_default.cfg is in client package --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index a3fdd1e4a..ccd59b2a6 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -481,7 +481,7 @@ void COperationDialog::copyDataFiles() // default server const CServer &server = config->getServer(); - 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; @@ -490,7 +490,6 @@ void COperationDialog::copyDataFiles() serverFiles << "examples"; serverFiles << "patch"; serverFiles << "unpack"; - serverFiles << "client_default.cfg"; CFilesCopier copier(this); copier.setSourceDirectory(config->getSrcServerDirectory()); From 38285cd8dc806365eb0be76310d70232d39d7e2d Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:53:44 +0200 Subject: [PATCH 12/17] Changed: Different methods to process operations types --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/main.cpp | 6 +++--- .../client/ryzom_installer/src/operationdialog.cpp | 11 ++++------- .../client/ryzom_installer/src/operationdialog.h | 2 -- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 4d91fa088..97ba78ce9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) if (!dialog.exec()) return 1; - step = config.getNextStep(); + step = config.getInstallNextStep(); } else if (step == ShowInstallWizard) { @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) if (!dialog.exec()) return 1; - step = config.getNextStep(); + step = config.getInstallNextStep(); } if (step != Done) @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) if (!dialog.exec()) return 1; - step = config.getNextStep(); + step = config.getInstallNextStep(); } CMainWindow mainWindow; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index ccd59b2a6..61ada6074 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -91,17 +91,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 +108,7 @@ void COperationDialog::processNextStep() } } -void COperationDialog::processMigrateNextStep() +void COperationDialog::processInstallNextStep() { CConfigFile *config = CConfigFile::getInstance(); @@ -122,7 +119,7 @@ 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) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index fdee8b404..8e41c5034 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -83,8 +83,6 @@ protected: void closeEvent(QCloseEvent *e); void processNextStep(); - void processMigrateNextStep(); - void processUpdateProfilesNextStep(); void processInstallNextStep(); void processUninstallNextStep(); void processUpdateProfilesNextStep(); From b7f60f740b876f846a3a5c5e935053d5fd07dc92 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:54:51 +0200 Subject: [PATCH 13/17] Changed: Specify server to process --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 8 +++----- .../tools/client/ryzom_installer/src/operationdialog.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 61ada6074..9e06cef1c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -421,8 +421,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..."); @@ -439,8 +438,7 @@ 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..."); @@ -476,7 +474,7 @@ 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 data files required by server %1").arg(server.name); m_currentOperationProgressFormat = QApplication::tr("Copying %1..."); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 8e41c5034..b1a42cbb9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -126,6 +126,7 @@ protected: OperationType m_operation; SUninstallComponents m_components; + QString m_currentServerId; }; #endif From 3091aa1e9065e1effcc1d25d2dc02bd076c856f5 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:55:17 +0200 Subject: [PATCH 14/17] Changed: More operations --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/operationdialog.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index b1a42cbb9..c37f08e42 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -89,8 +89,10 @@ protected: // operations void downloadData(); + void extractDownloadedData(); void downloadClient(); - void copyServerFiles(); + void extractDownloadedClient(); + void copyDataFiles(); void copyProfileFiles(); void cleanFiles(); void extractBnpClient(); From 7688aa1bec198a86bdc94726fab27e0bf6ae92cd Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:55:41 +0200 Subject: [PATCH 15/17] Changed: Clear all profiles components after uninstalling them --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 9e06cef1c..dcc4cfc1c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -885,6 +885,9 @@ void COperationDialog::deleteComponentsProfiles() config->removeProfile(profileId); } + // clear list of all profiles to uninstall + m_components.profiles.clear(); + emit success(m_components.servers.size()); emit done(); } From d769c4a6c97ab341c98e2004f9c0cbd3aa671932 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:55:56 +0200 Subject: [PATCH 16/17] Changed: Default profile is using default server --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index dcc4cfc1c..08d4845ee 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -705,7 +705,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"); From d55c2b25c4c33db5ca1b0b9723289a0f291c5bd2 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:56:10 +0200 Subject: [PATCH 17/17] Changed: Minor changes --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 08d4845ee..667dad6f4 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -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); @@ -191,7 +188,6 @@ void COperationDialog::processUpdateProfilesNextStep() // TODO: check all servers are downloaded // TODO: delete profiles directories that are not used anymore // TODO: create shortcuts -} QStringList serversToUpdate; QStringList profilesToDelete; @@ -734,6 +730,10 @@ bool COperationDialog::createDefaultProfile() bool COperationDialog::createDefaultShortcuts() { + CConfigFile *config = CConfigFile::getInstance(); + + CServer server = config->getServer(); + emit done(); return true;