本文整理汇总了C++中Messagebox类的典型用法代码示例。如果您正苦于以下问题:C++ Messagebox类的具体用法?C++ Messagebox怎么用?C++ Messagebox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Messagebox类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: model
void CrashHandler::saveModel(void)
{
QFileDialog file_dlg;
try
{
file_dlg.setDefaultSuffix("dbm");
file_dlg.setWindowTitle(trUtf8("Save model"));
file_dlg.setNameFilter(tr("Database model (*.dbm);;All files (*.*)"));
file_dlg.setFileMode(QFileDialog::AnyFile);
file_dlg.setAcceptMode(QFileDialog::AcceptSave);
file_dlg.setModal(true);
if(file_dlg.exec()==QFileDialog::Accepted)
{
QFile output(file_dlg.selectedFiles().at(0));
QByteArray buf;
output.open(QFile::WriteOnly);
if(!output.isOpen())
throw Exception(Exception::getErrorMessage(ERR_FILE_NOT_WRITTEN).arg(file_dlg.selectedFiles().at(0)),
ERR_FILE_NOT_WRITTEN,__PRETTY_FUNCTION__,__FILE__,__LINE__);
buf.append(model_txt->toPlainText());
output.write(buf.data(),buf.size());
output.close();
}
}
catch(Exception &e)
{
Messagebox msgbox;
msgbox.show(e);
}
}
示例2: trUtf8
void Dummy::executePlugin(ModelWidget *)
{
Messagebox msgbox;
msgbox.show(trUtf8("Plugin successfully loaded!"),
trUtf8("Plugin successfully loaded! Check the <a href='http://www.pgmodeler.com.br/wiki/doku.php?id=plugins'>plugins wiki page</a> to know how to create your own plugins."),
Messagebox::INFO_ICON);
}
示例3: generateReport
void BugReportForm::generateReport(const QByteArray &buf)
{
Messagebox msgbox;
QFile output;
QString filename=QFileInfo(QString(output_edt->text() +
GlobalAttributes::DIR_SEPARATOR +
GlobalAttributes::BUG_REPORT_FILE)
.arg(QDateTime::currentDateTime().toString(QString("_yyyyMMdd_hhmm")))).absoluteFilePath();
//Opens the file for writting
output.setFileName(filename);
output.open(QFile::WriteOnly);
if(!output.isOpen())
msgbox.show(Exception::getErrorMessage(ERR_FILE_DIR_NOT_WRITTEN).arg(filename), Messagebox::ERROR_ICON);
else
{
QByteArray comp_buf;
//Compress the buffer (using zlib) in a compression rate at 8
comp_buf=qCompress(buf, 8);
//Saves the buffer
output.write(comp_buf.data(), comp_buf.size());
output.close();
msgbox.show(trUtf8("Bug report successfuly generated! Please, send the file <strong>%1</strong> to <em>%2</em> in order be analyzed. Thank you for the collaboration!").arg(filename).arg(GlobalAttributes::BUG_REPORT_EMAIL),
Messagebox::INFO_ICON);
}
}
示例4: model
void BugReportForm::attachModel(void)
{
QFileDialog file_dlg;
try
{
file_dlg.setDefaultSuffix(QString("dbm"));
file_dlg.setWindowTitle(trUtf8("Load model"));
file_dlg.setNameFilter(trUtf8("Database model (*.dbm);;All files (*.*)"));
file_dlg.setFileMode(QFileDialog::AnyFile);
file_dlg.setModal(true);
if(file_dlg.exec()==QFileDialog::Accepted)
{
QFile input(file_dlg.selectedFiles().at(0));
QByteArray buf;
input.open(QFile::ReadOnly);
if(!input.isOpen())
throw Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_ACCESSED).arg(file_dlg.selectedFiles().at(0)),
ERR_FILE_DIR_NOT_ACCESSED,__PRETTY_FUNCTION__,__FILE__,__LINE__);
buf=input.readAll();
model_txt->setPlainText(QString(buf));
input.close();
}
}
catch(Exception &e)
{
Messagebox msgbox;
msgbox.show(e);
}
}
示例5: loadReport
void CrashHandler::loadReport(const QString &filename)
{
QFile input;
QFileInfo fi;
char *buf=nullptr;
Messagebox msgbox;
fi.setFile(filename);
input.setFileName(filename);
input.open(QFile::ReadOnly);
title_lbl->setText(trUtf8("pgModeler crash file analysis"));
create_btn->setVisible(false);
msg_lbl->clear();
//Raises an error if the file could not be opened
if(!input.isOpen())
msgbox.show(trUtf8("Error"), Exception::getErrorMessage(ERR_FILE_DIR_NOT_ACCESSED).arg(filename), Messagebox::ERROR_ICON);
else
{
QByteArray uncomp_buf;
QString buf_aux, str_aux;
int i, idx;
QTextEdit *txt_widgets[]={ actions_txt, model_txt , stack_txt};
msg_lbl->setText(trUtf8("File: %1\nSize: %2 bytes\n\n").arg(filename).arg(fi.size()));
//Creates a text buffer
buf=new char[fi.size()];
//Reads the file storing it on the buffer
input.read(buf, fi.size());
input.close();
//Uncompress the buffer
uncomp_buf.append(buf, fi.size());
uncomp_buf=qUncompress(uncomp_buf);
delete[](buf);
buf=nullptr;
buf_aux=QString(uncomp_buf.data());
i=idx=0;
//Showing the sections of the uncompressed buffer on the respective widgets
while(i < buf_aux.size() && idx <= 2)
{
if(buf_aux.at(i).toLatin1()!=CHR_DELIMITER)
str_aux.append(buf_aux.at(i));
else
{
txt_widgets[idx++]->setPlainText(Utf8String::create(str_aux));
str_aux.clear();
}
i++;
}
}
}
示例6: disableObjectSQL
void disableObjectSQL(BaseObject *object, bool disable)
{
if(object && object->getObjectType()!=BASE_RELATIONSHIP)
{
Messagebox msgbox;
ObjectType obj_type=object->getObjectType();
bool curr_val=object->isSQLDisabled();
if(object->isSystemObject())
throw Exception(Exception::getErrorMessage(ERR_OPR_RESERVED_OBJECT)
.arg(object->getName(true))
.arg(object->getTypeName()),
ERR_OPR_RESERVED_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);
object->setSQLDisabled(disable);
if(obj_type!=OBJ_DATABASE && curr_val!=disable)
{
msgbox.show(QString(QT_TR_NOOP("Do you want to apply the <strong>SQL %1 status</strong> to the object's references too? This will avoid problems when exporting or validating the model.")).arg(disable ? QT_TR_NOOP("disabling") : QT_TR_NOOP("enabling")),
Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);
if(msgbox.result()==QDialog::Accepted)
disableReferencesSQL(object);
}
/* Special case for tables. When disable the code there is the need to disable constraints
codes when the code of parent table is disabled too in order to avoid export errors */
if(object->getObjectType()==OBJ_TABLE)
{
Constraint *constr = nullptr;
vector<TableObject *> *objects=dynamic_cast<Table *>(object)->getObjectList(OBJ_CONSTRAINT);
for(auto &obj : (*objects))
{
constr=dynamic_cast<Constraint *>(obj);
/* If the constraint is not FK but is declared outside table via alter (ALTER TABLE...ADD CONSTRAINT...) or
The constraint is FK and the reference table is disabled the FK will not be enabled */
if((constr->getConstraintType()!=ConstraintType::foreign_key && !constr->isDeclaredInTable()) ||
(constr->getConstraintType()==ConstraintType::foreign_key &&
(disable || (!disable && !constr->getReferencedTable()->isSQLDisabled()))))
constr->setSQLDisabled(disable);
}
}
}
}
示例7: handleImportFinished
void DatabaseImportForm::handleImportFinished(Exception e)
{
if(!e.getErrorMessage().isEmpty())
{
Messagebox msgbox;
msgbox.show(e, e.getErrorMessage(), Messagebox::ALERT_ICON);
}
model_wgt->rearrangeSchemas(QPointF(origin_sb->value(), origin_sb->value()),
tabs_per_row_sb->value(), sch_per_row_sb->value(), obj_spacing_sb->value());
finishImport(trUtf8("Importing process sucessfuly ended!"));
ico_lbl->setPixmap(QPixmap(QString(":/icones/icones/msgbox_info.png")));
import_helper.closeConnection();
import_thread->quit();
timer.stop();
this->accept();
}
示例8: handleImportFinished
void DatabaseImportForm::handleImportFinished(Exception e)
{
if(!e.getErrorMessage().isEmpty())
{
Messagebox msgbox;
msgbox.show(e, e.getErrorMessage(), Messagebox::ALERT_ICON);
}
model_wgt->rearrangeSchemas(QPointF(origin_sb->value(), origin_sb->value()),
tabs_per_row_sb->value(), sch_per_row_sb->value(), obj_spacing_sb->value());
model_wgt->getDatabaseModel()->setInvalidated(false);
finishImport(trUtf8("Importing process sucessfuly ended!"));
ico_lbl->setPixmap(QPixmap(PgModelerUiNS::getIconPath("msgbox_info")));
import_helper->closeConnection();
import_thread->quit();
import_thread->wait();
this->accept();
}
示例9: report
void CrashHandler::loadReport(void)
{
QFileDialog file_dlg;
try
{
file_dlg.setNameFilter(trUtf8("pgModeler crash report (*.crash);;All files (*.*)"));
file_dlg.setWindowIcon(QPixmap(QString(":/icones/icones/pgsqlModeler48x48.png")));
file_dlg.setWindowTitle(trUtf8("Load report"));
file_dlg.setFileMode(QFileDialog::ExistingFiles);
file_dlg.setAcceptMode(QFileDialog::AcceptOpen);
if(file_dlg.exec()==QFileDialog::Accepted)
loadReport(file_dlg.selectedFiles().at(0));
}
catch(Exception &e)
{
Messagebox msgbox;
msgbox.show(e);
}
}
示例10: trUtf8
void CrashHandler::generateReport(void)
{
Messagebox msgbox;
QByteArray buf, comp_buf;
QFile output;
//Configures the path to the .crash file generated
QString crash_file=QFileInfo((GlobalAttributes::TEMPORARY_DIR +
GlobalAttributes::DIR_SEPARATOR +
GlobalAttributes::CRASH_REPORT_FILE).arg(QDateTime::currentDateTime().toString("_yyyyMMdd_hhmm"))).absoluteFilePath();
//Opens the file for writting
output.setFileName(crash_file);
output.open(QFile::WriteOnly);
if(!output.isOpen())
msgbox.show(trUtf8("Error"), Exception::getErrorMessage(ERR_FILE_NOT_WRITTEN).arg(crash_file), Messagebox::ERROR_ICON);
else
{
buf.append(actions_txt->toPlainText().toUtf8());
buf.append(CHR_DELIMITER);
if(attach_mod_chk->isChecked())
buf.append(model_txt->toPlainText().toUtf8());
buf.append(CHR_DELIMITER);
buf.append(stack_txt->toPlainText().toUtf8());
buf.append(CHR_DELIMITER);
//Compress the buffer (using zlib) in a compression rate at 8
comp_buf=qCompress(buf, 8);
//Saves the buffer
output.write(comp_buf.data(), comp_buf.size());
output.close();
msgbox.show(trUtf8("Information"), trUtf8("Crash report successfuly generated! Please send the file <strong>%1</strong> to <em>%2</em> in order be debugged. Thank you for the collaboration!").arg(crash_file).arg("[email protected]"), Messagebox::INFO_ICON);
this->close();
}
}
示例11: report
void CrashHandlerForm::loadReport(void)
{
QFileDialog file_dlg;
try
{
file_dlg.setNameFilter(trUtf8("pgModeler bug report (*.bug);;All files (*.*)"));
file_dlg.setWindowTitle(trUtf8("Load report"));
file_dlg.setFileMode(QFileDialog::ExistingFiles);
file_dlg.setAcceptMode(QFileDialog::AcceptOpen);
if(file_dlg.exec()==QFileDialog::Accepted)
{
loadReport(file_dlg.selectedFiles().at(0));
input_edt->setText(file_dlg.selectedFiles().at(0));
}
}
catch(Exception &e)
{
Messagebox msgbox;
msgbox.show(e);
}
}
示例12: QApplication
Application::Application(int &argc, char **argv) : QApplication(argc,argv)
{
QTranslator *main_translator=nullptr, *plugin_translator=nullptr;
QFile ui_style(GlobalAttributes::TMPL_CONFIGURATIONS_DIR +
GlobalAttributes::DIR_SEPARATOR +
GlobalAttributes::UI_STYLE_CONF +
GlobalAttributes::CONFIGURATION_EXT);
QString plugin_name, plug_lang_dir, plug_lang_file;
QStringList dir_list;
QDir dir;
//Creating the initial user's configuration
createUserConfiguration();
//Changing the current working dir to the executable's directory in
QDir::setCurrent(this->applicationDirPath());
//Adding paths which executable will find plugins and it's dependecies
this->addLibraryPath(this->applicationDirPath());
this->addLibraryPath(GlobalAttributes::PLUGINS_DIR);
//Try to create plugins dir if it does not exists
if(!dir.exists(GlobalAttributes::PLUGINS_DIR))
{
if(!dir.mkdir(GlobalAttributes::PLUGINS_DIR))
{
Messagebox msg;
msg.show(Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_WRITTEN).arg(GlobalAttributes::PLUGINS_DIR),
ERR_FILE_DIR_NOT_WRITTEN,__PRETTY_FUNCTION__,__FILE__,__LINE__));
}
}
//Check if the temporary dir exists, if not, creates it.
if(!dir.exists(GlobalAttributes::TEMPORARY_DIR))
{
if(!dir.mkdir(GlobalAttributes::TEMPORARY_DIR))
{
Messagebox msg;
msg.show(Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_WRITTEN).arg(GlobalAttributes::TEMPORARY_DIR),
ERR_FILE_DIR_NOT_WRITTEN, __PRETTY_FUNCTION__,__FILE__,__LINE__));
}
}
//Tries to load the main ui translation according to the system's locale
main_translator=new QTranslator;
main_translator->load(QLocale::system().name(), GlobalAttributes::LANGUAGES_DIR);
this->installTranslator(main_translator);
//Trying to load plugins translations
dir_list=QDir(GlobalAttributes::PLUGINS_DIR +
GlobalAttributes::DIR_SEPARATOR,
QString("*"), QDir::Name, QDir::AllDirs | QDir::NoDotAndDotDot).entryList();
while(!dir_list.isEmpty())
{
plugin_name=dir_list.front();
dir_list.pop_front();
//Configure the path to "lang" subdir at current plugin directory
plug_lang_dir=GlobalAttributes::PLUGINS_DIR +
GlobalAttributes::DIR_SEPARATOR + plugin_name +
GlobalAttributes::DIR_SEPARATOR + QString("lang") +
GlobalAttributes::DIR_SEPARATOR;
plug_lang_file=plugin_name + QString(".") + QLocale::system().name();
//Check if the .qm file exists for the current plugin. If so create and install a translator
if(QFileInfo(plug_lang_dir + plug_lang_file + QString(".qm")).exists())
{
plugin_translator=new QTranslator;
plugin_translator->load(plug_lang_file, plug_lang_dir);
this->installTranslator(plugin_translator);
}
}
//Loading app style sheet
ui_style.open(QFile::ReadOnly);
//Raises an error if ui style is not found
if(!ui_style.isOpen())
{
Messagebox msg;
msg.show(Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_ACCESSED).arg(ui_style.fileName()),
ERR_FILE_DIR_NOT_ACCESSED,__PRETTY_FUNCTION__,__FILE__,__LINE__));
}
else
this->setStyleSheet(ui_style.readAll());
}
示例13: QApplication
Application::Application(int &argc, char **argv) : QApplication(argc,argv)
{
QTranslator *main_translator=nullptr, *plugin_translator=nullptr;
QFile ui_style(GlobalAttributes::TMPL_CONFIGURATIONS_DIR +
GlobalAttributes::DIR_SEPARATOR +
GlobalAttributes::UI_STYLE_CONF +
GlobalAttributes::CONFIGURATION_EXT);
QString plugin_name, plug_lang_dir, plug_lang_file;
QStringList dir_list;
QDir dir;
//Creating the initial user's configuration
createUserConfiguration();
//Changing the current working dir to the executable's directory in
QDir::setCurrent(this->applicationDirPath());
//Adding paths which executable will find plugins and it's dependecies
this->addLibraryPath(this->applicationDirPath());
this->addLibraryPath(GlobalAttributes::PLUGINS_DIR);
//Try to create plugins dir if it does not exists
if(!dir.exists(GlobalAttributes::PLUGINS_DIR))
{
if(!dir.mkdir(GlobalAttributes::PLUGINS_DIR))
{
Messagebox msg;
msg.show(Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_WRITTEN).arg(GlobalAttributes::PLUGINS_DIR),
ERR_FILE_DIR_NOT_WRITTEN,__PRETTY_FUNCTION__,__FILE__,__LINE__));
}
}
//Check if the temporary dir exists, if not, creates it.
if(!dir.exists(GlobalAttributes::TEMPORARY_DIR))
{
if(!dir.mkdir(GlobalAttributes::TEMPORARY_DIR))
{
Messagebox msg;
msg.show(Exception(Exception::getErrorMessage(ERR_FILE_DIR_NOT_WRITTEN).arg(GlobalAttributes::TEMPORARY_DIR),
ERR_FILE_DIR_NOT_WRITTEN, __PRETTY_FUNCTION__,__FILE__,__LINE__));
}
}
//Trying to identify if the user defined a custom UI language in the pgmodeler.conf file
QString conf_file = GlobalAttributes::CONFIGURATIONS_DIR +
GlobalAttributes::DIR_SEPARATOR +
GlobalAttributes::GENERAL_CONF +
GlobalAttributes::CONFIGURATION_EXT;
QFile input;
QString lang_id = QLocale::system().name();
input.setFileName(conf_file);
if(input.open(QFile::ReadOnly))
{
QString buf = QString(input.readAll());
QRegExp regexp = QRegExp(QString("(%1)(.*)(=)(\\\")(.)+(\\\")(\\\n)").arg(ParsersAttributes::UI_LANGUAGE));
int idx = regexp.indexIn(QString(buf));
//Extract the value of the ui-language attribute in the conf file
lang_id = buf.mid(idx, regexp.matchedLength());
lang_id.remove(ParsersAttributes::UI_LANGUAGE);
lang_id.remove(QChar('"')).remove(QChar('=')).remove(QChar('\n'));
}
//Tries to load the main ui translation according to the system's locale
main_translator=new QTranslator(this);
main_translator->load(lang_id, GlobalAttributes::LANGUAGES_DIR);
this->installTranslator(main_translator);
//Trying to load plugins translations
dir_list=QDir(GlobalAttributes::PLUGINS_DIR +
GlobalAttributes::DIR_SEPARATOR,
QString("*"), QDir::Name, QDir::AllDirs | QDir::NoDotAndDotDot).entryList();
while(!dir_list.isEmpty())
{
plugin_name=dir_list.front();
dir_list.pop_front();
//Configure the path to "lang" subdir at current plugin directory
plug_lang_dir=GlobalAttributes::PLUGINS_DIR +
GlobalAttributes::DIR_SEPARATOR + plugin_name +
GlobalAttributes::DIR_SEPARATOR + QString("lang") +
GlobalAttributes::DIR_SEPARATOR;
plug_lang_file=plugin_name + QString(".") + lang_id;
//Check if the .qm file exists for the current plugin. If so create and install a translator
if(QFileInfo(plug_lang_dir + plug_lang_file + QString(".qm")).exists())
{
plugin_translator=new QTranslator(this);
plugin_translator->load(plug_lang_file, plug_lang_dir);
this->installTranslator(plugin_translator);
}
}
//Loading app style sheet
ui_style.open(QFile::ReadOnly);
//.........这里部分代码省略.........