summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-07-16 05:58:51 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-07-22 07:33:37 -0400
commitd1b4dec8ad1635738ada3dfbde5907e7f0df3448 (patch)
tree4ca1cd3b0bbaf95865bcd65e811f554742893ea2 /src/mainwindow.cpp
parent6217f910f095adea4b06f370726636b09efea4ed (diff)
moved setup to new LogList class
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp35
1 files changed, 2 insertions, 33 deletions
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<int>() << 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)