From d1b4dec8ad1635738ada3dfbde5907e7f0df3448 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Tue, 16 Jul 2019 05:58:51 -0400 Subject: moved setup to new LogList class --- src/mainwindow.cpp | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 107f3e09..4e91ef9f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -357,7 +357,7 @@ MainWindow::MainWindow(QSettings &initSettings m_CategoryFactory.loadCategories(); - setupLogList(); + ui->logList->addAction(ui->actionCopy_Log_to_Clipboard); int splitterSize = this->size().height(); // actually total window size, but the splitter doesn't seem to return the true value ui->topLevelSplitter->setSizes(QList() << splitterSize - 100 << 100); @@ -586,30 +586,6 @@ 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 @@ -6837,14 +6813,7 @@ void MainWindow::on_restoreModsButton_clicked() void MainWindow::on_actionCopy_Log_to_Clipboard_triggered() { - QStringList lines; - QAbstractItemModel *model = ui->logList->model(); - for (int i = 0; i < model->rowCount(); ++i) { - lines.append(QString("%1 [%2] %3").arg(model->index(i, 0).data().toString()) - .arg(model->index(i, 1).data(Qt::UserRole).toString()) - .arg(model->index(i, 1).data().toString())); - } - QApplication::clipboard()->setText(lines.join("\n")); + ui->logList->copyToClipboard(); } void MainWindow::on_categoriesAndBtn_toggled(bool checked) -- cgit v1.3.1