X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FModalDialog.hh;h=4ca199e0778f897d15c2c783816636f8e7852756;hp=8bb6741f80148dfbf5b9d3d8c3d1d11348d91a24;hb=8fe54c8bf8255c704e29fd84e01dd22a169db63b;hpb=837bae9f2bf7b25e1d3d2625eeaf39c1d2f48827 diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh index 8bb6741..4ca199e 100644 --- a/src/Moof/ModalDialog.hh +++ b/src/Moof/ModalDialog.hh @@ -15,10 +15,10 @@ #include #if HAVE_CONFIG_H -#include "../config.h" +#include "config.h" #endif -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) #include #elif defined(__APPLE__) && defined(__MACH__) #include @@ -57,6 +57,17 @@ struct ModalDialog std::string text2; + + ModalDialog(Type pType = INFO, + const std::string& pTitle = "", + const std::string& pText1 = "", + const std::string& pText2 = "") : + title(pTitle), + type(pType), + text1(pText1), + text2(pText2) {} + + void run() const { switch (type) @@ -75,7 +86,7 @@ struct ModalDialog break; } -#if defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) int iconType; switch (type) @@ -121,10 +132,13 @@ struct ModalDialog "%s", text2.c_str()); gtk_window_set_title(GTK_WINDOW(dialog), title.c_str()); - std::string iconPath = Resource::getPath(PACKAGE".png"); - GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), - NULL); - gtk_window_set_icon(GTK_WINDOW(dialog), iconPixbuf); + std::string iconPath(PACKAGE".png"); + if (Resource::getPath(iconPath)) + { + GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), + NULL); + gtk_window_set_icon(GTK_WINDOW(dialog), iconPixbuf); + } gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); @@ -158,9 +172,12 @@ struct ModalDialog dialog.setInformativeText(text2.c_str()); dialog.setStandardButtons(QMessageBox::Close); - std::string iconPath = Resource::getPath(PACKAGE".png"); - QIcon icon(iconPath.c_str()); - dialog.setWindowIcon(icon); + std::string iconPath(PACKAGE".png"); + if (Resource::getPath(iconPath)) + { + QIcon icon(iconPath.c_str()); + dialog.setWindowIcon(icon); + } dialog.exec();