示例#1
0
void MainWindow::setupUI()
{
    ui->statusBar->addWidget(&statusLabel);

    ui->interestsListView->setModel( &interestsModel );
    //enum Interest { SIGHT, CULTURE, PARK, ENTERTAINMENT };
    interestsModel.appendRow(new SelectionItem("Достопримечательности"));
    interestsModel.appendRow(new SelectionItem("Культура"));
    interestsModel.appendRow(new SelectionItem("Парки"));
    interestsModel.appendRow(new SelectionItem("Развлечения"));

    ui->transportListView->setModel( &transportModel );
    //enum Transport {CAR, UNDERGROUND, BUS, TROLLEYBUS, TRAM, TAXI, FOOT};
    transportModel.appendRow(new SelectionItem("Автомобиль"));
    transportModel.appendRow(new SelectionItem("Метро"));
    transportModel.appendRow(new SelectionItem("Автобус"));
    transportModel.appendRow(new SelectionItem("Троллейбус"));
    transportModel.appendRow(new SelectionItem("Трамвай"));
    transportModel.appendRow(new SelectionItem("Маршрутка"));
    transportModel.appendRow(new SelectionItem("Пешком"));

    ui->sortTypeComboBox->addItem("По времени");
    ui->sortTypeComboBox->addItem("По стоимости");

    ui->createPlaceButton->setEnabled(false);
    ui->createRouteButton->setEnabled(false);
    ui->removeButton->setEnabled(false);

    ui->routesTableWidget->setColumnCount(5);

    QStringList horizontalLabels;
    horizontalLabels.append("Начало");
    horizontalLabels.append("Конец");
    horizontalLabels.append("Стоимость");
    horizontalLabels.append("Время");
    horizontalLabels.append("Действия");
    ui->routesTableWidget->setHorizontalHeaderLabels(horizontalLabels);

    fillPlaces(ui->startList);
    fillPlaces(ui->finishList);

    connect(&placeDialog,SIGNAL(accepted()),ui->mapWidget,SLOT(createPlace()));
    connect(&placeDialog,SIGNAL(rejected()), this, SLOT(cancelCreatingPlace()));
    connect(&placeDialog,SIGNAL(accepted()),this,SLOT(onPlaceDataEntered()));
    connect(&routeDialog,SIGNAL(accepted()),ui->mapWidget,SLOT(createRoute()));
    connect(&routeDialog,SIGNAL(rejected()), this, SLOT(cancelCreatingRoute()));
    connect(&routeDialog,SIGNAL(accepted()),this,SLOT(onRouteDataEntered()));
    connect(&saveDialog,SIGNAL(accepted()),this,SLOT(save()));
    connect(&saveDialog,SIGNAL(rejected()),this,SLOT(cancel()));
    connect(ui->mapWidget,SIGNAL(placeCreated(double,double)),this,SLOT(onPlaceCreated(double,double)));
    connect(ui->mapWidget,SIGNAL(routeCreated(int,int)),this,SLOT(onRouteCreated(int,int)));
    connect(ui->mapWidget,SIGNAL(firstPlaceSelected()),this,SLOT(onFirstPlaceSelected()));
    connect(ui->mapWidget,SIGNAL(secondPlaceSelected()),this,SLOT(onSecondPlaceSelected()));
    connect(ui->mapWidget, SIGNAL(mapReady()), this, SLOT(initMap()));
    connect(ui->mapWidget, SIGNAL(elementRemoved()), this, SLOT(onElementRemoved()));
    connect(ui->editMapButton, SIGNAL(clicked()), this, SLOT(editMode()));
    connect(ui->searchRoutesButton, SIGNAL(clicked()), this, SLOT(runRouteSearching()));

}
示例#2
0
FxRoute * FxMixer::createChannelSend( fx_ch_t fromChannel, fx_ch_t toChannel,
								float amount )
{
//	qDebug( "requested: %d to %d", fromChannel, toChannel );
	// find the existing connection
	FxChannel * from = m_fxChannels[fromChannel];
	FxChannel * to = m_fxChannels[toChannel];

	for( int i=0; i<from->m_sends.size(); ++i )
	{
		if( from->m_sends[i]->receiver() == to )
		{
			// simply adjust the amount
			from->m_sends[i]->amount()->setValue( amount );
			return from->m_sends[i];
		}
	}

	// connection does not exist. create a new one
	return createRoute( from, to, amount );
}