|
@@ -3,48 +3,22 @@
|
|
|
|
|
|
#include <limits.h>
|
|
#include <limits.h>
|
|
|
|
|
|
-//#include "tinyfiledialogs.h"
|
|
|
|
-
|
|
|
|
-namespace{
|
|
|
|
-
|
|
|
|
- bbString pexec( bbString cmd ){
|
|
|
|
-
|
|
|
|
- FILE *f=popen( cmd.c_str(),"r" );
|
|
|
|
- if( !f ) return "";
|
|
|
|
-
|
|
|
|
- char buf[PATH_MAX];
|
|
|
|
- int n=fread( buf,1,PATH_MAX,f );
|
|
|
|
- pclose( f );
|
|
|
|
-
|
|
|
|
- if( n<0 || n>PATH_MAX ) return "";
|
|
|
|
-
|
|
|
|
- while( n && buf[n-1]<=32 ) --n;
|
|
|
|
-
|
|
|
|
- return bbString::fromCString( buf,n );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+#include "tinyfiledialogs.h"
|
|
|
|
|
|
void bbRequesters::Notify( bbString title,bbString text,bbBool serious ){
|
|
void bbRequesters::Notify( bbString title,bbString text,bbBool serious ){
|
|
|
|
|
|
- bbString cmd=BB_T( "kdialog --title \"" )+title+"\"";
|
|
|
|
- if( serious ) cmd+=" --error"; else cmd+=" --msgbox";
|
|
|
|
- cmd+=BB_T( " \"" ) + text + "\"";
|
|
|
|
-
|
|
|
|
- system( cmd.c_str() );
|
|
|
|
|
|
+ tinyfd_messageBox( bbCString( title ),bbCString( text ),"ok",serious ? "error" : "info",1 );
|
|
}
|
|
}
|
|
|
|
|
|
bbBool bbRequesters::Confirm( bbString title,bbString text,bbBool serious ){
|
|
bbBool bbRequesters::Confirm( bbString title,bbString text,bbBool serious ){
|
|
|
|
|
|
- bbString cmd=BB_T( "kdialog --title \"" )+title+"\" --yesno \""+text+"\"";
|
|
|
|
-
|
|
|
|
- int result=system( cmd.c_str() );
|
|
|
|
-
|
|
|
|
- return result==0;
|
|
|
|
|
|
+ return tinyfd_messageBox( bbCString( title ),bbCString( text ),"okcancel",serious ? "error" : "info",1 );
|
|
}
|
|
}
|
|
|
|
|
|
bbInt bbRequesters::Proceed( bbString title,bbString text,bbBool serious ){
|
|
bbInt bbRequesters::Proceed( bbString title,bbString text,bbBool serious ){
|
|
|
|
|
|
|
|
+ // Ok, no yesnocancal in tinyfd so we'll use kdialog...
|
|
|
|
+
|
|
bbString cmd=BB_T( "kdialog --title \"" )+title+"\" --yesnocancel \""+text+"\"";
|
|
bbString cmd=BB_T( "kdialog --title \"" )+title+"\" --yesnocancel \""+text+"\"";
|
|
|
|
|
|
int result=system( cmd.c_str() );
|
|
int result=system( cmd.c_str() );
|
|
@@ -57,31 +31,15 @@ bbInt bbRequesters::Proceed( bbString title,bbString text,bbBool serious ){
|
|
bbString bbRequesters::RequestFile( bbString title,bbString exts,bbBool save,bbString path ){
|
|
bbString bbRequesters::RequestFile( bbString title,bbString exts,bbBool save,bbString path ){
|
|
|
|
|
|
if( path=="" ) path=".";
|
|
if( path=="" ) path=".";
|
|
-
|
|
|
|
- // kdialog
|
|
|
|
- //
|
|
|
|
- bbString cmd=save ? "kdialog --getsavefilename" : "kdialog --getopenfilename";
|
|
|
|
- cmd+=BB_T( " \"" )+path+"\"";
|
|
|
|
-
|
|
|
|
- // zenity
|
|
|
|
- //
|
|
|
|
- // bbString cmd=BB_T("zenity --modal --display=:0 --title=\"")+title+BB_T("\" --file-selection");
|
|
|
|
- // if( save ) cmd+=" --save";
|
|
|
|
-
|
|
|
|
- return pexec( cmd );
|
|
|
|
|
|
+
|
|
|
|
+ return tinyfd_openFileDialog( bbCString( title ),bbCString( path ),0,0,0,0 );
|
|
}
|
|
}
|
|
|
|
|
|
bbString bbRequesters::RequestDir( bbString title,bbString dir ){
|
|
bbString bbRequesters::RequestDir( bbString title,bbString dir ){
|
|
|
|
|
|
if( dir=="" ) dir=".";
|
|
if( dir=="" ) dir=".";
|
|
-
|
|
|
|
- bbString cmd="kdialog --getexistingdirectory \""+dir+"\"";
|
|
|
|
-
|
|
|
|
- // zenity
|
|
|
|
- //
|
|
|
|
- // bbString cmd=BB_T("zenity --modal --title=\"")+title+BB_T("\" --file-selection --directory");
|
|
|
|
-
|
|
|
|
- return pexec( cmd );
|
|
|
|
|
|
+
|
|
|
|
+ return tinyfd_selectFolderDialog( bbCString( title ),bbCString( dir ) );
|
|
}
|
|
}
|
|
|
|
|
|
void bbRequesters::OpenUrl( bbString url ){
|
|
void bbRequesters::OpenUrl( bbString url ){
|