Formatted all .cc and .h code in rtengine, rtexif and rtgui using astyle
This commit is contained in:
136
rtgui/extprog.cc
136
rtgui/extprog.cc
@@ -7,7 +7,7 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* RawTherapee 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
|
||||
@@ -34,18 +34,22 @@ using namespace std;
|
||||
|
||||
ExtProgAction::ExtProgAction() {}
|
||||
|
||||
ExtProgAction::ExtProgAction(const ExtProgAction* other, int target)
|
||||
ExtProgAction::ExtProgAction(const ExtProgAction* other, int target)
|
||||
: target(target), filePathEXE(other->filePathEXE), preparams(other->preparams), name(other->name) { }
|
||||
|
||||
Glib::ustring ExtProgAction::GetFullName() {
|
||||
return name+ " [" + M(Glib::ustring::compose("EXTPROGTARGET_%1", target)) + "]";
|
||||
Glib::ustring ExtProgAction::GetFullName()
|
||||
{
|
||||
return name + " [" + M(Glib::ustring::compose("EXTPROGTARGET_%1", target)) + "]";
|
||||
}
|
||||
|
||||
bool ExtProgAction::Execute(std::vector<Glib::ustring> fileNames) {
|
||||
if (fileNames.empty()) return false;
|
||||
bool ExtProgAction::Execute(std::vector<Glib::ustring> fileNames)
|
||||
{
|
||||
if (fileNames.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if they all exists (maybe not precessed yet)
|
||||
for (int i=0;i<fileNames.size();i++) {
|
||||
for (int i = 0; i < fileNames.size(); i++) {
|
||||
if (!safe_file_test(fileNames[i], Glib::FILE_TEST_EXISTS)) {
|
||||
Gtk::MessageDialog msgd (M("MAIN_MSG_IMAGEUNPROCESSED"), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||
msgd.run ();
|
||||
@@ -53,10 +57,15 @@ bool ExtProgAction::Execute(std::vector<Glib::ustring> fileNames) {
|
||||
}
|
||||
}
|
||||
|
||||
Glib::ustring cmdLine="\"" + filePathEXE + "\"";
|
||||
if (preparams.length()>0) cmdLine += " " + preparams;
|
||||
Glib::ustring cmdLine = "\"" + filePathEXE + "\"";
|
||||
|
||||
for (int i=0;i<fileNames.size();i++) cmdLine += " \"" + fileNames[i] + "\"";
|
||||
if (preparams.length() > 0) {
|
||||
cmdLine += " " + preparams;
|
||||
}
|
||||
|
||||
for (int i = 0; i < fileNames.size(); i++) {
|
||||
cmdLine += " \"" + fileNames[i] + "\"";
|
||||
}
|
||||
|
||||
return safe_spawn_command_line_async (cmdLine);
|
||||
}
|
||||
@@ -66,24 +75,29 @@ bool ExtProgAction::Execute(std::vector<Glib::ustring> fileNames) {
|
||||
ExtProgStore* ExtProgStore::getInstance()
|
||||
{
|
||||
static ExtProgStore* instance_ = 0;
|
||||
if ( instance_ == 0 )
|
||||
{
|
||||
|
||||
if ( instance_ == 0 ) {
|
||||
static MyMutex smutex_;
|
||||
MyMutex::MyLock lock(smutex_);
|
||||
if ( instance_ == 0 )
|
||||
{
|
||||
|
||||
if ( instance_ == 0 ) {
|
||||
instance_ = new ExtProgStore();
|
||||
}
|
||||
}
|
||||
|
||||
return instance_;
|
||||
}
|
||||
|
||||
ExtProgStore::~ExtProgStore() {
|
||||
for (list<ExtProgAction*>::iterator it=lActions.begin();it!=lActions.end();it++) delete *it;
|
||||
ExtProgStore::~ExtProgStore()
|
||||
{
|
||||
for (list<ExtProgAction*>::iterator it = lActions.begin(); it != lActions.end(); it++) {
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
|
||||
// Reads all profiles from the given profiles dir
|
||||
void ExtProgStore::init () {
|
||||
void ExtProgStore::init ()
|
||||
{
|
||||
MyMutex::MyLock lock(mtx);
|
||||
|
||||
lActions.clear();
|
||||
@@ -99,11 +113,12 @@ void ExtProgStore::init () {
|
||||
SearchProg("FastStone Image Viewer", "FastStone Image Viewer\\FSViewer.exe", "", 0, true, true);
|
||||
SearchProg("FastPictureViewer", "FastPictureViewer\\FastPictureViewer.exe", "", 0, true, true);
|
||||
|
||||
if (!SearchProg("Autopano Giga 3", "Kolor\\Autopano Giga 3.%1\\AutopanoGiga_x64.exe", "Kolor\\Autopano Giga 3.%1\\AutopanoGiga.exe", 15, true, true)){
|
||||
if ( !SearchProg("Autopano Pro 3", "Kolor\\Autopano Pro 3.%1\\AutopanoPro_x64.exe", "Kolor\\Autopano Pro 3.%1\\AutopanoPro.exe", 15, true, true)) {
|
||||
if (!SearchProg("Autopano Giga 2", "Kolor\\Autopano Giga 2.%1\\AutopanoGiga_x64.exe", "Kolor\\Autopano Giga 2.%1\\AutopanoGiga.exe", 6, true, true))
|
||||
SearchProg("Autopano Pro 2", "Kolor\\Autopano Pro 2.%1\\AutopanoPro_x64.exe", "Kolor\\Autopano Pro 2.%1\\AutopanoPro.exe", 6, true, true);
|
||||
}
|
||||
if (!SearchProg("Autopano Giga 3", "Kolor\\Autopano Giga 3.%1\\AutopanoGiga_x64.exe", "Kolor\\Autopano Giga 3.%1\\AutopanoGiga.exe", 15, true, true)) {
|
||||
if ( !SearchProg("Autopano Pro 3", "Kolor\\Autopano Pro 3.%1\\AutopanoPro_x64.exe", "Kolor\\Autopano Pro 3.%1\\AutopanoPro.exe", 15, true, true)) {
|
||||
if (!SearchProg("Autopano Giga 2", "Kolor\\Autopano Giga 2.%1\\AutopanoGiga_x64.exe", "Kolor\\Autopano Giga 2.%1\\AutopanoGiga.exe", 6, true, true)) {
|
||||
SearchProg("Autopano Pro 2", "Kolor\\Autopano Pro 2.%1\\AutopanoPro_x64.exe", "Kolor\\Autopano Pro 2.%1\\AutopanoPro.exe", 6, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT add obscure little tools here, only widely used programs with proper setup program to have a standard path
|
||||
@@ -111,63 +126,82 @@ void ExtProgStore::init () {
|
||||
|
||||
}
|
||||
|
||||
bool ExtProgStore::SearchProg(Glib::ustring name, Glib::ustring exePath, Glib::ustring exePath86, int maxVer, bool allowRaw, bool allowQueueProcess) {
|
||||
bool found=false;
|
||||
bool ExtProgStore::SearchProg(Glib::ustring name, Glib::ustring exePath, Glib::ustring exePath86, int maxVer, bool allowRaw, bool allowQueueProcess)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
#ifdef WIN32
|
||||
// get_user_special_dir crashes on some Windows configurations.
|
||||
// so we use the safe native functions here
|
||||
static Glib::ustring progFilesDir,progFilesDirx86;
|
||||
static Glib::ustring progFilesDir, progFilesDirx86;
|
||||
|
||||
if (progFilesDir.empty()) {
|
||||
WCHAR pathW[MAX_PATH]={0}; char pathA[MAX_PATH];
|
||||
WCHAR pathW[MAX_PATH] = {0};
|
||||
char pathA[MAX_PATH];
|
||||
|
||||
// First prio folder (64bit, otherwise 32bit)
|
||||
if (SHGetSpecialFolderPathW(NULL,pathW,CSIDL_PROGRAM_FILES,false)) {
|
||||
if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_PROGRAM_FILES, false)) {
|
||||
char pathA[MAX_PATH];
|
||||
WideCharToMultiByte(CP_UTF8,0,pathW,-1,pathA,MAX_PATH,0,0);
|
||||
progFilesDir=Glib::ustring(pathA);
|
||||
}
|
||||
WideCharToMultiByte(CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0);
|
||||
progFilesDir = Glib::ustring(pathA);
|
||||
}
|
||||
|
||||
if (SHGetSpecialFolderPathW(NULL,pathW,CSIDL_PROGRAM_FILESX86,false)) {
|
||||
WideCharToMultiByte(CP_UTF8,0,pathW,-1,pathA,MAX_PATH,0,0);
|
||||
progFilesDirx86=Glib::ustring(pathA);
|
||||
if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_PROGRAM_FILESX86, false)) {
|
||||
WideCharToMultiByte(CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0);
|
||||
progFilesDirx86 = Glib::ustring(pathA);
|
||||
}
|
||||
}
|
||||
|
||||
if (exePath86.empty()) exePath86=exePath;
|
||||
if (exePath86.empty()) {
|
||||
exePath86 = exePath;
|
||||
}
|
||||
|
||||
ExtProgAction *pAct=new ExtProgAction();
|
||||
pAct->name=name;
|
||||
pAct->target= (allowRaw?1:2);
|
||||
ExtProgAction *pAct = new ExtProgAction();
|
||||
pAct->name = name;
|
||||
pAct->target = (allowRaw ? 1 : 2);
|
||||
|
||||
if (maxVer>0) {
|
||||
for (int verNo=maxVer;verNo>=0;verNo--) {
|
||||
pAct->filePathEXE=progFilesDir+"\\"+Glib::ustring::compose(exePath,verNo);
|
||||
if (safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) break;
|
||||
if (maxVer > 0) {
|
||||
for (int verNo = maxVer; verNo >= 0; verNo--) {
|
||||
pAct->filePathEXE = progFilesDir + "\\" + Glib::ustring::compose(exePath, verNo);
|
||||
|
||||
pAct->filePathEXE=progFilesDirx86+"\\"+Glib::ustring::compose(exePath86,verNo);
|
||||
if (safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) break;
|
||||
if (safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
pAct->filePathEXE="";
|
||||
pAct->filePathEXE = progFilesDirx86 + "\\" + Glib::ustring::compose(exePath86, verNo);
|
||||
|
||||
if (safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
pAct->filePathEXE = "";
|
||||
}
|
||||
} else {
|
||||
pAct->filePathEXE=progFilesDir+"\\"+exePath;
|
||||
pAct->filePathEXE = progFilesDir + "\\" + exePath;
|
||||
|
||||
if (!safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) {
|
||||
|
||||
pAct->filePathEXE=progFilesDirx86+"\\"+exePath86;
|
||||
if (!safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) pAct->filePathEXE="";
|
||||
pAct->filePathEXE = progFilesDirx86 + "\\" + exePath86;
|
||||
|
||||
if (!safe_file_test(pAct->filePathEXE, Glib::FILE_TEST_EXISTS)) {
|
||||
pAct->filePathEXE = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pAct->filePathEXE.length()>0){
|
||||
if (pAct->filePathEXE.length() > 0) {
|
||||
lActions.push_back(pAct);
|
||||
|
||||
// Copy for second target
|
||||
if (allowRaw && allowQueueProcess) lActions.push_back(new ExtProgAction(pAct,2));
|
||||
if (allowRaw && allowQueueProcess) {
|
||||
lActions.push_back(new ExtProgAction(pAct, 2));
|
||||
}
|
||||
|
||||
found = true;
|
||||
} else {
|
||||
delete pAct;
|
||||
}
|
||||
|
||||
found=true;
|
||||
} else delete pAct;
|
||||
#endif
|
||||
|
||||
return found;
|
||||
|
Reference in New Issue
Block a user