mirror of
https://github.com/Fishwaldo/ozw-admin.git
synced 2025-03-15 19:31:38 +00:00
Only Sync Remote Logs when the Log Replica is ready
This commit is contained in:
parent
cfba9838ed
commit
6eb844ab71
3 changed files with 12 additions and 5 deletions
|
@ -12,12 +12,9 @@ LogWindow::LogWindow(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
this->ui->logview->verticalHeader()->hide();
|
||||
this->ui->logview->horizontalHeader()->setStretchLastSection(true);
|
||||
// this->ui->logview->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
// this->ui->logview->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
this->m_log = OZWCore::get()->getQTOZWManager()->getLog();
|
||||
connect(this->m_log, &QTOZWLog::newLogLine, this, &LogWindow::newMsg);
|
||||
this->m_log->syncroniseLogs();
|
||||
|
||||
this->m_scrollTimer.setInterval(500);
|
||||
connect(&this->m_scrollTimer, &QTimer::timeout, this, &LogWindow::scrollWindow);
|
||||
|
@ -49,4 +46,13 @@ void LogWindow::scrollWindow()
|
|||
void LogWindow::init() {
|
||||
this->m_logModel = new QTOZWLogModel(this->m_log, this);
|
||||
this->ui->logview->setModel(this->m_logModel);
|
||||
connect(this->m_log, &QTOZWLog::readyChanged, this, &LogWindow::logsReady);
|
||||
if (this->m_log->isReady())
|
||||
this->logsReady(true);
|
||||
}
|
||||
|
||||
void LogWindow::logsReady(bool ready) {
|
||||
if (ready) {
|
||||
this->m_log->syncroniseLogs();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
private slots:
|
||||
void newMsg(QDateTime time, LogLevels::Level level, quint8 s_node, QString s_msg);
|
||||
void scrollWindow();
|
||||
void logsReady(bool ready);
|
||||
private:
|
||||
Ui::LogWindow *ui;
|
||||
bool viewAtBottom = true;
|
||||
|
|
|
@ -247,8 +247,8 @@ void MainWindow::CloseConnection() {
|
|||
if (OZWCore::get()->getQTOZWManager()->getConnectionType() == ConnectionType::Type::Local) {
|
||||
OZWCore::get()->getQTOZWManager()->close();
|
||||
} else if (OZWCore::get()->getQTOZWManager()->getConnectionType() == ConnectionType::Type::Remote) {
|
||||
//QMessageBox::critical(this, "Close Connection", "TODO: Please restart the application for now");
|
||||
//exit(1);
|
||||
QMessageBox::critical(this, "Close Connection", "TODO: Please restart the application for now");
|
||||
QCoreApplication::exit(0);
|
||||
} else {
|
||||
//QMessageBox::critical(this, "Unknown Connection Type", "Unknown Connection Type");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue