Mess around with log UI. Herp Derp.

This commit is contained in:
Petr Mrázek
2014-07-13 01:49:46 +02:00
parent 4c0dc51110
commit 977cc1cfbb
3 changed files with 103 additions and 82 deletions

View File

@ -29,7 +29,7 @@ OtherLogsPage::OtherLogsPage(BaseInstance *instance, QWidget *parent)
{
ui->setupUi(this);
m_watcher->setFileExpression(".*\\.log$");
m_watcher->setFileExpression("(.*\\.log(\\.[0-9]*)?$)|(crash-.*\\.txt)");
m_watcher->setRootDir(QDir::current().absoluteFilePath(m_instance->minecraftRoot()));
connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this,
@ -55,7 +55,6 @@ void OtherLogsPage::populateSelectLogBox()
{
ui->selectLogBox->clear();
ui->selectLogBox->addItems(m_watcher->files());
ui->selectLogBox->addItem(tr("Other"), true);
if (m_currentFile.isNull())
{
ui->selectLogBox->setCurrentIndex(-1);
@ -63,7 +62,8 @@ void OtherLogsPage::populateSelectLogBox()
else
{
const int index = ui->selectLogBox->findText(m_currentFile);
ui->selectLogBox->setCurrentIndex(index);
if(index != -1)
ui->selectLogBox->setCurrentIndex(index);
}
}
@ -72,15 +72,7 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
QString file;
if (index != -1)
{
if (ui->selectLogBox->itemData(index).isValid())
{
file = QFileDialog::getOpenFileName(
this, tr("Open log file"), m_instance->minecraftRoot(), tr("*.log;;*.txt;;*"));
}
else
{
file = ui->selectLogBox->itemText(index);
}
file = ui->selectLogBox->itemText(index);
}
if (file.isEmpty() || !QFile::exists(m_instance->minecraftRoot() + "/" + file))