Skip to content

Commit

Permalink
Merge pull request #1029 from FashionFreedom/issue-1028-fix-logging-w…
Browse files Browse the repository at this point in the history
…arnings

fix: revert logging warnings
  • Loading branch information
DSCaskey authored Oct 7, 2023
2 parents 83cf622 + ddbfadc commit 350a5b3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/app/seamly2d/dialogs/dialoghistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
{
qWarning() << "Can't find element by id" << Q_FUNC_INFO;
qDebug() << "Can't find element by id" << Q_FUNC_INFO;
return QString();
}
try
Expand Down Expand Up @@ -465,7 +465,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
qWarning() << error.ErrorMessage() << Q_FUNC_INFO;
return QString();
}
qWarning() << "Can't create history record for the tool.";
qDebug() << "Can't create history record for the tool.";
return QString();
}

Expand Down
9 changes: 4 additions & 5 deletions src/app/seamly2d/dialogs/groups_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void GroupsWidget::addGroupItem(const quint32 &toolId, const quint32 &objId, con
const QDomElement domElement = m_doc->elementById(toolId);
if (domElement.isElement() == false)
{
qWarning() << "Can't find element by id" << Q_FUNC_INFO;
qDebug() << "Can't find element by id" << Q_FUNC_INFO;
return;
}
try
Expand Down Expand Up @@ -1047,7 +1047,7 @@ void GroupsWidget::addGroupItem(const quint32 &toolId, const quint32 &objId, con
itemData.append(objId);
itemData.append(toolId);

qWarning() << error.ErrorMessage() << Q_FUNC_INFO;
qDebug() << error.ErrorMessage() << Q_FUNC_INFO;
QListWidgetItem *item = new QListWidgetItem(objName);
item->setIcon(QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
item->setData(Qt::UserRole, QVariant::fromValue(itemData));
Expand Down Expand Up @@ -1096,9 +1096,8 @@ QString GroupsWidget::getObjName(quint32 toolId)
}
catch (const VExceptionBadId &error)
{
qWarning(WidgetGroups, "Error! Couldn't get object name by id = %s. %s %s", qUtf8Printable(QString().setNum(toolId)),
qUtf8Printable(error.ErrorMessage()),
qUtf8Printable(error.DetailedInformation()));
qCDebug(WidgetGroups, "Error! Couldn't get object name by id = %s. %s %s", qUtf8Printable(QString().setNum(toolId)),
qUtf8Printable(error.ErrorMessage()), qUtf8Printable(error.DetailedInformation()));
return QString("Unknown Object");// Return Unknown string
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/seamly2d/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7199,8 +7199,8 @@ bool MainWindow::IgnoreLocking(int error, const QString &path)

if (answer == QMessageBox::Abort)
{
qCWarning(vMainWindow, "Failed to lock %s", qUtf8Printable(path));
qCWarning(vMainWindow, "Error type: %d", error);
qCDebug(vMainWindow, "Failed to lock %s", qUtf8Printable(path));
qCDebug(vMainWindow, "Error type: %d", error);
Clear();
if (!VApplication::IsGUIMode())
{
Expand Down
32 changes: 16 additions & 16 deletions src/app/seamly2d/mainwindowsnogui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool CreateLayoutPath(const QString &path)
bool usedNotExistedDir = true;
QDir dir(path);
dir.setPath(path);
if (not dir.exists(path))
if (!dir.exists(path))
{
usedNotExistedDir = dir.mkpath(".");
}
Expand Down Expand Up @@ -308,7 +308,7 @@ void MainWindowsNoGUI::ExportFlatLayout(const ExportLayoutDialog &dialog, const
{
const QString path = dialog.path();
bool usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
if (!usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
return;
Expand Down Expand Up @@ -399,7 +399,7 @@ void MainWindowsNoGUI::ExportApparelLayout(const ExportLayoutDialog &dialog, con
{
const QString path = dialog.path();
bool usedNotExistedDir = CreateLayoutPath(path);
if (not usedNotExistedDir)
if (!usedNotExistedDir)
{
qCritical() << tr("Can't create a path");
return;
Expand Down Expand Up @@ -533,7 +533,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
const double scale = qMin(xscale, yscale);

QPainter painter;
if (not painter.begin(printer))
if (!painter.begin(printer))
{ // failed to open file
qWarning("failed to open file, is it writable?");
return;
Expand Down Expand Up @@ -598,7 +598,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)

const int numPages = lastPage - firstPage + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
if (!printer->supportsMultipleCopies())
{
copyCount = printer->copyCount();
}
Expand All @@ -609,9 +609,9 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
{
if (i != 0 || j != 0)
{
if (not printer->newPage())
if (!printer->newPage())
{
qWarning("failed in flushing page to disk, disk full?");
qWarning("Failed in flushing page to disk, disk may be full.");
return;
}
}
Expand Down Expand Up @@ -678,7 +678,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::PrintPreviewOrigin()
{
if (not isPagesUniform())
if (!isPagesUniform())
{
qCritical() << tr("For previewing multipage document all sheet should have the same size.");
return;
Expand All @@ -698,7 +698,7 @@ void MainWindowsNoGUI::PrintPreviewTiled()
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::PrintOrigin()
{
if (not isPagesUniform())
if (!isPagesUniform())
{
qCritical() << tr("For printing multipages document all sheet should have the same size.");
return;
Expand Down Expand Up @@ -774,7 +774,7 @@ void MainWindowsNoGUI::refreshSeamAllowances()
QVector<VLayoutPiece> MainWindowsNoGUI::preparePiecesForLayout(const QHash<quint32, VPiece> &pieces)
{
QVector<VLayoutPiece> pieceList;
if (not pieces.isEmpty())
if (!pieces.isEmpty())
{
QHash<quint32, VPiece>::const_iterator i = pieces.constBegin();
while (i != pieces.constEnd())
Expand Down Expand Up @@ -807,7 +807,7 @@ QIcon MainWindowsNoGUI::ScenePreview(int i) const
// Create the image with the exact size of the shrunk scene
image = QImage(QSize(static_cast<qint32>(r.width()), static_cast<qint32>(r.height())), QImage::Format_RGB32);

if (not image.isNull())
if (!image.isNull())
{
image.fill(Qt::white);
QPainter painter(&image);
Expand Down Expand Up @@ -1064,7 +1064,7 @@ void MainWindowsNoGUI::PdfTiledFile(const QString &name)
SetPrinterSettings(&printer, PrintType::PrintPDF);

// Call IsPagesFit after setting a printer settings and check if pages is not bigger than printer's paper size
if (not isTiled && not IsPagesFit(printer.pageLayout().fullRectPixels(printer.resolution()).size()))
if (!isTiled && not IsPagesFit(printer.pageLayout().fullRectPixels(printer.resolution()).size()))
{
qWarning() << tr("Pages will be cropped because they do not fit printer paper size.");
}
Expand Down Expand Up @@ -1368,7 +1368,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
printer->setCreator(QGuiApplication::applicationDisplayName()+" "+QCoreApplication::applicationVersion());
printer->setPageOrientation(QPageLayout::Orientation::Portrait);

if (not isTiled)
if (!isTiled)
{
QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm));
if (isAutoCrop || isUnitePages)
Expand Down Expand Up @@ -1411,7 +1411,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr

qreal left, top, right, bottom;

if (not isTiled)
if (!isTiled)
{
QMarginsF pageMargin = QMarginsF(UnitConvertor(margins, Unit::Px, Unit::Mm));
left = pageMargin.left();
Expand Down Expand Up @@ -1442,7 +1442,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
}

const bool success = printer->setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Millimeter);
if (not success)
if (!success)
{
qWarning() << tr("Cannot set printer margins");
}
Expand Down Expand Up @@ -1504,7 +1504,7 @@ bool MainWindowsNoGUI::IsLayoutGrayscale() const
// Restore
RestorePaper(i);

if (not image.isGrayscale())
if (!image.isGrayscale())
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/fervor/fvupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void FvUpdater::fileDownloadFinished(QFile *downloadedFile, QString name) {
QProcess proc;
auto res = proc.startDetached(QDir::toNativeSeparators(fileInfo.absoluteFilePath()), QStringList());
auto err = proc.error();
qWarning() << res << " " << err;
qDebug() << res << " " << err;
#else

QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
Expand Down
6 changes: 3 additions & 3 deletions src/libs/ifc/xml/vabstractpattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,13 @@ bool VAbstractPattern::renameDraftBlock(const QString &oldName, const QString &n

if (draftBlockNameExists(oldName) == false)
{
qWarning() << "Draft block does not exist with name" << oldName;
qDebug() << "Draft block does not exist with name" << oldName;
return false;
}

if (draftBlockNameExists(newName))
{
qWarning() << "Draft block already exists with name" << newName;
qDebug() << "Draft block already exists with name" << newName;
return false;
}

Expand All @@ -568,7 +568,7 @@ bool VAbstractPattern::renameDraftBlock(const QString &oldName, const QString &n
}
else
{
qWarning() << "Can't find draft block node with name" << oldName << Q_FUNC_INFO;
qDebug() << "Can't find draft block node with name" << oldName << Q_FUNC_INFO;
return false;
}
}
Expand Down

0 comments on commit 350a5b3

Please sign in to comment.