khanat-opennel-code/code/nel/rcerror/rcerror_widget.cpp
2015-02-19 00:20:18 +01:00

70 lines
1.7 KiB
C++

// Ryzom Core MMORPG framework - Error Reporter
//
// Copyright (C) 2015 Laszlo Kis-Adam
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "rcerror_widget.h"
#include <QTimer>
#include <QTextStream>
#include <QFile>
RCErrorWidget::RCErrorWidget( QWidget *parent ) :
QWidget( parent )
{
m_ui.setupUi( this );
QTimer::singleShot( 1, this, SLOT( onLoad() ) );
connect( m_ui.sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
connect( m_ui.canceButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
}
RCErrorWidget::~RCErrorWidget()
{
}
void RCErrorWidget::onLoad()
{
QFile f( m_fileName );
bool b = f.open( QFile::ReadOnly | QFile::Text );
if( !b )
{
return;
}
QTextStream ss( &f );
m_ui.reportEdit->setPlainText( ss.readAll() );
f.close();
}
void RCErrorWidget::onSendClicked()
{
close();
}
void RCErrorWidget::onCancelClicked()
{
close();
}
void RCErrorWidget::onCBClicked()
{
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
}