Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luis Penaranda
panoramic
Commits
849dfe2d
Commit
849dfe2d
authored
May 14, 2013
by
Luis Penaranda
Browse files
improved file chooser dialog
parent
80e0504b
Changes
3
Hide whitespace changes
Inline
Side-by-side
image_read.cpp
View file @
849dfe2d
...
...
@@ -62,6 +62,8 @@ unsigned char *FileRead::read_image(const char *new_image,int *width,int *height
return
NULL
;
}
const
char
*
FileRead
::
image_types
=
"All images (*.png *.jpg *.jpeg *.pnm *.pbm *.pgm *.ppm);;PNG images (*.png);;JPG images (*.jpg *.jpeg);;PBM images (*.pnm *.pbm *.pgm *.ppm);;All files (*)"
;
unsigned
char
*
FileRead
::
jpgRead
(
const
char
*
texturePath
,
int
*
outImageWidth
,
int
*
outImageHeight
){
...
...
image_read.h
View file @
849dfe2d
...
...
@@ -28,6 +28,7 @@ class FileRead{
static
enum
FileType
get_file_type
(
const
char
*
);
protected:
static
unsigned
char
*
read_image
(
const
char
*
,
int
*
,
int
*
);
static
const
char
*
image_types
;
private:
static
unsigned
char
*
jpgRead
(
const
char
*
,
int
*
,
int
*
);
static
unsigned
char
*
pngRead
(
const
char
*
,
int
*
,
int
*
);
...
...
openglcanvas.cpp
View file @
849dfe2d
...
...
@@ -279,8 +279,11 @@ void OpenGLCanvas::load_image(const char *new_image){
}
void
OpenGLCanvas
::
change_input_image
(){
load_image
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
)).
toStdString
().
c_str
());
updateGL
();
const
char
*
fname
=
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
),
""
,
FileRead
::
image_types
).
toStdString
().
c_str
();
if
(
strlen
(
fname
)
>
0
){
load_image
(
fname
);
updateGL
();
}
}
void
OpenGLCanvas
::
initializeGL
(){
...
...
@@ -305,7 +308,7 @@ void OpenGLCanvas::initializeGL(){
// If the input file does not exist or was not specified.
struct
stat
testbuf
;
if
(
stat
(
input_image_file
,
&
testbuf
)
||!
strcmp
(
input_image_file
,
""
)){
load_image
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
)).
toStdString
().
c_str
());
load_image
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
)
,
""
,
FileRead
::
image_types
).
toStdString
().
c_str
());
}
else
{
load_image
(
input_image_file
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment