summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-07-16 05:38:32 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-07-22 07:33:37 -0400
commit54d98e291701f2187174a67c186f1ea762c6b959 (patch)
tree5ef78396bf9bc364146ae7bd4dd9a9fee2529504 /src/mainwindow.cpp
parentbc9f286bce224743d244e540d55f26b55affbd4a (diff)
removed unused or redundant stuff in error_report.h
renamed log() to vlog() for now extracted console creation to Console class rewrote LogBuffer to work with logging from uibase, renamed to LogModel added fmt dependency
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4b5ef9ed..cd224414 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -357,17 +357,10 @@ MainWindow::MainWindow(QSettings &initSettings
m_CategoryFactory.loadCategories();
- ui->logList->setModel(LogBuffer::instance());
- ui->logList->setColumnWidth(0, 100);
- ui->logList->setAutoScroll(true);
- ui->logList->scrollToBottom();
- ui->logList->addAction(ui->actionCopy_Log_to_Clipboard);
+ setupLogList();
+
int splitterSize = this->size().height(); // actually total window size, but the splitter doesn't seem to return the true value
ui->topLevelSplitter->setSizes(QList<int>() << splitterSize - 100 << 100);
- connect(ui->logList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- ui->logList, SLOT(scrollToBottom()));
- connect(ui->logList->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- ui->logList, SLOT(scrollToBottom()));
updateProblemsButton();
@@ -593,6 +586,30 @@ MainWindow::MainWindow(QSettings &initSettings
updateModCount();
}
+void MainWindow::setupLogList()
+{
+ ui->logList->setModel(&LogModel::instance());
+
+ const int timestampWidth =
+ QFontMetrics(ui->logList->font()).width("00:00:00.000");
+
+ ui->logList->header()->setMinimumSectionSize(0);
+ ui->logList->header()->resizeSection(0, 20);
+ ui->logList->header()->resizeSection(1, timestampWidth + 8);
+
+ ui->logList->setAutoScroll(true);
+ ui->logList->scrollToBottom();
+ ui->logList->addAction(ui->actionCopy_Log_to_Clipboard);
+
+ connect(
+ ui->logList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ ui->logList, SLOT(scrollToBottom()));
+
+ connect(
+ ui->logList->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ ui->logList, SLOT(scrollToBottom()));
+}
+
void MainWindow::resetActionIcons()
{
// this is a bit of a hack