Commit e4880172 authored by Halla Rempt's avatar Halla Rempt

Clean up all messageboxes

* Use QMessageBox everywhere, instead of KMessageBox in some places, and
QMessageBox in others
* Add a translation hint to the messagebox title
* Make sure all messageboxes are translated.
parent 015f5d5a
......@@ -69,7 +69,7 @@
//void doRestart(bool resetConfig)
//{
// if (!startProcess(QString("krita").toStdWString().data())) {
// QMessageBox::warning(0, "Krita",
// QMessageBox::warning(0, i18nc("@title:window", "Krita"),
// i18n("Could not restart %1. Please try to restart %1 manually.").arg("krita"));
// }
//}
......@@ -130,7 +130,7 @@ void doRestart(MainWindow* mainWindow, bool resetConfig)
qDebug() << "restartCommand" << restartCommand;
QProcess restartProcess;
if (!restartProcess.startDetached(restartCommand)) {
QMessageBox::warning(mainWindow, "krita",
QMessageBox::warning(mainWindow, i18nc("@title:window", "Krita"),
i18n("Could not restart Krita. Please try to restart manually."));
}
}
......
......@@ -2,7 +2,6 @@ favoriteCompositeOps=normal,erase,multiply,burn,darken,add,dodge,screen,overlay,
SpecificColorSelector/ShowColorSpaceSelector=false
[krita]
WantExportConfirmation=false
cursorStyleDef=3
[TemplateChooserDialog]
......
......@@ -33,7 +33,6 @@
#include <QGraphicsObject>
#include <QDir>
#include <QFile>
#include <QMessageBox>
#include <QToolButton>
#include <QFileInfo>
#include <QGLWidget>
......@@ -42,7 +41,7 @@
#include <kurl.h>
#include <kstandarddirs.h>
#include <kactioncollection.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <kmenubar.h>
#include <kxmlguifactory.h>
#include <kdialog.h>
......@@ -175,7 +174,7 @@ public:
Q_ASSERT(QFile::exists(mainqml));
if (!QFile::exists(mainqml)) {
QMessageBox::warning(0, "No QML found", mainqml + " doesn't exist.");
QMessageBox::warning(0, i18nc("@title:window", "Krita: No QML Found"), i18n("%1 doesn't exist.", mainqml));
}
QFileInfo fi(mainqml);
......@@ -653,14 +652,13 @@ bool MainWindow::Private::queryClose()
if (name.isEmpty())
name = i18n("Untitled");
int res = KMessageBox::warningYesNoCancel(q,
int res = QMessageBox::warning(q,
i18nc("@title:window", "Krita"),
i18n("<p>The document <b>'%1'</b> has been modified.</p><p>Do you want to save it?</p>", name),
QString(),
KStandardGuiItem::save(),
KStandardGuiItem::discard());
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
switch (res) {
case KMessageBox::Yes : {
case QMessageBox::Yes : {
if (DocumentManager::instance()->isTemporaryFile()) {
if(!desktopViewProxy->fileSaveAs())
return false;
......@@ -670,11 +668,11 @@ bool MainWindow::Private::queryClose()
}
break;
}
case KMessageBox::No :
case QMessageBox::No :
DocumentManager::instance()->document()->removeAutoSaveFiles();
DocumentManager::instance()->document()->setModified(false); // Now when queryClose() is called by closeEvent it won't do anything.
break;
default : // case KMessageBox::Cancel :
default : // case QMessageBox::Cancel :
return false;
}
}
......
......@@ -25,7 +25,6 @@
#include <QDesktopServices>
#include <QProcessEnvironment>
#include <QDir>
#include <QMessageBox>
#include <QSplashScreen>
#include <kapplication.h>
......@@ -106,7 +105,6 @@ int main( int argc, char** argv )
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
// If there's no kdehome, set it and restart the process.
//QMessageBox::information(0, "krita sketch", "KDEHOME: " + env.value("KDEHOME"));
if (!env.contains("KDEHOME") ) {
_putenv_s("KDEHOME", QDesktopServices::storageLocation(QDesktopServices::DataLocation).toLocal8Bit());
}
......
......@@ -66,7 +66,7 @@ void kis_assert_common(const char *assertion, const char *file, int line, bool t
if (!disableAssertMsg) {
button =
QMessageBox::critical(0, i18n("Krita Internal Error"),
QMessageBox::critical(0, i18nc("@title:window", "Krita: Internal Error"),
longMessage,
QMessageBox::Ignore | QMessageBox::Abort,
QMessageBox::Ignore);
......
......@@ -25,7 +25,6 @@
#include <cfloat>
#include <stack>
#include <QMessageBox>
#include <QFontInfo>
#include <QFontMetrics>
#include <QPen>
......
......@@ -28,7 +28,7 @@
#include <kis_debug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <KoIcon.h>
#include <KoFileDialog.h>
......@@ -653,10 +653,10 @@ void KisRulerAssistantTool::loadAssistants()
delete assistant;
}
if (xml.hasError()) {
KMessageBox::sorry(0, xml.errorString());
QMessageBox::warning(0, i18nc("@title:window", "Krita"), xml.errorString());
}
if (errors) {
KMessageBox::sorry(0, i18n("Errors were encountered. Not all assistants were successfully loaded."));
QMessageBox::warning(0, i18nc("@title:window", "Krita"), i18n("Errors were encountered. Not all assistants were successfully loaded."));
}
m_handles = m_canvas->paintingAssistantsDecoration()->handles();
m_canvas->updateCanvas();
......
......@@ -31,7 +31,7 @@
#include <KoIcon.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <QMenu>
#include <QSignalMapper>
......@@ -104,15 +104,16 @@ void KisActionsEditor::slotCreateAction(const QString& _id)
if(d.exec() == KDialog::Accepted)
{
action = creator->createAction();
if(!action)
{
KMessageBox::error(this, i18n("Failed to create an action."));
if(!action) {
QMessageBox::critical(this, i18nc("@title:window", "Krita"), i18n("Failed to create an action."));
return;
}
} else {
}
else {
return;
}
} else {
}
else {
action = f->createAction();
}
Q_ASSERT(action);
......
......@@ -26,7 +26,7 @@
#include <kcomponentdata.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <kstandarddirs.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
......@@ -350,17 +350,17 @@ bool KisGmicPlugin::checkSettingsValidity(KisNodeListSP layers, const KisGmicFil
{
if (setting->isBlacklisted())
{
KMessageBox::sorry(m_gmicWidget, i18n("Sorry, this filter is crashing Krita and is turned off."), i18n("Krita"));
QMessageBox::warning(m_gmicWidget, i18nc("@title:window", "Krita"), i18n("Sorry, this filter is crashing Krita and is turned off."));
return false;
}
if (setting->outputMode() != IN_PLACE) {
KMessageBox::sorry(m_gmicWidget,QString("Sorry, this output mode is not implemented"),"Krita");
QMessageBox::warning(m_gmicWidget, i18nc("@title:window", "Krita"), i18n("Sorry, this output mode is not implemented"));
return false;
}
if (layers->isEmpty()) {
KMessageBox::sorry(m_gmicWidget, i18n("Sorry, this input mode is not implemented"), i18n("Krita"));
QMessageBox::warning(m_gmicWidget, i18nc("@title:window", "Krita"), i18n("Sorry, this input mode is not implemented"));
return false;
}
......
......@@ -24,7 +24,7 @@
#include <QLineEdit>
#include <QApplication>
#include <kis_debug.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <QMetaType>
#include <klocalizedstring.h>
......@@ -261,7 +261,7 @@ void KisGmicWidget::finishUpdate()
QString msg = i18nc("@info",
"Update filters done. "
"Restart G'MIC dialog to finish updating! ");
KMessageBox::information(this, msg, i18nc("@title:window", "Updated"));
QMessageBox::information(this, i18nc("@title:window", "Updated"), msg);
}
void KisGmicWidget::slotPreviewChanged(bool enabling)
......@@ -411,5 +411,5 @@ KisFilterPreviewWidget * KisGmicWidget::previewWidget()
void KisGmicWidget::slotNotImplemented()
{
KMessageBox::sorry(this, i18n("Sorry, support not implemented yet."), i18n("Krita"));
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("Sorry, support not implemented yet."));
}
......@@ -166,7 +166,7 @@ void DlgCreateBundle::accept()
if (name.isEmpty()) {
m_ui->editBundleName->setStyleSheet(QString(" border: 1px solid red"));
QMessageBox::warning(this, "Krita", i18n("The resource bundle name cannot be empty."));
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("The resource bundle name cannot be empty."));
return;
}
else {
......@@ -174,7 +174,7 @@ void DlgCreateBundle::accept()
if (fileInfo.exists()) {
m_ui->editBundleName->setStyleSheet("border: 1px solid red");
QMessageBox::warning(this, "Krita", i18n("A bundle with this name already exists."));
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("A bundle with this name already exists."));
return;
}
else {
......
......@@ -23,7 +23,7 @@
#include <QDir>
#include <QFileInfo>
#include <kmessagebox.h>
#include <QMessageBox>
#include <klocale.h>
#include <kglobal.h>
#include <kstandarddirs.h>
......@@ -167,7 +167,7 @@ void ResourceManager::slotImport()
QStringList resources = dlg.urls();
QString resourceType = dlg.selectedNameFilter();
if (!filterToTypeMap.contains(resourceType)) {
QMessageBox::warning(0, "Krita", i18n("The selected resource type is unknown."));
QMessageBox::warning(0, i18nc("@title:window", "Krita"), i18n("The selected resource type is unknown."));
return;
}
......@@ -194,11 +194,11 @@ void ResourceManager::slotImport()
bundle->load();
if (bundle->valid()) {
if (!bundle->install()) {
QMessageBox::warning(0, "Krita", i18n("Could not install the resources for bundle %1.").arg(res));
QMessageBox::warning(0, i18nc("@title:window", "Krita"), i18n("Could not install the resources for bundle %1.").arg(res));
}
}
else {
QMessageBox::warning(0, "Krita", i18n("Could not load bundle %1.").arg(res));
QMessageBox::warning(0, i18nc("@title:window", "Krita"), i18n("Could not load bundle %1.").arg(res));
}
QFileInfo fi(res);
......@@ -296,7 +296,7 @@ void ResourceManager::slotCreateBundle()
newBundle->setThumbnail(dlgCreateBundle.previewImage());
if (!newBundle->save()) {
KMessageBox::error(m_view->mainWindow(), i18n("Could not create the new bundle."), i18n("Error"));
QMessageBox::critical(m_view->mainWindow(), i18nc("@title:window", "Krita"), i18n("Could not create the new bundle."));
}
......
......@@ -32,7 +32,7 @@
#include <QApplication>
#include <kmessagebox.h>
#include <QMessageBox>
#include <kio/netaccess.h>
......@@ -324,7 +324,7 @@ void exrConverter::Private::unmultiplyAlpha(typename WrapperType::pixel_type *pi
alphaNoiseThreshold<channel_type>());
if (this->showNotifications) {
KMessageBox::information(0, msg, i18nc("@title:window", "EXR image will be modified"), "dontNotifyEXRChangedAgain");
QMessageBox::information(0, i18nc("@title:window", "EXR image will be modified"), msg);
} else {
qWarning() << "WARNING:" << msg;
}
......@@ -1185,7 +1185,7 @@ void exrConverter::Private::reportLayersNotSaved(const QSet<KisNodeSP> &layersNo
"<para><warning>these layers will NOT be saved to the final EXR file</warning></para>", layersList);
if (this->showNotifications) {
KMessageBox::information(0, msg, i18nc("@title:window", "Layers will be lost"), "dontNotifyEXRDropsLayers");
QMessageBox::information(0, i18nc("@title:window", "Layers will be lost"), msg);
} else {
qWarning() << "WARNING:" << msg;
}
......
......@@ -21,6 +21,7 @@
#include <qendian.h>
#include <QDataStream>
#include <QApplication>
#include <QMessageBox>
#include <kpluginfactory.h>
......@@ -135,9 +136,9 @@ KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteA
if (to == "image/x-r8" && image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) {
downscale = (QMessageBox::question(0,
i18n("Downscale Image"),
i18n("You specified the .r8 extension for a 16 bit/channel image. Do you want to save as 8 bit? Your image data will not be changed."),
QMessageBox::Yes | QMessageBox::No)
i18nc("@title:window", "Downscale Image"),
i18n("You specified the .r8 extension for a 16 bit/channel image. Do you want to save as 8 bit? Your image data will not be changed."),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes);
}
......
......@@ -23,7 +23,7 @@
#include <QFileInfo>
#include <QApplication>
#include <kmessagebox.h>
#include <QMessageBox>
#include <kio/netaccess.h>
......@@ -340,7 +340,7 @@ KisImageBuilder_Result jp2Converter::buildFile(const KUrl& uri, KisPaintLayerSP
channelorder[1] = KoBgrU16Traits::green_pos;
channelorder[2] = KoBgrU16Traits::blue_pos;
} else {
KMessageBox::error(0, i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ;
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ;
return KisImageBuilder_RESULT_FAILURE;
}
......@@ -351,7 +351,7 @@ KisImageBuilder_Result jp2Converter::buildFile(const KUrl& uri, KisPaintLayerSP
// } else if (layer->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) {
// bitdepth = 16;
} else {
KMessageBox::error(0, i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ;
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ;
return KisImageBuilder_RESULT_FAILURE;
}
......
......@@ -38,7 +38,7 @@ extern "C" {
#include <QBuffer>
#include <QApplication>
#include <kmessagebox.h>
#include <QMessageBox>
#include <klocale.h>
#include <kio/netaccess.h>
......@@ -93,7 +93,7 @@ J_COLOR_SPACE getColorTypeforColorSpace(const KoColorSpace * cs)
if (KoID(cs->id()) == KoID("CMYK") || KoID(cs->id()) == KoID("CMYK16")) {
return JCS_CMYK;
}
KMessageBox::information(0, i18n("Cannot export images in %1.\nWill save as RGB.", cs->name())) ;
QMessageBox::information(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\nWill save as RGB.", cs->name())) ;
return JCS_UNKNOWN;
}
......
......@@ -21,7 +21,7 @@
#include <QSlider>
#include <kpluginfactory.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <KisFilterChain.h>
#include <KisImportExportManager.h>
......@@ -103,17 +103,16 @@ KisImportExportFilter::ConversionStatus OraExport::convert(const QByteArray& fro
if (!supportedColorModelIds.contains(pd->colorSpace()->colorModelId().id()) ||
!supportedColorDepthIds.contains(pd->colorSpace()->colorDepthId().id())) {
if (!m_chain->manager()->getBatchMode()) {
KMessageBox::error(0, i18n("Cannot export images in this colorspace or channel depth to OpenRaster"), i18n("Krita OpenRaster Export"));
QMessageBox::critical(0, i18nc("@title:window", "Krita OpenRaster Export"), i18n("Cannot export images in this colorspace or channel depth to OpenRaster"));
}
return KisImportExportFilter::UsageError;
}
if (hasShapeLayerChild(image->root()) && !m_chain->manager()->getBatchMode()) {
KMessageBox::information(0,
i18n("This image contains vector, clone or fill layers.\nThese layers will be saved as raster layers."),
i18n("Warning"),
"krita/ora/vector");
QMessageBox::information(0,
i18nc("@title:window", "Krita:Warning"),
i18n("This image contains vector, clone or fill layers.\nThese layers will be saved as raster layers."));
}
OraConverter kpc(input);
......
......@@ -25,7 +25,7 @@
#include <kdialog.h>
#include <kpluginfactory.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <KoColorSpace.h>
#include <KisFilterChain.h>
......@@ -109,7 +109,7 @@ KisImportExportFilter::ConversionStatus KisPNGExport::convert(const QByteArray&
if (!supportedColorModelIds.contains(pd->colorSpace()->colorModelId().id()) ||
!supportedColorDepthIds.contains(pd->colorSpace()->colorDepthId().id())) {
if (!m_chain->manager()->getBatchMode()) {
KMessageBox::error(0, i18n("Cannot export images in this colorspace or channel depth to PNG"), i18n("Krita PNG Export"));
QMessageBox::critical(0, i18nc("@title:window", "Krita PNG Export"), i18n("Cannot export images in this colorspace or channel depth to PNG"));
}
return KisImportExportFilter::UsageError;
}
......
......@@ -4,7 +4,7 @@ PsdAdditionalLayerInfoBlock::PsdAdditionalLayerInfoBlock()
{
}
bool PsdAdditionalLayerInfoBlock::read(QIODevice *io)
bool PsdAdditionalLayerInfoBlock::read(QIODevice */*io*/)
{
if (key == "SoCo") {
......@@ -223,7 +223,7 @@ bool PsdAdditionalLayerInfoBlock::read(QIODevice *io)
}
bool PsdAdditionalLayerInfoBlock::write(QIODevice *io, KisNodeSP node)
bool PsdAdditionalLayerInfoBlock::write(QIODevice */*io*/, KisNodeSP /*node*/)
{
return true;
}
......
......@@ -21,7 +21,7 @@
#include <QSlider>
#include <kpluginfactory.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include <KisImportExportManager.h>
#include <KisFilterChain.h>
......@@ -87,9 +87,10 @@ KisImportExportFilter::ConversionStatus psdExport::convert(const QByteArray& fro
if (input->image()->width() > 30000 || input->image()->height() > 30000) {
if (!m_chain->manager()->getBatchMode()) {
KMessageBox::error(0, i18n("Unable to save to the Photoshop format.\n"
"The Photoshop format only supports images that are smaller than 30000x3000 pixels."),
"Photoshop Export Error");
QMessageBox::critical(0,
i18nc("@title:window", "Photoshop Export Error"),
i18n("Unable to save to the Photoshop format.\n"
"The Photoshop format only supports images that are smaller than 30000x3000 pixels."));
}
return KisImportExportFilter::InvalidFormat;
}
......@@ -97,9 +98,10 @@ KisImportExportFilter::ConversionStatus psdExport::convert(const QByteArray& fro
if (!checkHomogenity(input->image()->rootLayer(), input->image()->colorSpace())) {
if (!m_chain->manager()->getBatchMode()) {
KMessageBox::error(0, i18n("Unable to save to the Photoshop format.\n"
"The Photoshop format only supports images where all layers have the same colorspace as the image."),
"Photoshop Export Error");
QMessageBox::critical(0,
i18nc("@title:window", "Photoshop Export Error"),
i18n("Unable to save to the Photoshop format.\n"
"The Photoshop format only supports images where all layers have the same colorspace as the image."));
}
return KisImportExportFilter::InvalidFormat;
}
......
......@@ -790,7 +790,7 @@ bool PSDLayerRecord::readPixelData(QIODevice *io, KisPaintDeviceSP device)
return false;
}
bool PSDLayerRecord::readMask(QIODevice *io, KisPaintDeviceSP dev, ChannelInfo *channelInfo)
bool PSDLayerRecord::readMask(QIODevice */*io*/, KisPaintDeviceSP /*dev*/, ChannelInfo *channelInfo)
{
dbgFile << "Going to read" << channelIdToChannelType(channelInfo->channelId, m_header.colormode) << "mask";
// quint64 oldPosition = io->pos();
......
......@@ -19,7 +19,7 @@
#include "kis_tiff_writer_visitor.h"
#include <kmessagebox.h>
#include <QMessageBox>
#include <klocale.h>
#include <KoColorProfile.h>
......@@ -65,7 +65,7 @@ namespace
return true;
}
KMessageBox::error(0, i18n("Cannot export images in %1.\n", cs->name())) ;
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\n", cs->name())) ;
return false;
}
......
......@@ -32,7 +32,7 @@
#include <QVector>
#include <klocale.h>
#include <kmessagebox.h>
#include <QMessageBox>
#include "kis_layer.h"
#include "kis_cursor.h"
......@@ -247,12 +247,12 @@ void KisToolColorPicker::beginPrimaryAction(KoPointerEvent *event)
bool sampleMerged = m_optionsWidget->cmbSources->currentIndex() == SAMPLE_MERGED;
if (!sampleMerged) {
if (!currentNode()) {
KMessageBox::information(0, i18n("Cannot pick a color as no layer is active."));
QMessageBox::information(0, i18nc("@title:window", "Krita"), i18n("Cannot pick a color as no layer is active."));
event->ignore();
return;
}
if (!currentNode()->visible()) {
KMessageBox::information(0, i18n("Cannot pick a color as the active layer is not visible."));
QMessageBox::information(0, i18nc("@title:window", "Krita"), i18n("Cannot pick a color as the active layer is not visible."));
event->ignore();
return;
}
......@@ -293,7 +293,7 @@ void KisToolColorPicker::endPrimaryAction(KoPointerEvent *event)
palette->add(ent);
if (!palette->save()) {
KMessageBox::error(0, i18n("Cannot write to palette file %1. Maybe it is read-only.", palette->filename()), i18n("Palette"));
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot write to palette file %1. Maybe it is read-only.", palette->filename()));
}
}
}
......
......@@ -21,6 +21,8 @@
#include "tool_transform_args.h"
#include "kis_transform_utils.h"
#include <QMessageBox>
#include <config-gsl.h>
#ifdef HAVE_GSL
......@@ -327,22 +329,18 @@ namespace GSL
#else /* HAVE_GSL */
#include <kmessagebox.h>
namespace GSL
{
void warnNoGSL()
{
KMessageBox::information(0,
"Sorry, Krita was build without the support "
"of GNU Scientific Library, so you cannot scale "
"the selection with handles. Please compile "
"Krita with GNU Scientific Library support, or use "
"options widget for editing scale values manually.",
"No GSL support",
"messagebox_noGSLSupportWasBuiltIn",
KMessageBox::Dangerous);
QMessageBox::warning(0,
i18nc("@title:window", "Krita"),
i18n("Sorry, Krita was build without the support "
"of GNU Scientific Library, so you cannot scale "