| 138 | }; |
| 139 | |
| 140 | LogPage::LogPage(InstancePtr instance, QWidget* parent) : QWidget(parent), ui(new Ui::LogPage), m_instance(instance) |
| 141 | { |
| 142 | ui->setupUi(this); |
| 143 | ui->tabWidget->tabBar()->hide(); |
| 144 | |
| 145 | m_proxy = new LogFormatProxyModel(this); |
| 146 | |
| 147 | // set up fonts in the log proxy |
| 148 | { |
| 149 | QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString(); |
| 150 | bool conversionOk = false; |
| 151 | int fontSize = APPLICATION->settings()->get("ConsoleFontSize").toInt(&conversionOk); |
| 152 | if (!conversionOk) { |
| 153 | fontSize = 11; |
| 154 | } |
| 155 | m_proxy->setFont(QFont(fontFamily, fontSize)); |
| 156 | } |
| 157 | |
| 158 | ui->text->setModel(m_proxy); |
| 159 | |
| 160 | // set up instance and launch process recognition |
| 161 | { |
| 162 | auto launchTask = m_instance->getLaunchTask(); |
| 163 | if (launchTask) { |
| 164 | setInstanceLaunchTaskChanged(launchTask, true); |
| 165 | } |
| 166 | connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::onInstanceLaunchTaskChanged); |
| 167 | } |
| 168 | |
| 169 | auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this); |
| 170 | connect(findShortcut, SIGNAL(activated()), SLOT(findActivated())); |
| 171 | auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this); |
| 172 | connect(findNextShortcut, SIGNAL(activated()), SLOT(findNextActivated())); |
| 173 | connect(ui->searchBar, SIGNAL(returnPressed()), SLOT(on_findButton_clicked())); |
| 174 | auto findPreviousShortcut = new QShortcut(QKeySequence(QKeySequence::FindPrevious), this); |
| 175 | connect(findPreviousShortcut, SIGNAL(activated()), SLOT(findPreviousActivated())); |
| 176 | } |
| 177 | |
| 178 | LogPage::~LogPage() |
| 179 | { |