2013-05-30 02:18:28 +00:00
|
|
|
#include "articleinspector.hh"
|
|
|
|
|
2013-07-18 13:02:39 +00:00
|
|
|
#if QT_VERSION >= 0x040600
|
|
|
|
|
2013-06-17 18:30:21 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2013-05-30 02:18:28 +00:00
|
|
|
using std::list;
|
|
|
|
|
|
|
|
list< ArticleInspector * > ArticleInspector::openedInspectors;
|
|
|
|
|
|
|
|
ArticleInspector::ArticleInspector( Config::Class * cfg, QWidget* parent ) :
|
|
|
|
QWebInspector( parent ),
|
|
|
|
cfg( cfg )
|
|
|
|
{
|
|
|
|
if ( cfg == NULL )
|
|
|
|
throw exInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
ArticleInspector::~ArticleInspector()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArticleInspector::beforeClosed()
|
|
|
|
{
|
|
|
|
list< ArticleInspector * >::iterator itemIter = std::find( openedInspectors.begin(),
|
|
|
|
openedInspectors.end(), this );
|
|
|
|
if ( itemIter != openedInspectors.end() )
|
|
|
|
{
|
|
|
|
openedInspectors.erase( itemIter );
|
|
|
|
// Save geometry of the recent closed inspector window
|
|
|
|
QByteArray geometry = saveGeometry();
|
|
|
|
cfg->inspectorGeometry = geometry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArticleInspector::showEvent( QShowEvent * event )
|
|
|
|
{
|
|
|
|
if ( openedInspectors.empty() )
|
|
|
|
{
|
|
|
|
// Restore geometry from config, if no inspector opened
|
|
|
|
restoreGeometry( cfg->inspectorGeometry );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Load geometry from first inspector opened
|
|
|
|
ArticleInspector * p = openedInspectors.front();
|
|
|
|
setGeometry( p->geometry() );
|
|
|
|
}
|
|
|
|
|
|
|
|
openedInspectors.push_back( this );
|
|
|
|
|
|
|
|
QWebInspector::showEvent( event );
|
|
|
|
}
|
2013-07-18 13:02:39 +00:00
|
|
|
|
|
|
|
#endif // QT_VERSION
|