GET_VERSION_FUNC getVersion = 0;
#ifdef WIN32
- HINSTANCE modLib = ::LoadLibrary( libName.toUtf8() );
+
+#ifdef UNICODE
+ LPTSTR str_libname = new TCHAR[libName.length() + 1];
+ str_libname[libName.toWCharArray(str_libname)] = '\0';
+#else
+ LPTSTR str_libname = libName.toLatin1().constData();
+#endif
+ HINSTANCE modLib = ::LoadLibrary( str_libname );
if ( !modLib )
{
LPVOID lpMsgBuf;
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 );
- err = QString( "Failed to load %1. %2" ).arg( libName ).arg( (LPTSTR)lpMsgBuf );
+#ifdef UNICODE
+ QString out_err = QString::fromWCharArray((LPTSTR)lpMsgBuf);
+#else
+ QString out_err = (LPTSTR)lpMsgBuf;
+#endif
+ err = QString( "Failed to load %1. %2" ).arg( libName ).arg(out_err);
::LocalFree( lpMsgBuf );
}
else
LPVOID lpMsgBuf;
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 );
- err = QString( "Failed to find %1 function. %2" ).arg( GET_MODULE_NAME ).arg( (LPTSTR)lpMsgBuf );
- ::LocalFree( lpMsgBuf );
+#ifdef UNICODE
+ QString out_err = QString::fromWCharArray((LPTSTR)lpMsgBuf);
+#else
+ QString out_err = (LPTSTR)lpMsgBuf;
+#endif
+
+ err = QString( "Failed to find %1 function. %2" ).arg( GET_MODULE_NAME ).arg( out_err );
+ ::LocalFree( lpMsgBuf );
}
getVersion = (GET_VERSION_FUNC)::GetProcAddress( modLib, GET_VERSION_NAME );
*/
int CAM_Module::showNotification( const QString& message, const QString& title, int timeout )
{
+ int res = -1;
if ( application() )
- application()->showNotification( message, title, timeout );
+ res = application()->showNotification( message, title, timeout );
+ return res;
}
/*!
#else
//====================================== WIN32 part ====================================================
-#include <OSD_WNT_1.hxx>
+#include <OSD_WNT.hxx>
#include <process.h>
#include <signal.h>
HGDIOBJ old1 = SelectObject( dc, aFont );
HGDIOBJ old2 = SelectObject( dc, aBrush );
-
- TextOut( dc, x, y, aText.toLatin1().constData(), aText.length() );
+#ifdef UNICODE
+ LPTSTR str = new TCHAR[aText.length() + 1];
+ str[aText.toWCharArray(str)] = '\0';
+#else
+ LPTSTR str = aText.toLatin1().constData();
+#endif
+ TextOut( dc, x, y, str, aText.length() );
SelectObject ( dc, old1 );
SelectObject ( dc, old2 );
HDC screen_dc = GetDC( 0 ); //The screen device context
HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen
- hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toUtf8().data(), &r, "" );
+#ifdef UNICODE
+ LPTSTR str = new TCHAR[FileName.length() + 1];
+ str[FileName.toWCharArray(str)] = '\0';
+ LPTSTR empty = L"";
+#else
+ LPTSTR str = FileName.toLatin1().constData();
+ LPTSTR empty = "";
+#endif
+
+ hMetaFileDC = CreateEnhMetaFile( bitDC, str, &r, empty );
SetMapMode( hMetaFileDC, MM_HIMETRIC );
SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL );
HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH );
virtual void setSelection( const SUIT_DataOwnerPtrList& );
#ifndef DISABLE_OCCVIEWER
- virtual QString entry( const Handle_AIS_InteractiveObject& ) const;
+ virtual QString entry( const Handle(AIS_InteractiveObject)& ) const;
#endif
SUIT_DataOwnerPtrList mySelectedExternals;
virtual void selectionChanged( SUIT_Selector* );
#ifndef DISABLE_SALOMEOBJECT
- QList<Handle_SALOME_InteractiveObject> selectionCache( const QString& = QString() ) const;
+ QList<Handle(SALOME_InteractiveObject)> selectionCache( const QString& = QString() ) const;
#else
QStringList selectionCache( const QString& = QString() ) const;
#endif
private:
#ifndef DISABLE_SALOMEOBJECT
- typedef Handle_SALOME_InteractiveObject SelObject;
+ typedef Handle(SALOME_InteractiveObject) SelObject;
#else
typedef QString SelObject;
#endif
/*!
SLOT: Called when clip plane is clicked in viewer.
*/
-void OCCViewer_ClippingDlg::onPlaneClicked( const Handle(AIS_Plane)& thePlane )
+void OCCViewer_ClippingDlg::onPlaneClicked( const Handle_AIS_Plane& thePlane )
{
for ( int aPlaneIt = 0; aPlaneIt < myPreviewPlaneVector.size(); aPlaneIt++ )
{
/*!
SLOT: Called when clip plane is changed by dragging in viewer.
*/
-void OCCViewer_ClippingDlg::onPlaneDragged( const Handle(AIS_Plane)& thePlane )
+void OCCViewer_ClippingDlg::onPlaneDragged( const Handle_AIS_Plane& thePlane )
{
for ( int aPlaneIt = 0; aPlaneIt < myPreviewPlaneVector.size(); aPlaneIt++ )
{
#define GL_GLEXT_PROTOTYPES
#endif
+
#include "OpenGLUtils_FrameBuffer.h"
#include <utilities.h>
bool OpenGLUtils_FrameBuffer::init( const GLsizei& xSize, const GLsizei& ySize )
{
-#ifdef VTK_OPENGL2
+#if defined(VTK_OPENGL2) && ! defined(WIN32)
int n = 0;
std::ostringstream strm;
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
# --- SWIG part ---
SET_SOURCE_FILES_PROPERTIES(${_SWIG} PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(${_SWIG} PROPERTIES SWIG_FLAGS "-py3")
-SWIG_ADD_MODULE(PVServer_ServiceLoader python ${_SWIG})
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(PVServer_ServiceLoader python ${_SWIG})
+ELSE()
+ SWIG_ADD_LIBRARY(PVServer_ServiceLoader LANGUAGE python SOURCES ${_SWIG})
+ENDIF()
+
+
IF(WIN32)
SET_TARGET_PROPERTIES(_PVServer_ServiceLoader PROPERTIES DEBUG_OUTPUT_NAME _PVServer_ServiceLoader_d)
ENDIF(WIN32)
fmt.setBlueBufferSize(1);
fmt.setDepthBufferSize(1);
fmt.setStencilBufferSize(0);
+#ifdef WIN32
+ fmt.setAlphaBufferSize(0);
+#else
fmt.setAlphaBufferSize(1);
+#endif
fmt.setStereo(false);
fmt.setSamples(0);
#ifndef QTXNOTIFY_H
#define QTXNOTIFY_H
+#include "Qtx.h"
+
#include <QWidget>
#include <QList>
class QTimer;
-class QtxNotify : public QObject
+class QTX_EXPORT QtxNotify : public QObject
{
Q_OBJECT
# --- rules ---
-SWIG_ADD_MODULE(libSALOME_Swig python libSALOME_Swig.i SALOMEGUI_Swig.cxx)
+
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(libSALOME_Swig python libSALOME_Swig.i SALOMEGUI_Swig.cxx)
+ELSE()
+ SWIG_ADD_LIBRARY(libSALOME_Swig LANGUAGE python SOURCES libSALOME_Swig.i SALOMEGUI_Swig.cxx)
+ENDIF()
+
SWIG_LINK_LIBRARIES(libSALOME_Swig ${PYTHON_LIBRARIES} LightApp)
IF(WIN32)
SET_TARGET_PROPERTIES(_libSALOME_Swig PROPERTIES DEBUG_OUTPUT_NAME _libSALOME_Swig_d)
{
QString env;
#ifdef WIN32
- DWORD aLen=1024;
- char aStr[1024];
+ DWORD aLen=1024;
+ TCHAR aStr[1024];
HANDLE aToken=0;
HANDLE hProcess = GetCurrentProcess();
OpenProcessToken(hProcess,TOKEN_QUERY,&aToken);
if( ! GetUserProfileDirectory( aToken, aStr, &aLen ) )
reject();
-
+#ifdef UNICODE
+ env = QString::fromWCharArray(aStr);
+#else
env = aStr;
+#endif
#else
if( ! ::getenv( "HOME" ) )
reject();
::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 );
LPTSTR msg = (LPTSTR)lpMsgBuf;
+#ifdef UNICODE
+ str = QString::fromWCharArray(msg);
+#else
str = QString( SUIT_Tools::toQString( msg ) );
+#endif
LocalFree( lpMsgBuf );
#else
str = QString( dlerror() );
#ifdef WIN32
DWORD aLen=1024;
- char aStr[1024];
+ TCHAR aStr[1024];
HANDLE aToken=0;
HANDLE hProcess = GetCurrentProcess();
OpenProcessToken(hProcess,TOKEN_QUERY,&aToken);
- if( GetUserProfileDirectory( aToken, aStr, &aLen ) )
- env = aStr;
+ if( GetUserProfileDirectory( aToken, aStr, &aLen ) ) {
+#ifdef UNICODE
+ env = QString::fromWCharArray(aStr);
+#else
+ env = aStr;
+#endif
+ }
#else
if ( ::getenv( "HOME" ) )
vglBindVertexArrayARB (NULL),
vglUniform1iARB (NULL),
vglGetUniformLocationARB (NULL),
+ vglActiveTextureARB (NULL),
+ vglGetStringiARB (NULL),
#endif
mIsInitialized (false)
{
vglGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)GL_GetProcAddress( "glGetUniformLocationARB" );
if( !vglGetUniformLocationARB )
return;
-
- vglGetShaderivARB = (PFNGLGETSHADERIVPROC)GL_GetProcAddress( "glGetShaderiv" );
+
+ vglGetShaderivARB = (PFNGLGETSHADERIVARBPROC)GL_GetProcAddress( "glGetShaderiv" );
if( !vglGetShaderivARB )
return;
- vglGetProgramivARB = (PFNGLGETPROGRAMIVPROC)GL_GetProcAddress( "glGetProgramiv" );
+ vglActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)GL_GetProcAddress( "glActiveTexture" );
+ if (!vglActiveTextureARB)
+ return;
+
+ vglGetStringiARB = (PFNGLGETSTRINGIPROC)GL_GetProcAddress("glGetStringi");
+ if (!vglGetStringiARB)
+ return;
+
+ vglGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)GL_GetProcAddress( "glGetProgramiv" );
if( !vglGetProgramivARB )
return;
- vglGetShaderInfoLogARB = (PFNGLGETSHADERINFOLOGPROC)GL_GetProcAddress( "glGetShaderInfoLog" );
+ vglGetShaderInfoLogARB = (PFNGLGETSHADERINFOLOGARBPROC)GL_GetProcAddress( "glGetShaderInfoLog" );
if( !vglGetShaderInfoLogARB )
return;
if (compileStatus != GL_TRUE)
{
GLint size;
- GLchar info[1024];
+ GLcharARB info[1024];
vglGetShaderInfoLogARB (theVertexShader, 1024, &size, info);
std::cerr << "Can't compile vertex shader." << std::endl;
if (compileStatus != GL_TRUE)
{
GLint size;
- GLchar info[1024];
+ GLcharARB info[1024];
vglGetShaderInfoLogARB (theVertexShader, 1024, &size, info);
std::cerr << "Can't compile fragment shader." << std::endl;
#define GL_STATIC_DRAW_ARB 0x88E4
#endif
+#ifndef GL_COMPILE_STATUS
+#define GL_COMPILE_STATUS 0x8B81
+#endif
+
+#ifndef GL_CURRENT_PROGRAM
+#define GL_CURRENT_PROGRAM 0x8B8D
+#endif
+
+#ifndef GL_DEBUG_TYPE_ERROR
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#endif
+
+#ifndef GL_LINK_STATUS
+#define GL_LINK_STATUS 0x8B82
+#endif
+
+#ifndef GL_TEXTURE0
+#define GL_TEXTURE0 0x84C0
+#endif
+
+#ifndef GL_VALIDATE_STATUS
+#define GL_VALIDATE_STATUS 0x8B83
+#endif
+
+#ifndef GL_NUM_EXTENSIONS
+#define GL_NUM_EXTENSIONS 0x821D
+#endif
namespace GUI_OPENGL {
char* readFromFile( std::string fileName );
typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
#ifdef VTK_OPENGL2
+ typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB program);
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB program, const GLcharARB *name );
typedef void (APIENTRYP PFNGLGETSHADERIVARBPROC) (GLuint shader, GLenum pname, GLint *params);
- typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLuint program, GLenum pname, GLint *params);
- typedef void (APIENTRYP PFNGLGETSHADERINFOLOGARBPROC) (GLuint shader, GLsizei maxLength, GLsizei *length, GLchar *infoLog);
+ typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+ typedef void (APIENTRYP PFNGLGETSHADERINFOLOGARBPROC) (GLuint shader, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSARBPROC) (GLsizei n, GLuint *arrays);
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYARBPROC) (GLuint array);
typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
+ typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
#endif
public:
PFNGLBINDVERTEXARRAYARBPROC vglBindVertexArrayARB;
PFNGLUNIFORM1IARBPROC vglUniform1iARB;
PFNGLGETUNIFORMLOCATIONARBPROC vglGetUniformLocationARB;
+ PFNGLACTIVETEXTUREARBPROC vglActiveTextureARB;
+ PFNGLGETSTRINGIPROC vglGetStringiARB;
#endif
protected:
GLuint id,
GLenum severity,
GLsizei length,
- const GLchar* message,
+ const GLcharARB* message,
const void* userParam )
{
fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (int i = 0; i < n; i++)
{
- const char *exti = (const char *)glGetStringi(GL_EXTENSIONS, i);
+ const char *exti = (const char *)this->OpenGLHelper.vglGetStringiARB(GL_EXTENSIONS, i);
strm<< exti <<" ";
}
std::string s = strm.str();
glGenTextures( 1, &this->PointSpriteTexture );
}
#ifdef VTK_OPENGL2
- glActiveTexture( GL_TEXTURE0 );
+ this->OpenGLHelper.vglActiveTextureARB( GL_TEXTURE0 );
#endif
glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
)
SET(qremotefilebrowser_HEADERS
- QRemoteFileBrowser
- QRemoteCopyWidget
- QMachineBrowser
+ QRemoteFileBrowser.h
+ QRemoteCopyWidget.h
+ QMachineBrowser.h
+ RemoteFileBrowser.h
)
SET(qremotefilebrowser_LIBRARIES
)
SET(_moc_HEADERS
- QRemoteFileBrowser
- QMachineBrowser
- QRemoteCopyWidget
+ QRemoteFileBrowser.h
+ QMachineBrowser.h
+ QRemoteCopyWidget.h
)
# sources / moc wrappings
+++ /dev/null
-// Copyright (C) 2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony GEAY (EDF R&D)
-
-#ifndef __QMACHINEBROWSER__
-#define __QMACHINEBROWSER__
-
-#include <QWidget>
-#include <QComboBox>
-
-class QPushButton;
-class QLineEdit;
-
-class QMachineSelector : public QComboBox
-{
- Q_OBJECT
-public:
- QMachineSelector(QWidget *parent);
- void initLocation();
-public slots:
- void appendEntry(const QString& entry);
-private:
- void fillMachines();
- void fillMachinesFromCatalog();
- void fillMachinesFromSettings();
- void assignToLocalhost();
-};
-
-class QMachineManager : public QWidget
-{
- Q_OBJECT
-public:
- QMachineManager(QWidget *parent);
- void initLocation();
- QString getSelectedHost() const;
-public slots:
- void newEntryRequested();
-private:
- QPushButton *_pb;
- QMachineSelector *_ms;
-};
-
-class QRemoteFileSystemModel;
-class FileLoader;
-
-class QMachineBrowser : public QWidget
-{
- Q_OBJECT
-public:
- QMachineBrowser(QWidget *parent=NULL);
- void initLocation();
- QRemoteFileSystemModel *generateModel();
- FileLoader *generateFileLoader();
-signals:
- void locationChanged();
-private:
- QMachineManager *_msel;
- QLineEdit *_le;
-};
-
-#endif
//
// Author : Anthony GEAY (EDF R&D)
-#include "QMachineBrowser"
-#include "QRemoteFileBrowser"
+#include "QMachineBrowser.h"
+#include "QRemoteFileBrowser.h"
#include "QDir"
#include "QFileInfo"
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#ifndef __QMACHINEBROWSER__
+#define __QMACHINEBROWSER__
+
+#include "RemoteFileBrowser.h"
+
+#include <QWidget>
+#include <QComboBox>
+
+class QPushButton;
+class QLineEdit;
+
+class QREMOTEFILEBROWSER_EXPORT QMachineSelector : public QComboBox
+{
+ Q_OBJECT
+public:
+ QMachineSelector(QWidget *parent);
+ void initLocation();
+public slots:
+ void appendEntry(const QString& entry);
+private:
+ void fillMachines();
+ void fillMachinesFromCatalog();
+ void fillMachinesFromSettings();
+ void assignToLocalhost();
+};
+
+class QREMOTEFILEBROWSER_EXPORT QMachineManager : public QWidget
+{
+ Q_OBJECT
+public:
+ QMachineManager(QWidget *parent);
+ void initLocation();
+ QString getSelectedHost() const;
+public slots:
+ void newEntryRequested();
+private:
+ QPushButton *_pb;
+ QMachineSelector *_ms;
+};
+
+class QRemoteFileSystemModel;
+class FileLoader;
+
+class QREMOTEFILEBROWSER_EXPORT QMachineBrowser : public QWidget
+{
+ Q_OBJECT
+public:
+ QMachineBrowser(QWidget *parent=NULL);
+ void initLocation();
+ QRemoteFileSystemModel *generateModel();
+ FileLoader *generateFileLoader();
+signals:
+ void locationChanged();
+private:
+ QMachineManager *_msel;
+ QLineEdit *_le;
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony GEAY (EDF R&D)
-
-#ifndef __QREMOTECOPYWIDGET__
-#define __QREMOTECOPYWIDGET__
-
-#include "QDialog"
-#include "QMutex"
-#include "QThread"
-#include "QTreeView"
-#include "QTableView"
-#include "QItemDelegate"
-#include "QPointer"
-#include "QProcess"
-
-class QRemoteFileSystemModel;
-class QFilesDirsCopierModel;
-class DataStructure;
-class QTableView;
-
-void PerformCopy(QWidget *parent, QRemoteFileSystemModel *srcModel, const QModelIndexList& srcSelectedFiles, DataStructure *ds);
-
-class CopierThread : public QThread
-{
-public:
- CopierThread(QObject *parent, QFilesDirsCopierModel *model):QThread(parent),_model(model) { }
- void stopRequested();
-protected:
- void run();
-private:
- QFilesDirsCopierModel *_model;
-};
-
-class QFilesDirsCopierModel : public QAbstractListModel
-{
- Q_OBJECT
-public:
- QFilesDirsCopierModel(QObject *parent, const QList<const DataStructure *>& srcFiles, DataStructure *destLoc);
- int nbOfRows() const;
- int rowCount(const QModelIndex&) const;
- int columnCount(const QModelIndex&) const;
- QVariant data(const QModelIndex&, int) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- const QString& getErrorStr() const { return _error; }
- int getProgressOf(int srcFileId) const;
- QString getFullNameOf(int srcFileId) const;
- QString getNameOf(int srcFileId) const;
- QString getPrettyText(int srcFileId) const;
- QSize sizeHint() const;
- //
- void launchCopy();
- void stopCurrentCopy();
-public slots:
- void newOutputAvailable();
-private:
- void fillArgsForRSync(const DataStructure *srcFile, QStringList& args) const;
-private:
- QList<const DataStructure *> _srcFiles;
- //
- mutable QMutex _mutOnProc;
- volatile int _currentElt;
- QPointer<QProcess> _curProc;
- QString _error;
- //
- QVector<int> _progress;
- DataStructure *_destLoc;
-public:
- static constexpr int PROGRESS_STATUS_START=-1;
- static constexpr int PROGRESS_STATUS_OVER=101;
- static const char ATOMIC_STOP_MSG[];
-};
-
-class ProgressDelegate : public QItemDelegate
-{
-public:
- ProgressDelegate(QObject *parent, QFilesDirsCopierModel *model):QItemDelegate(parent),_model(model) { }
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-private:
- QFilesDirsCopierModel *_model;
-};
-
-class CopierTableView : public QTableView
-{
-public:
- CopierTableView(QWidget *parent);
- int sizeHintForColumn(int column) const;
- int sizeHintForRow(int row) const;
- void resizeEvent(QResizeEvent *event);
- QSize sizeHint() const;
-};
-
-class FilesDirsCopier : public QDialog
-{
- Q_OBJECT
-public:
- FilesDirsCopier(QWidget *parent, const QList<const DataStructure *>& srcFiles, DataStructure *destLoc);
-public slots:
- void cancelRequested();
- void myAccept(bool);
- int exec();
- const QString& getErrorStr() const { return _model->getErrorStr(); }
-signals:
- void myAcceptSignal(bool);
-private:
- CopierTableView *_table;
- QPushButton *_cancel;
- CopierThread *_th;
- QFilesDirsCopierModel *_model;
-};
-
-#endif
//
// Author : Anthony GEAY (EDF R&D)
-#include "QRemoteCopyWidget"
-#include "QRemoteFileBrowser"
+#include "QRemoteCopyWidget.h"
+#include "QRemoteFileBrowser.h"
+
#include "QVBoxLayout"
#include "QPushButton"
#include "QHeaderView"
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#ifndef __QREMOTECOPYWIDGET__
+#define __QREMOTECOPYWIDGET__
+
+#include "RemoteFileBrowser.h"
+
+#include "QDialog"
+#include "QMutex"
+#include "QThread"
+#include "QTreeView"
+#include "QTableView"
+#include "QItemDelegate"
+#include "QPointer"
+#include "QProcess"
+
+class QRemoteFileSystemModel;
+class QFilesDirsCopierModel;
+class DataStructure;
+class QTableView;
+
+void PerformCopy(QWidget *parent, QRemoteFileSystemModel *srcModel, const QModelIndexList& srcSelectedFiles, DataStructure *ds);
+
+class QREMOTEFILEBROWSER_EXPORT CopierThread : public QThread
+{
+public:
+ CopierThread(QObject *parent, QFilesDirsCopierModel *model):QThread(parent),_model(model) { }
+ void stopRequested();
+protected:
+ void run();
+private:
+ QFilesDirsCopierModel *_model;
+};
+
+class QREMOTEFILEBROWSER_EXPORT QFilesDirsCopierModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ QFilesDirsCopierModel(QObject *parent, const QList<const DataStructure *>& srcFiles, DataStructure *destLoc);
+ int nbOfRows() const;
+ int rowCount(const QModelIndex&) const;
+ int columnCount(const QModelIndex&) const;
+ QVariant data(const QModelIndex&, int) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ const QString& getErrorStr() const { return _error; }
+ int getProgressOf(int srcFileId) const;
+ QString getFullNameOf(int srcFileId) const;
+ QString getNameOf(int srcFileId) const;
+ QString getPrettyText(int srcFileId) const;
+ QSize sizeHint() const;
+ //
+ void launchCopy();
+ void stopCurrentCopy();
+public slots:
+ void newOutputAvailable();
+private:
+ void fillArgsForRSync(const DataStructure *srcFile, QStringList& args) const;
+private:
+ QList<const DataStructure *> _srcFiles;
+ //
+ mutable QMutex _mutOnProc;
+ volatile int _currentElt;
+ QPointer<QProcess> _curProc;
+ QString _error;
+ //
+ QVector<int> _progress;
+ DataStructure *_destLoc;
+public:
+ static constexpr int PROGRESS_STATUS_START=-1;
+ static constexpr int PROGRESS_STATUS_OVER=101;
+ static const char ATOMIC_STOP_MSG[];
+};
+
+class QREMOTEFILEBROWSER_EXPORT ProgressDelegate : public QItemDelegate
+{
+public:
+ ProgressDelegate(QObject *parent, QFilesDirsCopierModel *model):QItemDelegate(parent),_model(model) { }
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+private:
+ QFilesDirsCopierModel *_model;
+};
+
+class QREMOTEFILEBROWSER_EXPORT CopierTableView : public QTableView
+{
+public:
+ CopierTableView(QWidget *parent);
+ int sizeHintForColumn(int column) const;
+ int sizeHintForRow(int row) const;
+ void resizeEvent(QResizeEvent *event);
+ QSize sizeHint() const;
+};
+
+class QREMOTEFILEBROWSER_EXPORT FilesDirsCopier : public QDialog
+{
+ Q_OBJECT
+public:
+ FilesDirsCopier(QWidget *parent, const QList<const DataStructure *>& srcFiles, DataStructure *destLoc);
+public slots:
+ void cancelRequested();
+ void myAccept(bool);
+ int exec();
+ const QString& getErrorStr() const { return _model->getErrorStr(); }
+signals:
+ void myAcceptSignal(bool);
+private:
+ CopierTableView *_table;
+ QPushButton *_cancel;
+ CopierThread *_th;
+ QFilesDirsCopierModel *_model;
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony GEAY (EDF R&D)
-
-#ifndef __QREMOTEFILEBROWSER__
-#define __QREMOTEFILEBROWSER__
-
-#include "QWidget"
-#include "QTreeView"
-#include "QMimeData"
-#include "QThread"
-
-class AnotherTreeView;
-class QMachineBrowser;
-class QRemoteFileSystemModel;
-class TopDirDataStructure;
-
-class LoadingThread : public QThread
-{
- Q_OBJECT
-public:
- LoadingThread(QThread *th, QMachineBrowser *mb):_fatherThread(th),_mb(mb),_model(nullptr) { }
- void setGeneratedModel(QRemoteFileSystemModel *model) { _model=model; }
- QRemoteFileSystemModel *generatedModel() const { return _model; }
-signals:
- void letsGenerateModel(TopDirDataStructure *fds);
-protected:
- void run();
-private:
- QThread *_fatherThread;
- QMachineBrowser *_mb;
- QRemoteFileSystemModel *_model;
-};
-
-class QRemoteFileBrowser : public QWidget
-{
- Q_OBJECT
-public:
- QRemoteFileBrowser(QWidget *parent);
- QMachineBrowser *machineBrower() const { return _mb; }
-public slots:
- void onLocationChanged();
- void locationHasBeenChanged();
-private:
- AnotherTreeView *_treeView;
- QMachineBrowser *_mb;
-};
-
-class QRemoteFileTransfer : public QWidget
-{
-public:
- QRemoteFileTransfer(QWidget *parent=0);
-private:
- QRemoteFileBrowser *_left;
- QRemoteFileBrowser *_right;
-};
-
-class DirDataStructure;
-class TopDirDataStructure;
-
-class DataStructure : public QObject
-{
- Q_OBJECT
-public:
- DataStructure(QObject *parent, const QString& name):QObject(parent),_name(name),_selected(false) { }
- void select() { _selected=true; }
- void unselect() { _selected=false; }
- bool isSelected() const { return _selected; }
- virtual bool isFile() const = 0;
- virtual QString nameOnDrop() const = 0;
- const DirDataStructure *getDirParent() const;
- bool isRoot() const { return getDirParent()==NULL; }
- const TopDirDataStructure *getRoot() const;
- std::vector<const DataStructure *> getItermediateElts(const TopDirDataStructure *tpds) const;
- virtual int size() const = 0;
- QString entryForRSyncSrc() const;
- virtual QString entryForRSyncDest() const = 0;
- QString name() const;
- const QString& fullName() const { return _name; }
- void removeFileArgs(QString& prg, QStringList& args) const;
-private:
- QString _name;
- bool _selected;
-};
-
-class FileDataStructure : public DataStructure
-{
-public:
- FileDataStructure(DirDataStructure *dds, const QString& name);
- bool isFile() const { return true; }
- int size() const { return 0; }
- QString entryForRSyncDest() const;
- QString nameOnDrop() const;
-};
-
-class DirDataStructure : public DataStructure
-{
-public:
- DirDataStructure(DirDataStructure *dds, const QString& name):DataStructure(dds,name),_is_loaded(false),_is_expanded(false) { }
- DirDataStructure(QObject *dds, const QString& name):DataStructure(dds,name),_is_loaded(false) { }
- bool isFile() const { return false; }
- int size() const { load(); return children().size(); }
- QString entryForRSyncDest() const;
- QString nameOnDrop() const { return name(); }
- const DataStructure *operator[](int pos) const;
- int posOf(const DataStructure *ds) const;
- bool load() const;
- void markAsLoaded() const { _is_loaded=true; }
- void setExpanded(bool status) { _is_expanded=status; }
- bool isExpanded() const { return _is_expanded; }
-private:
- mutable bool _is_loaded;
- mutable bool _is_expanded;
-};
-
-class FileLoader;
-
-class TopDirDataStructure : public DirDataStructure
-{
-public:
- TopDirDataStructure(QObject *dds, FileLoader *fl);
- virtual ~TopDirDataStructure();
- FileLoader *getLoader() const { return _fl; }
- bool isOK() const { return _isOK; }
- QString entryForRSync(const QString& fn) const;
- QString getMachine() const;
- void removeFileArgsImpl(const QString& filePath, QString& prg, QStringList& args) const;
-private:
- FileLoader *_fl;
- bool _isOK;
-};
-
-class QRemoteFileSystemModel;
-
-class MyTreeView : public QTreeView
-{
- Q_OBJECT
-public:
- MyTreeView(QWidget *parent);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dropEvent(QDropEvent *event);
- QRemoteFileSystemModel *zeModel();
- void emitResetModel();
-public slots:
- void itemExpanded(const QModelIndex &index);
- void itemCollapsed(const QModelIndex &index);
-signals:
- void somethingChangedDueToFileModif();
-private:
- void itemExpandedStatus(const QModelIndex &index, bool status);
- void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const;
- void paintEvent(QPaintEvent *event);
-private:
- QPoint _start_pos;
- // during drag drop _sel is the element under the mouse on the drop site
- DataStructure *_sel;
- // during drag drop _slider_pos is the pos of vertical slider on drop site
- int _slider_pos;
-};
-
-class AnotherTreeView;
-
-class AnotherTreeViewPainter
-{
-public:
- virtual void paint(AnotherTreeView *atv, QPaintEvent *event) const = 0;
-};
-
-class AnotherTreeViewWaitPainter : public AnotherTreeViewPainter
-{
-public:
- void paint(AnotherTreeView *atv, QPaintEvent *event) const;
-};
-
-class AnotherTreeViewNothingPainter : public AnotherTreeViewPainter
-{
-public:
- void paint(AnotherTreeView *atv, QPaintEvent *event) const;
-};
-
-class AnotherTreeView : public QWidget
-{
- Q_OBJECT
-public:
- AnotherTreeView(QWidget *parent);
- void generateModel(QMachineBrowser *mb);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
- int getAngle() const { return _angle; }
- ~AnotherTreeView();
-public slots:
- void goGenerate(TopDirDataStructure *fds);
- void modelHasBeenGenerated();
-signals:
- void modelHasBeenGeneratedSignal(bool isOK);
- void somethingChangedDueToFileModif();
-protected:
- void paintEvent(QPaintEvent *event);
- void timerEvent(QTimerEvent *e);
-private:
- int _timerId;
- int _angle;
- AnotherTreeViewPainter *_painter;
- MyTreeView *_tw;
- LoadingThread *_th;
-};
-
-class FileLoader
-{
-protected:
- FileLoader(const QString& dirName):_dirName(dirName) { }
-public:
- QString getDirName() const { return _dirName; }
- virtual bool load(DirDataStructure *parent) const = 0;
- virtual QString prettyPrint() const = 0;
- virtual QString entryForRSync(const QString& fn) const = 0;
- virtual QString getMachine() const = 0;
- virtual void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const = 0;
- virtual ~FileLoader() { }
-private:
- QString _dirName;
-};
-
-class LocalFileLoader : public FileLoader
-{
-public:
- LocalFileLoader(const QString& dirName):FileLoader(dirName) { }
- bool load(DirDataStructure *parent) const;
- void fillArgs(const QString& dn, QString& prg, QStringList& args) const;
- QString prettyPrint() const;
- QString entryForRSync(const QString& fn) const;
- QString getMachine() const;
- void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const;
-};
-
-class RemoteFileLoader : public FileLoader
-{
-public:
- RemoteFileLoader(const QString& machine,const QString& dirName):FileLoader(dirName),_machine(machine) { }
- bool load(DirDataStructure *parent) const;
- void fillArgs(const QString& dn, QString& prg, QStringList& args) const;
- QString prettyPrint() const;
- QString entryForRSync(const QString& fn) const;
- QString getMachine() const;
- void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const;
-private:
- QString _machine;
-};
-
-class SelectionMimeData : public QMimeData
-{
- Q_OBJECT
-public:
- SelectionMimeData(const QModelIndexList& los):_los(los) { }
- const QModelIndexList& getSelection() const { return _los; }
-private:
- QModelIndexList _los;
-};
-
-class QRemoteFileSystemModel : public QAbstractItemModel
-{
- Q_OBJECT
-public:
- QRemoteFileSystemModel(QObject *parent, FileLoader *fl);
- QRemoteFileSystemModel(QObject *parent, TopDirDataStructure *fds);
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- QModelIndex parent(const QModelIndex&) const;
- QModelIndex index(int, int, const QModelIndex&) const;
- int rowCount(const QModelIndex&) const;
- int columnCount(const QModelIndex&) const;
- QVariant data(const QModelIndex&, int) const;
- void emitResetModel();
- FileLoader *getLoader() const { return _fds->getLoader(); }
- bool isOK() const { return _fds->isOK(); }
- QString getMachine() const { return _fds->getMachine(); }
-private:
- TopDirDataStructure *_fds;
-};
-
-#endif
//
// Author : Anthony GEAY (EDF R&D)
-#include "QRemoteFileBrowser"
-#include "QMachineBrowser"
-#include "QRemoteCopyWidget"
+#include "QRemoteFileBrowser.h"
+#include "QMachineBrowser.h"
+#include "QRemoteCopyWidget.h"
#include "QDirModel"
#include "QFileSystemModel"
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#ifndef __QREMOTEFILEBROWSER__
+#define __QREMOTEFILEBROWSER__
+
+#include "RemoteFileBrowser.h"
+
+#include "QWidget"
+#include "QTreeView"
+#include "QMimeData"
+#include "QThread"
+
+class AnotherTreeView;
+class QMachineBrowser;
+class QRemoteFileSystemModel;
+class TopDirDataStructure;
+
+class QREMOTEFILEBROWSER_EXPORT LoadingThread : public QThread
+{
+ Q_OBJECT
+public:
+ LoadingThread(QThread *th, QMachineBrowser *mb):_fatherThread(th),_mb(mb),_model(nullptr) { }
+ void setGeneratedModel(QRemoteFileSystemModel *model) { _model=model; }
+ QRemoteFileSystemModel *generatedModel() const { return _model; }
+signals:
+ void letsGenerateModel(TopDirDataStructure *fds);
+protected:
+ void run();
+private:
+ QThread *_fatherThread;
+ QMachineBrowser *_mb;
+ QRemoteFileSystemModel *_model;
+};
+
+class QREMOTEFILEBROWSER_EXPORT QRemoteFileBrowser : public QWidget
+{
+ Q_OBJECT
+public:
+ QRemoteFileBrowser(QWidget *parent);
+ QMachineBrowser *machineBrower() const { return _mb; }
+public slots:
+ void onLocationChanged();
+ void locationHasBeenChanged();
+private:
+ AnotherTreeView *_treeView;
+ QMachineBrowser *_mb;
+};
+
+class QREMOTEFILEBROWSER_EXPORT QRemoteFileTransfer : public QWidget
+{
+public:
+ QRemoteFileTransfer(QWidget *parent=0);
+private:
+ QRemoteFileBrowser *_left;
+ QRemoteFileBrowser *_right;
+};
+
+class DirDataStructure;
+class TopDirDataStructure;
+
+class QREMOTEFILEBROWSER_EXPORT DataStructure : public QObject
+{
+ Q_OBJECT
+public:
+ DataStructure(QObject *parent, const QString& name):QObject(parent),_name(name),_selected(false) { }
+ void select() { _selected=true; }
+ void unselect() { _selected=false; }
+ bool isSelected() const { return _selected; }
+ virtual bool isFile() const = 0;
+ virtual QString nameOnDrop() const = 0;
+ const DirDataStructure *getDirParent() const;
+ bool isRoot() const { return getDirParent()==NULL; }
+ const TopDirDataStructure *getRoot() const;
+ std::vector<const DataStructure *> getItermediateElts(const TopDirDataStructure *tpds) const;
+ virtual int size() const = 0;
+ QString entryForRSyncSrc() const;
+ virtual QString entryForRSyncDest() const = 0;
+ QString name() const;
+ const QString& fullName() const { return _name; }
+ void removeFileArgs(QString& prg, QStringList& args) const;
+private:
+ QString _name;
+ bool _selected;
+};
+
+class QREMOTEFILEBROWSER_EXPORT FileDataStructure : public DataStructure
+{
+public:
+ FileDataStructure(DirDataStructure *dds, const QString& name);
+ bool isFile() const { return true; }
+ int size() const { return 0; }
+ QString entryForRSyncDest() const;
+ QString nameOnDrop() const;
+};
+
+class QREMOTEFILEBROWSER_EXPORT DirDataStructure : public DataStructure
+{
+public:
+ DirDataStructure(DirDataStructure *dds, const QString& name):DataStructure(dds,name),_is_loaded(false),_is_expanded(false) { }
+ DirDataStructure(QObject *dds, const QString& name):DataStructure(dds,name),_is_loaded(false) { }
+ bool isFile() const { return false; }
+ int size() const { load(); return children().size(); }
+ QString entryForRSyncDest() const;
+ QString nameOnDrop() const { return name(); }
+ const DataStructure *operator[](int pos) const;
+ int posOf(const DataStructure *ds) const;
+ bool load() const;
+ void markAsLoaded() const { _is_loaded=true; }
+ void setExpanded(bool status) { _is_expanded=status; }
+ bool isExpanded() const { return _is_expanded; }
+private:
+ mutable bool _is_loaded;
+ mutable bool _is_expanded;
+};
+
+class FileLoader;
+
+class QREMOTEFILEBROWSER_EXPORT TopDirDataStructure : public DirDataStructure
+{
+public:
+ TopDirDataStructure(QObject *dds, FileLoader *fl);
+ virtual ~TopDirDataStructure();
+ FileLoader *getLoader() const { return _fl; }
+ bool isOK() const { return _isOK; }
+ QString entryForRSync(const QString& fn) const;
+ QString getMachine() const;
+ void removeFileArgsImpl(const QString& filePath, QString& prg, QStringList& args) const;
+private:
+ FileLoader *_fl;
+ bool _isOK;
+};
+
+class QRemoteFileSystemModel;
+
+class QREMOTEFILEBROWSER_EXPORT MyTreeView : public QTreeView
+{
+ Q_OBJECT
+public:
+ MyTreeView(QWidget *parent);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void keyPressEvent(QKeyEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dragLeaveEvent(QDragLeaveEvent *event);
+ void dropEvent(QDropEvent *event);
+ QRemoteFileSystemModel *zeModel();
+ void emitResetModel();
+public slots:
+ void itemExpanded(const QModelIndex &index);
+ void itemCollapsed(const QModelIndex &index);
+signals:
+ void somethingChangedDueToFileModif();
+private:
+ void itemExpandedStatus(const QModelIndex &index, bool status);
+ void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const;
+ void paintEvent(QPaintEvent *event);
+private:
+ QPoint _start_pos;
+ // during drag drop _sel is the element under the mouse on the drop site
+ DataStructure *_sel;
+ // during drag drop _slider_pos is the pos of vertical slider on drop site
+ int _slider_pos;
+};
+
+class AnotherTreeView;
+
+class QREMOTEFILEBROWSER_EXPORT AnotherTreeViewPainter
+{
+public:
+ virtual void paint(AnotherTreeView *atv, QPaintEvent *event) const = 0;
+};
+
+class QREMOTEFILEBROWSER_EXPORT AnotherTreeViewWaitPainter : public AnotherTreeViewPainter
+{
+public:
+ void paint(AnotherTreeView *atv, QPaintEvent *event) const;
+};
+
+class QREMOTEFILEBROWSER_EXPORT AnotherTreeViewNothingPainter : public AnotherTreeViewPainter
+{
+public:
+ void paint(AnotherTreeView *atv, QPaintEvent *event) const;
+};
+
+class QREMOTEFILEBROWSER_EXPORT AnotherTreeView : public QWidget
+{
+ Q_OBJECT
+public:
+ AnotherTreeView(QWidget *parent);
+ void generateModel(QMachineBrowser *mb);
+ QSize sizeHint() const;
+ QSize minimumSizeHint() const;
+ int getAngle() const { return _angle; }
+ ~AnotherTreeView();
+public slots:
+ void goGenerate(TopDirDataStructure *fds);
+ void modelHasBeenGenerated();
+signals:
+ void modelHasBeenGeneratedSignal(bool isOK);
+ void somethingChangedDueToFileModif();
+protected:
+ void paintEvent(QPaintEvent *event);
+ void timerEvent(QTimerEvent *e);
+private:
+ int _timerId;
+ int _angle;
+ AnotherTreeViewPainter *_painter;
+ MyTreeView *_tw;
+ LoadingThread *_th;
+};
+
+class QREMOTEFILEBROWSER_EXPORT FileLoader
+{
+protected:
+ FileLoader(const QString& dirName):_dirName(dirName) { }
+public:
+ QString getDirName() const { return _dirName; }
+ virtual bool load(DirDataStructure *parent) const = 0;
+ virtual QString prettyPrint() const = 0;
+ virtual QString entryForRSync(const QString& fn) const = 0;
+ virtual QString getMachine() const = 0;
+ virtual void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const = 0;
+ virtual ~FileLoader() { }
+private:
+ QString _dirName;
+};
+
+class QREMOTEFILEBROWSER_EXPORT LocalFileLoader : public FileLoader
+{
+public:
+ LocalFileLoader(const QString& dirName):FileLoader(dirName) { }
+ bool load(DirDataStructure *parent) const;
+ void fillArgs(const QString& dn, QString& prg, QStringList& args) const;
+ QString prettyPrint() const;
+ QString entryForRSync(const QString& fn) const;
+ QString getMachine() const;
+ void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const;
+};
+
+class QREMOTEFILEBROWSER_EXPORT RemoteFileLoader : public FileLoader
+{
+public:
+ RemoteFileLoader(const QString& machine,const QString& dirName):FileLoader(dirName),_machine(machine) { }
+ bool load(DirDataStructure *parent) const;
+ void fillArgs(const QString& dn, QString& prg, QStringList& args) const;
+ QString prettyPrint() const;
+ QString entryForRSync(const QString& fn) const;
+ QString getMachine() const;
+ void removeFileArgs(const QString& filePath, QString& prg, QStringList& args) const;
+private:
+ QString _machine;
+};
+
+class QREMOTEFILEBROWSER_EXPORT SelectionMimeData : public QMimeData
+{
+ Q_OBJECT
+public:
+ SelectionMimeData(const QModelIndexList& los):_los(los) { }
+ const QModelIndexList& getSelection() const { return _los; }
+private:
+ QModelIndexList _los;
+};
+
+class QREMOTEFILEBROWSER_EXPORT QRemoteFileSystemModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ QRemoteFileSystemModel(QObject *parent, FileLoader *fl);
+ QRemoteFileSystemModel(QObject *parent, TopDirDataStructure *fds);
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex parent(const QModelIndex&) const;
+ QModelIndex index(int, int, const QModelIndex&) const;
+ int rowCount(const QModelIndex&) const;
+ int columnCount(const QModelIndex&) const;
+ QVariant data(const QModelIndex&, int) const;
+ void emitResetModel();
+ FileLoader *getLoader() const { return _fds->getLoader(); }
+ bool isOK() const { return _fds->isOK(); }
+ QString getMachine() const { return _fds->getMachine(); }
+private:
+ TopDirDataStructure *_fds;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#if !defined ( REMOTE_FILE_BROWSER_H )
+#define REMOTE_FILE_BROWSER_H
+
+// ========================================================
+// set dllexport type for Win platform
+#ifdef WIN32
+# if defined QREMOTEFILEBROWSER_EXPORTS || defined qremotefilebrowser_EXPORTS
+# define QREMOTEFILEBROWSER_EXPORT __declspec(dllexport)
+# else
+# define QREMOTEFILEBROWSER_EXPORT __declspec(dllimport)
+# endif
+#else // WIN32
+# define PYINTERP_EXPORT
+#endif // WIN32
+
+#endif //REMOTE_FILE_BROWSER_H
\ No newline at end of file
// Author : Anthony GEAY (EDF R&D)
#include "QApplication"
-#include "QRemoteFileBrowser"
+#include "QRemoteFileBrowser.h"
int main(int argc, char *argv[])
{