Rename ErrorViewDialog to InternalErrorsDialog
This commit is contained in:
parent
f462530183
commit
930691ebdc
|
@ -4,7 +4,7 @@
|
|||
#include "../../connector/syncthingservice.h"
|
||||
#include "../../connector/utils.h"
|
||||
|
||||
#include "../../widgets/misc/errorviewdialog.h"
|
||||
#include "../../widgets/misc/internalerrorsdialog.h"
|
||||
#include "../../widgets/misc/otherdialogs.h"
|
||||
#include "../../widgets/misc/textviewdialog.h"
|
||||
#include "../../widgets/settings/settings.h"
|
||||
|
@ -307,8 +307,8 @@ void SyncthingApplet::dismissNotifications()
|
|||
|
||||
void SyncthingApplet::showInternalErrorsDialog()
|
||||
{
|
||||
auto *const errorViewDlg = ErrorViewDialog::instance();
|
||||
connect(errorViewDlg, &ErrorViewDialog::errorsCleared, this, &SyncthingApplet::handleErrorsCleared);
|
||||
auto *const errorViewDlg = InternalErrorsDialog::instance();
|
||||
connect(errorViewDlg, &InternalErrorsDialog::errorsCleared, this, &SyncthingApplet::handleErrorsCleared);
|
||||
centerWidget(errorViewDlg);
|
||||
errorViewDlg->show();
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ void SyncthingApplet::handleInternalError(
|
|||
}
|
||||
InternalError error(errorMsg, request.url(), response);
|
||||
m_dbusNotifier.showInternalError(error);
|
||||
ErrorViewDialog::addError(move(error));
|
||||
InternalErrorsDialog::addError(move(error));
|
||||
}
|
||||
|
||||
void SyncthingApplet::handleErrorsCleared()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "./trayicon.h"
|
||||
#include "./traywidget.h"
|
||||
|
||||
#include "../../widgets/misc/errorviewdialog.h"
|
||||
#include "../../widgets/misc/internalerrorsdialog.h"
|
||||
#include "../../widgets/misc/statusinfo.h"
|
||||
#include "../../widgets/misc/textviewdialog.h"
|
||||
#include "../../widgets/settings/settings.h"
|
||||
|
@ -208,7 +208,7 @@ void TrayIcon::showInternalError(
|
|||
m_messageClickedAction = TrayIconMessageClickedAction::ShowInternalErrors;
|
||||
showMessage(tr("Error"), errorMsg, QSystemTrayIcon::Critical);
|
||||
}
|
||||
ErrorViewDialog::addError(move(error));
|
||||
InternalErrorsDialog::addError(move(error));
|
||||
m_errorsAction->setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -274,8 +274,8 @@ void TrayIcon::showNewDir(const QString &devId, const QString &dirId, const QStr
|
|||
|
||||
void TrayIcon::showInternalErrorsDialog()
|
||||
{
|
||||
auto *const errorViewDlg = ErrorViewDialog::instance();
|
||||
connect(errorViewDlg, &ErrorViewDialog::errorsCleared, this, &TrayIcon::handleErrorsCleared);
|
||||
auto *const errorViewDlg = InternalErrorsDialog::instance();
|
||||
connect(errorViewDlg, &InternalErrorsDialog::errorsCleared, this, &TrayIcon::handleErrorsCleared);
|
||||
centerWidget(errorViewDlg);
|
||||
errorViewDlg->show();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ set(WIDGETS_HEADER_FILES
|
|||
webview/webpage.h
|
||||
webview/webviewdialog.h
|
||||
misc/textviewdialog.h
|
||||
misc/errorviewdialog.h
|
||||
misc/internalerrorsdialog.h
|
||||
misc/statusinfo.h
|
||||
misc/dbusstatusnotifier.h
|
||||
misc/internalerror.h
|
||||
|
@ -32,7 +32,7 @@ set(WIDGETS_SRC_FILES
|
|||
webview/webviewinterceptor.h
|
||||
webview/webviewinterceptor.cpp
|
||||
misc/textviewdialog.cpp
|
||||
misc/errorviewdialog.cpp
|
||||
misc/internalerrorsdialog.cpp
|
||||
misc/statusinfo.cpp
|
||||
misc/dbusstatusnotifier.cpp
|
||||
misc/internalerror.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SYNCTHINGWIDGETS_INTERNALERROR_H
|
||||
#define SYNCTHINGWIDGETS_INTERNALERROR_H
|
||||
#ifndef SYNCTHINGWIDGETS_INTERNAL_ERROR_H
|
||||
#define SYNCTHINGWIDGETS_INTERNAL_ERROR_H
|
||||
|
||||
#include "../global.h"
|
||||
|
||||
|
@ -36,4 +36,4 @@ inline InternalError::InternalError(const QString &message, const QUrl &url, con
|
|||
}
|
||||
} // namespace QtGui
|
||||
|
||||
#endif // SYNCTHINGWIDGETS_INTERNALERROR_H
|
||||
#endif // SYNCTHINGWIDGETS_INTERNAL_ERROR_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "./errorviewdialog.h"
|
||||
#include "./internalerrorsdialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QIcon>
|
||||
|
@ -18,10 +18,10 @@ using namespace Data;
|
|||
|
||||
namespace QtGui {
|
||||
|
||||
ErrorViewDialog *ErrorViewDialog::s_instance = nullptr;
|
||||
std::vector<InternalError> ErrorViewDialog::s_internalErrors;
|
||||
InternalErrorsDialog *InternalErrorsDialog::s_instance = nullptr;
|
||||
std::vector<InternalError> InternalErrorsDialog::s_internalErrors;
|
||||
|
||||
ErrorViewDialog::ErrorViewDialog()
|
||||
InternalErrorsDialog::InternalErrorsDialog()
|
||||
: TextViewDialog(tr("Internal errors"))
|
||||
, m_request(tr("Request URL:"))
|
||||
, m_response(tr("Response:"))
|
||||
|
@ -55,21 +55,21 @@ ErrorViewDialog::ErrorViewDialog()
|
|||
buttonLayout->setMargin(0);
|
||||
buttonLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
buttonLayout->addWidget(clearButton);
|
||||
connect(clearButton, &QPushButton::clicked, &ErrorViewDialog::clearErrors);
|
||||
connect(clearButton, &QPushButton::clicked, this, &ErrorViewDialog::errorsCleared);
|
||||
connect(clearButton, &QPushButton::clicked, &InternalErrorsDialog::clearErrors);
|
||||
connect(clearButton, &QPushButton::clicked, this, &InternalErrorsDialog::errorsCleared);
|
||||
}
|
||||
|
||||
layout()->addItem(buttonLayout);
|
||||
}
|
||||
|
||||
ErrorViewDialog::~ErrorViewDialog()
|
||||
InternalErrorsDialog::~InternalErrorsDialog()
|
||||
{
|
||||
if (s_instance == this) {
|
||||
s_instance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorViewDialog::addError(InternalError &&newError)
|
||||
void InternalErrorsDialog::addError(InternalError &&newError)
|
||||
{
|
||||
s_internalErrors.emplace_back(newError);
|
||||
if (s_instance) {
|
||||
|
@ -78,7 +78,7 @@ void ErrorViewDialog::addError(InternalError &&newError)
|
|||
}
|
||||
}
|
||||
|
||||
void ErrorViewDialog::internalAddError(const InternalError &error)
|
||||
void InternalErrorsDialog::internalAddError(const InternalError &error)
|
||||
{
|
||||
const QString url(error.url.toString());
|
||||
|
||||
|
@ -96,13 +96,13 @@ void ErrorViewDialog::internalAddError(const InternalError &error)
|
|||
cerr << endl;
|
||||
}
|
||||
|
||||
void ErrorViewDialog::updateStatusLabel()
|
||||
void InternalErrorsDialog::updateStatusLabel()
|
||||
{
|
||||
m_statusLabel->setText(tr("%1 error(s) occured", nullptr, static_cast<int>(min<size_t>(s_internalErrors.size(), numeric_limits<int>::max())))
|
||||
.arg(s_internalErrors.size()));
|
||||
}
|
||||
|
||||
void ErrorViewDialog::clearErrors()
|
||||
void InternalErrorsDialog::clearErrors()
|
||||
{
|
||||
s_internalErrors.clear();
|
||||
if (s_instance) {
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SYNCTHINGWIDGETS_ERRORVIEWDIALOG_H
|
||||
#define SYNCTHINGWIDGETS_ERRORVIEWDIALOG_H
|
||||
#ifndef SYNCTHINGWIDGETS_INTERNAL_ERRORS_DIALOG_H
|
||||
#define SYNCTHINGWIDGETS_INTERNAL_ERRORS_DIALOG_H
|
||||
|
||||
#include "./internalerror.h"
|
||||
#include "./textviewdialog.h"
|
||||
|
@ -10,11 +10,11 @@ QT_FORWARD_DECLARE_CLASS(QLabel)
|
|||
|
||||
namespace QtGui {
|
||||
|
||||
class SYNCTHINGWIDGETS_EXPORT ErrorViewDialog : public TextViewDialog {
|
||||
class SYNCTHINGWIDGETS_EXPORT InternalErrorsDialog : public TextViewDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
~ErrorViewDialog() override;
|
||||
static ErrorViewDialog *instance();
|
||||
~InternalErrorsDialog() override;
|
||||
static InternalErrorsDialog *instance();
|
||||
static void addError(InternalError &&newError);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -29,24 +29,24 @@ private Q_SLOTS:
|
|||
void updateStatusLabel();
|
||||
|
||||
private:
|
||||
ErrorViewDialog();
|
||||
InternalErrorsDialog();
|
||||
|
||||
const QString m_request;
|
||||
const QString m_response;
|
||||
QLabel *const m_statusLabel;
|
||||
static ErrorViewDialog *s_instance;
|
||||
static InternalErrorsDialog *s_instance;
|
||||
static std::vector<InternalError> s_internalErrors;
|
||||
};
|
||||
|
||||
inline ErrorViewDialog *ErrorViewDialog::instance()
|
||||
inline InternalErrorsDialog *InternalErrorsDialog::instance()
|
||||
{
|
||||
return s_instance ? s_instance : (s_instance = new ErrorViewDialog);
|
||||
return s_instance ? s_instance : (s_instance = new InternalErrorsDialog);
|
||||
}
|
||||
|
||||
inline void ErrorViewDialog::showInstance()
|
||||
inline void InternalErrorsDialog::showInstance()
|
||||
{
|
||||
instance()->show();
|
||||
}
|
||||
} // namespace QtGui
|
||||
|
||||
#endif // SYNCTHINGWIDGETS_ERRORVIEWDIALOG_H
|
||||
#endif // SYNCTHINGWIDGETS_INTERNAL_ERRORS_DIALOG_H
|
Loading…
Reference in New Issue