Ajout d'une classe QETMessageBox : desormais, sous MacOS, les MessageBox sont integrees a leur fenetre parente.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@729 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier 2009-08-09 16:02:14 +00:00
parent 481aefee09
commit 7c29c7a528
17 changed files with 187 additions and 53 deletions

View File

@ -20,6 +20,7 @@
#include <math.h>
#include "diagramschooser.h"
#include "qeticons.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -249,7 +250,7 @@ void DiagramPrintDialog::acceptPrintTypeDialog() {
if (file_print) {
// un fichier doit avoir ete entre
if (filepath_field_ -> text().isEmpty()) {
QMessageBox::information(
QET::MessageBox::information(
parentWidget(),
tr("Fichier manquant", "message box title"),
tr("Vous devez indiquer le chemin du fichier PDF/PS \340 cr\351er.", "message box content")

View File

@ -30,6 +30,7 @@
#include "integrationmoveelementshandler.h"
#include "qetdiagrameditor.h"
#include "qeticons.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -581,7 +582,7 @@ void DiagramView::editSelectionProperties() {
}
// sinon on affiche un simple listing des elements selectionnes
QMessageBox::information(
QET::MessageBox::information(
this,
tr("Propri\351t\351s de la s\351lection"),
QString(

View File

@ -19,6 +19,7 @@
#include "partpolygon.h"
#include "elementscene.h"
#include "editorcommands.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -67,7 +68,7 @@ void PolygonEditor::updatePolygon() {
void PolygonEditor::updatePolygonPoints() {
QVector<QPointF> points = getPointsFromTree();
if (points.count() < 2) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Erreur", "message box title"),
tr("Le polygone doit comporter au moins deux points.", "message box content")

View File

@ -26,6 +26,7 @@
#include "elementdialog.h"
#include "recentfiles.h"
#include "qeticons.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -563,7 +564,7 @@ void QETElementEditor::slot_updateInformations() {
une boite de dialogue.
*/
void QETElementEditor::xmlPreview() {
QMessageBox::information(
QET::MessageBox::information(
this,
"Export XML",
ce_scene -> toXml().toString(4)
@ -629,6 +630,8 @@ bool QETElementEditor::checkElement() {
warning_message += "</ol>";
QMessageBox warnings_message_box(this);
warnings_message_box.setWindowModality(Qt::WindowModal);
warnings_message_box.setWindowFlags(warnings_message_box.windowFlags() | Qt::Sheet);
warnings_message_box.setTextFormat(Qt::RichText);
warnings_message_box.setWindowTitle(tr("Avertissements", "messagebox title"));
warnings_message_box.setText(warning_message);
@ -671,7 +674,7 @@ void QETElementEditor::fromFile(const QString &filepath) {
}
if (!state) {
QMessageBox::critical(this, tr("Erreur", "toolbar title"), error_message);
QET::MessageBox::critical(this, tr("Erreur", "toolbar title"), error_message);
return;
}
@ -681,7 +684,7 @@ void QETElementEditor::fromFile(const QString &filepath) {
// gestion de la lecture seule
if (!infos_file.isWritable()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("\311dition en lecture seule", "message box title"),
tr("Vous n'avez pas les privil\350ges n\351cessaires pour modifier cet \351lement. Il sera donc ouvert en lecture seule.", "message box content")
@ -703,7 +706,7 @@ void QETElementEditor::fromFile(const QString &filepath) {
bool QETElementEditor::toFile(const QString &fn) {
QFile file(fn);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(this, tr("Erreur", "message box title"), tr("Impossible d'\351crire dans ce fichier", "message box content"));
QET::MessageBox::warning(this, tr("Erreur", "message box title"), tr("Impossible d'\351crire dans ce fichier", "message box content"));
return(false);
}
QTextStream out(&file);
@ -730,7 +733,7 @@ bool QETElementEditor::toLocation(const ElementsLocation &location) {
}
if (!element) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Impossible d'atteindre l'\351l\351ment", "message box content")
@ -741,7 +744,7 @@ bool QETElementEditor::toLocation(const ElementsLocation &location) {
// enregistre l'element
element -> setXml(ce_scene -> toXml().documentElement());
if (!element -> write()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Impossible d'enregistrer l'\351l\351ment", "message box content")
@ -858,7 +861,7 @@ void QETElementEditor::slot_reload() {
// s'il ya des modifications, on demande a l'utilisateur s'il est certain
// de vouloir recharger
if (!ce_scene -> undoStack().isClean()) {
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
tr("Recharger l'\351l\351ment", "dialog title"),
tr("Vous avez efffectu\351 des modifications sur cet \351l\351ment. Si vous le rechargez, ces modifications seront perdues. Voulez-vous vraiment recharger l'\351l\351ment ?", "dialog content"),
@ -968,7 +971,7 @@ bool QETElementEditor::slot_saveAsFile() {
bool QETElementEditor::canClose() {
if (ce_scene -> undoStack().isClean()) return(true);
// demande d'abord a l'utilisateur s'il veut enregistrer l'element en cours
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
tr("Enregistrer l'\351l\351ment en cours ?", "dialog title"),
QString(
@ -1143,7 +1146,7 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) {
ElementsCollectionItem *item = QETApp::collectionItem(location);
ElementDefinition *element = 0;
if (!item) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("\311l\351ment inexistant.", "message box title"),
tr("L'\351l\351ment n'existe pas.", "message box content")
@ -1152,7 +1155,7 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) {
}
if (!item -> isElement() || !(element = qobject_cast<ElementDefinition *>(item)) || element -> isNull()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("\311l\351ment inexistant.", "message box title"),
tr("Le chemin virtuel choisi ne correspond pas \340 un \351l\351ment.", "message box content")
@ -1171,7 +1174,7 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) {
// gestion de la lecture seule
if (!element -> isWritable()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("\311dition en lecture seule", "message box title"),
tr("Vous n'avez pas les privil\350ges n\351cessaires pour modifier cet \351lement. Il sera donc ouvert en lecture seule.", "message box content")

View File

@ -17,6 +17,7 @@
*/
#include "elementdeleter.h"
#include "qetapp.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -50,7 +51,7 @@ bool ElementDeleter::exec() {
if (!element || !element -> isElement()) return(false);
// confirmation #1
QMessageBox::StandardButton answer_1 = QMessageBox::question(
QMessageBox::StandardButton answer_1 = QET::MessageBox::question(
this,
tr("Supprimer l'\351l\351ment ?", "message box title"),
tr("\312tes-vous s\373r de vouloir supprimer cet \351l\351ment ?\n", "message box content"),
@ -64,7 +65,7 @@ bool ElementDeleter::exec() {
// supprime l'element
if (!element -> remove()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Suppression de l'\351l\351ment", "message box title"),
tr("La suppression de l'\351l\351ment a \351chou\351.", "message box content")

View File

@ -21,6 +21,7 @@
#include "elementscategorieslist.h"
#include "elementscollectionitem.h"
#include "qfilenameedit.h"
#include "qetmessagebox.h"
/**
Constructeur par defaut.
@ -228,7 +229,7 @@ void ElementDialog::checkDialog() {
// on verifie d'abord que l'utilisateur a choisi quelque chose
ElementsLocation location = list_ -> selectedLocation();
if (location.isNull()) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("Pas de s\351lection", "message box title"),
tr("Vous devez s\351lectionner un \351l\351ment.", "message box content")
@ -239,7 +240,7 @@ void ElementDialog::checkDialog() {
// on verifie donc que la selection existe
ElementsCollectionItem *item = QETApp::collectionItem(location);
if (!item) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("S\351lection inexistante", "message box title"),
tr("La s\351lection n'existe pas.", "message box content")
@ -249,7 +250,7 @@ void ElementDialog::checkDialog() {
// puis on verifie qu'il s'agit bien d'un element
if (!item -> isElement()) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("S\351lection incorrecte", "message box title"),
tr("La s\351lection n'est pas un \351l\351ment.", "message box content")
@ -266,7 +267,7 @@ void ElementDialog::checkDialog() {
*/
ElementsLocation location = list_ -> selectedLocation();
if (location.isNull()) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("Pas de s\351lection", "message box title"),
tr("Vous devez s\351lectionner une cat\351gorie ou un \351l\351ment.", "message box content")
@ -277,7 +278,7 @@ void ElementDialog::checkDialog() {
// on verifie donc que la selection existe
ElementsCollectionItem *item = QETApp::collectionItem(location);
if (!item) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("S\351lection inexistante", "message box title"),
tr("La s\351lection n'existe pas.", "message box content")
@ -290,7 +291,7 @@ void ElementDialog::checkDialog() {
QString element_name(textfield_ -> text());
// si on a une categorie (ou une collection), il nous faut un nom d'element
if (element_name.isEmpty()) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("Nom manquant", "message box title"),
tr("Vous devez entrer un nom pour l'\351l\351ment", "message box content")
@ -300,7 +301,7 @@ void ElementDialog::checkDialog() {
// ce nom d'element doit etre valide
if (QET::containsForbiddenCharacters(element_name)) {
QMessageBox::critical(
QET::MessageBox::critical(
dialog_,
tr("Nom invalide", "message box title"),
QString(
@ -328,7 +329,7 @@ void ElementDialog::checkDialog() {
// si l'element existe, on demande confirmation pour son ecrasement
if (element_already_exists) {
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
dialog_,
tr("\311craser l'\351l\351ment ?", "message box title"),
tr("L'\351l\351ment existe d\351j\340. Voulez-vous l'\351craser ?", "message box content"),

View File

@ -17,6 +17,7 @@
*/
#include "elementscategorydeleter.h"
#include "qetapp.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -53,7 +54,7 @@ bool ElementsCategoryDeleter::exec() {
// gere le cas ou la suppression d'une collection est demandee
if (category -> isCollection()) {
QMessageBox::StandardButton answer_0 = QMessageBox::question(
QMessageBox::StandardButton answer_0 = QET::MessageBox::question(
this,
tr("Vider la collection ?", "message box title"),
tr("\312tes-vous s\373r de vouloir vider cette collection ?", "message box content"),
@ -70,7 +71,7 @@ bool ElementsCategoryDeleter::exec() {
// avertissement pour la suppression d'une collection
// confirmation #1
QMessageBox::StandardButton answer_1 = QMessageBox::question(
QMessageBox::StandardButton answer_1 = QET::MessageBox::question(
this,
tr("Supprimer la cat\351gorie ?", "message box title"),
tr(
@ -84,7 +85,7 @@ bool ElementsCategoryDeleter::exec() {
if (answer_1 != QMessageBox::Yes) return(false);
// confirmation #2
QMessageBox::StandardButton answer_2 = QMessageBox::question(
QMessageBox::StandardButton answer_2 = QET::MessageBox::question(
this,
tr("Supprimer la cat\351gorie ?", "message box title"),
tr(
@ -98,7 +99,7 @@ bool ElementsCategoryDeleter::exec() {
// supprime la categorie
if (!category -> remove()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Suppression de la cat\351gorie", "message box title"),
tr("La suppression de la cat\351gorie a \351chou\351.", "message box content")

View File

@ -22,6 +22,7 @@
#include "qet.h"
#include "qetapp.h"
#include "qfilenameedit.h"
#include "qetmessagebox.h"
/**
Constructeur fournissant un dialogue d'edition de categorie.
@ -41,7 +42,7 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &category_
if (category_item) category_item = category_item -> toCategory();
if (!category_item || !category_item -> isCategory()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Cat\351gorie inexistante", "message box title"),
tr("La cat\351gorie demand\351e n'existe pas. Abandon.", "message box content")
@ -71,7 +72,7 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &category_
// gestion de la lecture seule
if (!category -> isWritable()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("\311dition en lecture seule", "message box title"),
tr("Vous n'avez pas les privil\350ges n\351cessaires pour modifier cette cat\351gorie. Elle sera donc ouverte en lecture seule.", "message box content")
@ -123,7 +124,7 @@ void ElementsCategoryEditor::acceptCreation() {
// exige un nom de dossier de la part de l'utilisateur
if (!internal_name_ -> isValid()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Nom interne manquant", "message box title"),
tr("Vous devez sp\351cifier un nom interne.", "message box content")
@ -134,7 +135,7 @@ void ElementsCategoryEditor::acceptCreation() {
// verifie que le nom interne n'est pas deja pris
if (category -> category(dirname)) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Nom interne d\351j\340 utilis\351", "message box title"),
tr(
@ -149,7 +150,7 @@ void ElementsCategoryEditor::acceptCreation() {
// cree la nouvelle categorie
ElementsCategory *new_category = category -> createCategory(dirname);
if (!new_category) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Impossible de cr\351er la cat\351gorie", "message box content")
@ -165,7 +166,7 @@ void ElementsCategoryEditor::acceptCreation() {
// ecriture de la
if (!new_category -> write()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Impossible d'enregistrer la cat\351gorie", "message box content")

View File

@ -19,6 +19,7 @@
#include <QSvgGenerator>
#include <QtXml>
#include "qeticons.h"
#include "qetmessagebox.h"
#include "exportpropertieswidget.h"
#include "qetdiagrameditor.h"
@ -390,7 +391,7 @@ void ExportDialog::slot_export() {
}
}
if (filenames.count() != diagrams_to_export.count()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Noms des fichiers cibles", "message box title"),
tr(
@ -406,7 +407,7 @@ void ExportDialog::slot_export() {
QDir target_dir_path(epw -> exportProperties().destination_directory);
if (!target_dir_path.exists()) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Dossier non sp\351cifi\351", "message box title"),
tr("Vous devez sp\351cifier le chemin du dossier dans lequel seront enregistr\351s les fichiers images.", "message box content"),
@ -448,7 +449,7 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
// verifie qu'il est possible d'ecrire dans le fichier en question
if (file_infos.exists() && !file_infos.isWritable()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Impossible d'\351crire dans ce fichier", "message box title"),
QString(

View File

@ -20,6 +20,7 @@
#include "elementscategory.h"
#include "elementdefinition.h"
#include "qfilenameedit.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -356,7 +357,7 @@ QWidget *InteractiveMoveElementsHandler::conflictDialogMainWidget() const {
@return L'action choisie par l'utilisateur
*/
QET::Action InteractiveMoveElementsHandler::retryErrorMessage(const QString &message) const {
int todo = QMessageBox::critical(
int todo = QET::MessageBox::critical(
parent_widget_,
tr("Erreur", "message box title"),
message,
@ -378,7 +379,7 @@ QET::Action InteractiveMoveElementsHandler::retryErrorMessage(const QString &mes
@param message Message d'erreur a afficher
*/
void InteractiveMoveElementsHandler::simpleErrorMessage(const QString &message) const {
QMessageBox::critical(
QET::MessageBox::critical(
parent_widget_,
tr("Erreur", "message box title"),
message,

View File

@ -16,6 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nameslistwidget.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -61,7 +62,7 @@ void NamesListWidget::addLine() {
bool NamesListWidget::checkOneName() {
updateHash();
if (!hash_names.count()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Il doit y avoir au moins un nom.", "message box title"),
tr("Vous devez entrer au moins un nom.", "message box content")

View File

@ -28,6 +28,7 @@
#include "qetapp.h"
#include "elementscollectionitem.h"
#include "qfilenameedit.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -208,7 +209,7 @@ bool NewElementWizard::validStep1() {
}
if (!step1_ok) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Vous devez s\351lectionner une cat\351gorie.", "message box content")
@ -228,7 +229,7 @@ bool NewElementWizard::validStep2() {
// un nom doit avoir ete entre
if (file_name.isEmpty()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Vous devez entrer un nom de fichier", "message box content")
@ -240,7 +241,7 @@ bool NewElementWizard::validStep2() {
// le nom de fichier contient peut etre des caracteres interdits
if (QET::containsForbiddenCharacters(file_name)) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Erreur", "message box title"),
tr("Merci de ne pas utiliser les caract\350res suivants : \\ / : * ? \" < > |", "message box content")
@ -250,7 +251,7 @@ bool NewElementWizard::validStep2() {
// le fichier existe peut etre deja
if (chosen_category -> element(file_name)) {
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
"\311craser le fichier ?",
"Le fichier existe d\351j\340. Souhaitez-vous l'\351craser ?",

View File

@ -29,6 +29,7 @@
#include "insetpropertieswidget.h"
#include "conductorpropertieswidget.h"
#include "qeticons.h"
#include "qetmessagebox.h"
/**
Constructeur
@ -186,7 +187,7 @@ bool ProjectView::tryClosing() {
// on regarde s'il reste du contenu dans le projet
if (project_ -> projectWasModified() && project_ -> filePath().isEmpty()) {
// si oui, on propose a l'utilisateur d'enregistrer le projet
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
tr("Enregistrer le projet en cours ?", "message box title"),
QString(tr("Voulez-vous enregistrer le projet ?", "message box content")),
@ -238,7 +239,7 @@ bool ProjectView::tryClosingDiagrams() {
if (!diagram_view -> diagram() -> undoStack().isClean()) {
// ce schema a ete modifie - on demande a l'utilisateur s'il veut l'enregistrer
showDiagram(diagram_view -> diagram());
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
tr("Enregistrer le sch\351ma en cours ?", "message box title"),
QString(tr("Voulez-vous enregistrer le sch\351ma %1 ?", "message box content - %1 is a diagram title")).arg(diagram_view -> windowTitle()),
@ -255,7 +256,7 @@ bool ProjectView::tryClosingDiagrams() {
} else if (!diagram_view -> diagram() -> wasWritten()) {
// ce schema a ete ajoute mais pas modifie - on demande a l'utilisateur s'il veut le conserver
showDiagram(diagram_view -> diagram());
QMessageBox::StandardButton answer = QMessageBox::question(
QMessageBox::StandardButton answer = QET::MessageBox::question(
this,
tr("Enregistrer le nouveau sch\351ma ?", "message box title"),
tr("Ce sch\351ma a \351t\351 ajout\351 mais n'a \351t\351 ni modifi\351 ni enregistr\351. Voulez-vous le conserver ?", "message box content"),
@ -326,7 +327,7 @@ void ProjectView::removeDiagram(DiagramView *diagram_view) {
diagram_view -> diagram() -> wasWritten() ||\
!diagram_view -> diagram() -> undoStack().isClean()
) {
int answer = QMessageBox::question(
int answer = QET::MessageBox::question(
this,
tr("Supprimer le sch\351ma ?", "message box title"),
tr("\312tes-vous s\373r de vouloir supprimer ce sch\351ma du projet ? Ce changement est irr\351versible.", "message box content"),
@ -596,7 +597,7 @@ int ProjectView::cleanProject() {
// s'assure que le schema n'est pas en lecture seule
if (project_ -> isReadOnly()) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Projet en lecture seule", "message box title"),
tr("Ce projet est en lecture seule. Il n'est donc pas possible de le nettoyer.", "message box content")

View File

@ -26,6 +26,7 @@
#include "recentfiles.h"
#include "qeticons.h"
#include "qetelementeditor.h"
#include "qetmessagebox.h"
/**
constructeur
@ -758,7 +759,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
// verifie que le fichier est accessible en lecture
if (!filepath_info.isReadable()) {
if (interactive) {
QMessageBox::critical(
QET::MessageBox::critical(
this,
tr("Impossible d'ouvrir le fichier"),
tr("Il semblerait que le fichier que vous essayez d'ouvrir ne "
@ -772,7 +773,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
// gere le fait que le fichier puisse etre en lecture seule
if (!filepath_info.isWritable()) {
if (interactive) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("Ouverture du projet en lecture seule"),
tr("Il semblerait que le projet que vous essayez d'ouvrir ne "
@ -786,7 +787,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
QETProject *project = new QETProject(filepath);
if (project -> state() != QETProject::Ok) {
if (interactive) {
QMessageBox::warning(
QET::MessageBox::warning(
this,
tr("\311chec de l'ouverture du projet", "message box title"),
QString(

78
sources/qetmessagebox.cpp Normal file
View File

@ -0,0 +1,78 @@
/*
Copyright 2006-2009 Xavier Guerrin
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qetmessagebox.h"
/**
@see Documentation Qt pour QMessageBox::critical
*/
QMessageBox::StandardButton QET::MessageBox::critical (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) {
#ifdef Q_WS_MAC
QMessageBox message_box(QMessageBox::Critical, title, text, buttons, parent, Qt::Sheet);
message_box.setWindowModality(Qt::WindowModal);
#else
QMessageBox message_box(QMessageBox::Critical, title, text, buttons, parent);
#endif
message_box.setDefaultButton(defaultButton);
return(static_cast<QMessageBox::StandardButton>(message_box.exec()));
}
/**
@see Documentation Qt pour QMessageBox::information
*/
QMessageBox::StandardButton QET::MessageBox::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) {
#ifdef Q_WS_MAC
QMessageBox message_box(QMessageBox::Information, title, text, buttons, parent, Qt::Sheet);
message_box.setWindowModality(Qt::WindowModal);
#else
QMessageBox message_box(QMessageBox::Information, title, text, buttons, parent);
#endif
message_box.setDefaultButton(defaultButton);
return(static_cast<QMessageBox::StandardButton>(message_box.exec()));
}
/**
@see Documentation Qt pour QMessageBox::question
*/
QMessageBox::StandardButton QET::MessageBox::question (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) {
#ifdef Q_WS_MAC
QMessageBox message_box(QMessageBox::Question, title, text, buttons, parent, Qt::Sheet);
message_box.setWindowModality(Qt::WindowModal);
#else
QMessageBox message_box(QMessageBox::Question, title, text, buttons, parent);
#endif
message_box.setDefaultButton(defaultButton);
return(static_cast<QMessageBox::StandardButton>(message_box.exec()));
}
/**
@see Documentation Qt pour QMessageBox::warning
*/
QMessageBox::StandardButton QET::MessageBox::warning (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) {
#ifdef Q_WS_MAC
QMessageBox message_box(QMessageBox::Warning, title, text, buttons, parent, Qt::Sheet);
message_box.setWindowModality(Qt::WindowModal);
#else
QMessageBox message_box(QMessageBox::Warning, title, text, buttons, parent);
#endif
message_box.setDefaultButton(defaultButton);
return(static_cast<QMessageBox::StandardButton>(message_box.exec()));
}

39
sources/qetmessagebox.h Normal file
View File

@ -0,0 +1,39 @@
/*
Copyright 2006-2009 Xavier Guerrin
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QET_MESSAGE_BOX_H
#define QET_MESSAGE_BOX_H
#include <QMessageBox>
namespace QET {
/**
Ce namespace definit certaines methodes statiques visant a recreer le
comportement de certaines methodes statiques de la classe Qt
QMessageBox.
Le comportement est sense etre le meme sur les plateformes X11 et
Windows. En revanche, sous MacOS, si un widget parent est fourni, ces
methodes s'assurent que la boite de dialogue sera "window modal" mais
aussi qu'elle sera dotee du flag "Qt:Sheet", qui permet une meilleure
integration sous MacOS.
*/
namespace MessageBox {
QMessageBox::StandardButton critical (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton);
QMessageBox::StandardButton information(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton);
QMessageBox::StandardButton question (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton);
QMessageBox::StandardButton warning (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton);
};
};
#endif

View File

@ -24,6 +24,7 @@
#include "qetdiagrameditor.h"
#include "integrationmoveelementshandler.h"
#include "basicmoveelementshandler.h"
#include "qetmessagebox.h"
QString QETProject::integration_category_name = "import";
@ -696,7 +697,7 @@ void QETProject::readProjectXml() {
bool conv_ok;
qreal diagram_version = root_elmt.attribute("version").toDouble(&conv_ok);
if (conv_ok && QET::version.toDouble() < diagram_version) {
QMessageBox::warning(
QET::MessageBox::warning(
0,
tr("Avertissement", "message box title"),
tr(