void MyMainWindow::startScenario()
{
    ClearLogTextBrowser();
    if(!nameOfScenario.isEmpty())
    {
        SetButtonsState(true, true, false, true);
        mServerManager->InitServer(nameOfScenario);
    }

}
MyMainWindow::MyMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MyMainWindow),
    mServerManager(new QServerManager())
{    
    ui->setupUi(this);
    SetButtonsState(false, false, false, false);

    connect(&LogManager::Instance(), SIGNAL(updateLogs(const QString&)), this, SLOT(updateLogs(const QString&)));
    connect(mServerManager, SIGNAL(Finished(bool)), this, SLOT(ServerFinished(bool)));
}
Size SettingsView::RenderContent(Renderer* renderer)
{
    DestroyChildViews();

    RenderPosition renderPosition = RenderPosition(PaddingX, PaddingY);

    renderPosition = CreateSettingsGroups(RenderDescriptor(renderer, renderPosition));

    renderPosition = renderPosition.MoveY(LineHeight / 2).SetX(PaddingX);

    CreateControls(RenderDescriptor(renderer, renderPosition));

    SetButtonsState();

    return renderer->GetSize();
}
void SettingsView::CreateControls(RenderDescriptor renderDescriptor)
{
    RenderPosition renderPosition = CreateSaveButtonControl(renderDescriptor);

    cancelButton = CreateTextButtonControl(
        RenderDescriptor(renderDescriptor.GetRenderer(), renderPosition.MoveX(7, ScaleProvider)),
        L"Cancel",
        &OnCancelChanges);

    wstring resetButtonText = L"Reset";
    int resetButtonTextWidth = RenderingProvider->GetTextSize(resetButtonText, FontSmallUnderscored).GetWidth();

    int maxRightPosition = 0;
    for(size_t i = 0; i < settingsGroups.size(); ++i)
    {
        maxRightPosition = max(maxRightPosition, settingsGroups[i]->GetBoundingRect().GetRight());
    }
    int resetButtonPositionX = maxRightPosition - resetButtonTextWidth;

    resetButton = CreateTextButtonControl(RenderDescriptor(renderDescriptor.GetRenderer(), Point(resetButtonPositionX, renderPosition.GetY())), resetButtonText, &OnResetSettings);

    SetButtonsState();
}
void MyMainWindow::ServerFinished(bool success)
{
    SetButtonsState(true, true, true, false);
}
void MyMainWindow::StartButtonEnable()
{
    SetButtonsState(true, true, true, false);
}
void MyMainWindow::openFile()
{
    nameOfScenario = QFileDialog::getOpenFileName(this, "Choose file", "d:/", "XML-files (*.xml)");
    SetButtonsState(true, true, true, false);
}