forked from simulationcraft/simc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc_importWindow.cpp
44 lines (38 loc) · 1.34 KB
/
sc_importWindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "sc_importWindow.hpp"
#include "MainWindow.hpp"
#include "sc_OptionsTab.hpp"
#include "simulationcraftqt.hpp"
BattleNetImportWindow::BattleNetImportWindow( SC_MainWindow* parent, bool embedded )
: QWidget( parent, Qt::Tool ),
m_mainWindow( parent ),
m_shortcut( embedded ? nullptr : new QShortcut( QKeySequence( "Ctrl+I" ), parent ) ),
m_importWidget( new BattleNetImportWidget( this ) ),
m_embedded( embedded )
{
if ( !m_embedded )
{
setWindowTitle( tr( "Import a character" ) );
m_shortcut->setContext( Qt::ApplicationShortcut );
connect( m_shortcut, SIGNAL( activated() ), this, SLOT( toggle() ) );
connect( m_mainWindow->optionsTab, SIGNAL( armory_region_changed( const QString& ) ), m_importWidget,
SLOT( armoryRegionChangedIn( const QString& ) ) );
}
connect( m_importWidget,
SIGNAL( importTriggeredOut( const QString&, const QString&, const QString&, const QString& ) ), m_mainWindow,
SLOT( startNewImport( const QString&, const QString&, const QString&, const QString& ) ) );
}
void BattleNetImportWindow::toggle()
{
if ( isVisible() )
{
QWidget::hide();
}
else
{
QWidget::raise();
QWidget::show();
activateWindow();
auto basePos = m_mainWindow->geometry();
move( basePos.center().x() - geometry().width() * .5, basePos.center().y() );
}
}