OpendTect-6_4  6.4
uifiledlg.h
Go to the documentation of this file.
1 #ifndef uifiledlg_h
2 #define uifiledlg_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Lammertink
9  Date: 21/09/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "bufstringset.h"
17 #include "uistring.h"
18 
19 class uiParent;
20 class FileMultiString;
21 
26 { mODTextTranslationClass(uiFileDialog);
27 public:
29  enum Mode
30  {
33  Directory,
35  DirectoryOnly,
37  ExistingFiles
38  };
39 
40 
41  uiFileDialog(uiParent*,bool forread,
42  const char* fname=0,
43  const char* filter=0,
44  const uiString& caption=uiString::emptyString());
45 
46  uiFileDialog(uiParent*,Mode mode=AnyFile,
47  const char* fname=0,
48  const char* filter=0,
49  const uiString& caption=uiString::emptyString());
50  enum Type { Gen, Img, Txt, Html };
51  uiFileDialog(uiParent*,Type,
52  const char* fname=0,
53  const uiString& caption=uiString::emptyString());
55 
56  const char* fileName() const { return fn; }
57  void getFileNames(BufferStringSet&) const;
58 
59  void setMode( Mode m) { mode_=m; }
60  Mode mode() const { return mode_; }
61 
62  void setSelectedFilter(const char* fltr)
63  { selectedfilter_ = fltr; }
64  const char* selectedFilter() const { return selectedfilter_; }
65 
66  void setDirectory( const char* dir )
67  { currentdir_ = dir; }
68 
69  void setAllowAllExts( bool yn ) { addallexts_ = yn; }
71  void setConfirmOverwrite( bool yn )
72  { confirmoverwrite_ = yn; }
73 
74  void setDefaultExtension(const char*);
75  const char* getDefaultExtension() const;
76 
77  int go();
78 
79  static const char* filesep_;
80 
81  static void list2String(const BufferStringSet&,
82  BufferString&);
83  static void string2List(const BufferString&,
85 
86  // To be used by cmddriver to select filename(s)
87  // while closing the QFileDialog
88  int processExternalFilenames(const char* dir=0,
89  const char* filters=0);
90  static void setExternalFilenames(const FileMultiString&);
91  static const char* getExternalFilenamesErrMsg();
92  // Warning starts with '!'-symbol
93 
94 protected:
95 
106  bool forread_;
109 
112 
113 private:
114  void setDefaultCaption();
115  int beginCmdRecEvent( const char* wintitle );
116  void endCmdRecEvent(int refnr, bool ok);
117 };
118 
119 #endif
#define mExpClass(module)
Definition: commondefs.h:160
BufferString defaultextension_
Definition: uifiledlg.h:108
static BufferString extfilenameserrmsg_
Definition: uifiledlg.h:111
BufferString currentdir_
Definition: uifiledlg.h:104
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
BufferStringSet filenames_
Definition: uifiledlg.h:102
void setDirectory(const char *dir)
Definition: uifiledlg.h:66
static const uiString & emptyString()
Definition: uistring.h:109
Definition: uistring.h:89
BufferString filter_
Definition: uifiledlg.h:99
Definition: uiparent.h:26
Set of BufferString objects.
Definition: bufstringset.h:28
const char * fileName() const
Definition: uifiledlg.h:56
Type
Definition: uifiledlg.h:50
uiParent * parnt_
Definition: uifiledlg.h:101
Mode mode() const
Definition: uifiledlg.h:60
SeparString with backquotes as separators, use in most ascii files.
Definition: separstr.h:119
BufferString fn
Definition: uifiledlg.h:96
void setSelectedFilter(const char *fltr)
Definition: uifiledlg.h:62
BufferString fname_
Definition: uifiledlg.h:98
const char * selectedFilter() const
Definition: uifiledlg.h:64
bool forread_
Definition: uifiledlg.h:106
uiString caption_
Definition: uifiledlg.h:100
Definition: uifiledlg.h:31
Mode mode_
Definition: uifiledlg.h:97
bool confirmoverwrite_
Definition: uifiledlg.h:107
Dialog to get a file or directory name from user.
Definition: uifiledlg.h:25
void setConfirmOverwrite(bool yn)
Definition: uifiledlg.h:71
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
static FileMultiString * externalfilenames_
Definition: uifiledlg.h:110
Definition: uifiledlg.h:32
bool addallexts_
Definition: uifiledlg.h:105
void setAllowAllExts(bool yn)
default true for read, false for write
Definition: uifiledlg.h:69
Mode
File selection mode.
Definition: uifiledlg.h:29
static const char * filesep_
Definition: uifiledlg.h:79
BufferString selectedfilter_
Definition: uifiledlg.h:103
void setMode(Mode m)
Definition: uifiledlg.h:59

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019