23 #if defined (HAVE_CONFIG_H) 27 #include <QApplication> 29 #include <QFileDialog> 58 qRegisterMetaType<graphics_object> (
"graphics_object");
74 error (
"__init_qt__: QApplication object must exist.");
118 "__init_qt__.cc",
"")));
123 "__init_qt__.cc",
"")));
129 makeFilterSpecs (
const Cell& filters)
133 QStringList filterSpecs;
134 QRegExp parenRe (
" ?\\(.*\\)\\s*$");
136 for (
int i = 0;
i < filters.
rows ();
i++)
138 QStringList extList =
140 QString desc =
fromStdString (filters(
i, 1).string_value ()).trimmed ();
143 if (desc.contains (parenRe))
148 desc.remove (parenRe);
151 specItem = QString (
"%1 (%2)").arg (desc).arg (extList.join (
" "));
153 filterSpecs.append (specItem);
160 appendDirSep (
const QString&
d)
162 if (!
d.endsWith (
"/") && !
d.endsWith (QDir::separator ()))
167 DEFUN (__uigetfile_qt__, args, ,
"")
182 QString defaultDirectory =
fromStdString (args(5).string_value ());
183 QString defaultFileName =
fromStdString (args(2).string_value ());
184 bool isMultiSelect = (args(4).string_value () ==
"on");
193 if (defaultFileName.isEmpty ())
194 defaultFileName = defaultDirectory;
196 defaultFileName = defaultDirectory +
'/' + defaultFileName;
198 QStringList filterSpecs = makeFilterSpecs (args(0).cell_value ());
204 QFileDialog::getOpenFileNames (0, caption, defaultFileName,
205 filterSpecs.join (
";;"), &
filter, 0);
207 if (!
files.isEmpty ())
213 foreach (
const QString&
s,
files)
217 if (dirName.isEmpty ())
218 dirName = appendDirSep (
fi.canonicalPath ());
225 retval(2) =
static_cast<double> (filterSpecs.indexOf (
filter) + 1);
232 QFileDialog::getOpenFileName (0, caption, defaultFileName,
233 filterSpecs.join (
";;"), &
filter, 0);
235 if (! fileName.isNull ())
237 QFileInfo
fi (fileName);
242 retval(2) =
static_cast<double> (filterSpecs.indexOf (
filter) + 1);
249 DEFUN (__uiputfile_qt__, args, ,
"")
264 QString defaultDirectory =
fromStdString (args(5).string_value ());
265 QString defaultFileName =
fromStdString (args(2).string_value ());
271 if (defaultFileName.isEmpty ())
272 defaultFileName = defaultDirectory;
274 defaultFileName = defaultDirectory +
'/' + defaultFileName;
276 QStringList filterSpecs = makeFilterSpecs (args(0).cell_value ());
280 QFileDialog::getSaveFileName (0, caption, defaultFileName,
281 filterSpecs.join (
";;"), &
filter, 0);
283 if (! fileName.isNull ())
285 QFileInfo
fi (fileName);
293 retval(2) =
static_cast<double> (filterSpecs.indexOf (
filter) + 1);
299 DEFUN (__uigetdir_qt__, args, ,
"")
310 QString defaultDirectory =
fromStdString (args(0).string_value ());
312 QString dirName = QFileDialog::getExistingDirectory (0, caption,
315 if (! dirName.isNull ())
octave_idx_type rows(void) const
OCTAVE_EXPORT octave_value_list F__init_qt__(octave::interpreter &interp, const octave_value_list &, int)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
void load_toolkit(const graphics_toolkit &tk)
void install_built_in_function(const std::string &name, const octave_value &fcn)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
QString fromStdString(const std::string &s)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
gtk_manager & get_gtk_manager(void)
void install___init_qt___functions(octave::symbol_table &symtab)
static bool qtHandlesInitialized
MArray< T > filter(MArray< T > &b, MArray< T > &a, MArray< T > &x, MArray< T > &si, int dim=0)
static void enable_event_processing(bool enable=true)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
OCTAVE_EXPORT octave_value_list F__shutdown_qt__(const octave_value_list &, int)
bool __init__(octave::interpreter &interp)
otherwise an error message is printed The permission mask is a UNIX concept used when creating new objects on a file system such as files
static void add_atexit_function(const std::string &fname)
std::string toStdString(const QString &s)