Ejemplo n.º 1
0
EnterVacationDialog::EnterVacationDialog( QWidget* parent )
    : QDialog( parent )
    , m_ui( new Ui::EnterVacationDialog )
    , m_selectedTaskId( -1 )
{
    setWindowTitle( tr( "Enter Vacation" ) );

    m_ui->setupUi( this );
    m_ui->startDate->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->startDate->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );
    m_ui->endDate->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->endDate->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );
    //set next week as default range
    const QDate referenceDate = QDate::currentDate().addDays( 7 );
    m_ui->startDate->setDate( Charm::weekDayInWeekOf( Qt::Monday, referenceDate ) );
    m_ui->endDate->setDate( Charm::weekDayInWeekOf( Qt::Friday, referenceDate ) );
    connect( m_ui->startDate, SIGNAL(dateChanged(QDate)), this, SLOT(updateButtonStates()) );
    connect( m_ui->endDate, SIGNAL(dateChanged(QDate)), this, SLOT(updateButtonStates()) );
    connect( m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(okClicked()) );
    connect( m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );
    connect( m_ui->selectTaskButton, SIGNAL(clicked()), this, SLOT(selectTask()) );
    QSettings settings;
    settings.beginGroup( QLatin1String("EnterVacation") );
    m_ui->hoursSpinBox->setValue( settings.value( QLatin1String("workHours"), 8 ).toInt() );
    m_ui->minutesSpinBox->setValue( settings.value( QLatin1String("workMinutes"), 0 ).toInt() );
    m_selectedTaskId = settings.value( QLatin1String("selectedTaskId"), -1 ).toInt();
    //reset stored ID if task does not exist anymore:
    if ( !DATAMODEL->taskExists( m_selectedTaskId ) )
        m_selectedTaskId = -1;
    updateButtonStates();
    updateTaskLabel();
}
Ejemplo n.º 2
0
void MainWindow::initializeUi()
{
    setWindowTitle(QString("%1 - V%2").arg(QApplication::applicationDisplayName()).arg(QApplication::applicationVersion()));

    // Seit item delegate to prevent editing the second and last column.
    ui->fileList->setItemDelegateForColumn(1, new NoEditDelegate());
    ui->fileList->setItemDelegateForColumn(2, new NoEditDelegate());

    // Styles
#ifdef Q_OS_MAC
    ui->fileList->setAttribute(Qt::WA_MacShowFocusRect, false);
#endif

    // Connect the buttons with the actions.
    connect(ui->addFileButton, &QPushButton::clicked, this, &MainWindow::on_actionAddFile_triggered);
    connect(ui->removeFileButton, &QPushButton::clicked, this, &MainWindow::on_actionRemoveFile_triggered);
    connect(ui->generateButton, &QPushButton::clicked, this, &MainWindow::on_actionGenerate_triggered);

    // Make sure the remove action/button is correctly set/
    connect(ui->fileList, &QTreeWidget::currentItemChanged, [=]{
        updateButtonStates();
    });

    // Update the initial button states.
    updateButtonStates();
}
TDriverExecuteDialog::TDriverExecuteDialog(const QString &cmd, const QStringList &args,
                                           QWidget *parent, Qt::WindowFlags f) :
    QDialog(parent, f),
    ui(new Ui::TDriverExecuteDialog),
    process(new QProcess(this)),
    cmdStr(cmd),
    argList(args),
    startOnShow(true),
    terminateFlag(false)
{
    ui->setupUi(this);
    ui->outputView->setOpenLinks(false);

    updateButtonStates();

    connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError)));
    connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus)));
    connect(process, SIGNAL(readyReadStandardError()), this, SLOT(readyReadStandardError()));
    connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyReadStandardOutput()));
    connect(process, SIGNAL(started()), this, SLOT(started()));
    connect(process, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState)));

    connect(ui->buttonBox->button(QDialogButtonBox::Abort), SIGNAL(clicked()), this, SLOT(terminate()));
    connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));

    connect(ui->outputView, SIGNAL(anchorClicked(QUrl)), this, SIGNAL(anchorClicked(QUrl)));
}
Ejemplo n.º 4
0
void MainWindow::on_actionRemoveFile_triggered()
{
    auto item = ui->fileList->currentItem();
    if (item != nullptr) {
        delete item;
    }
    updateButtonStates();
}
void TDriverExecuteDialog::showEvent(QShowEvent *)
{
    if (startOnShow && process->state() == QProcess::NotRunning) {
        process->start(cmdStr, argList);
        startOnShow = false;
    }
    updateButtonStates();
}
Ejemplo n.º 6
0
void EnterVacationDialog::selectTask()
{
    SelectTaskDialog dialog( this );
    if ( dialog.exec() != QDialog::Accepted )
        return;
    m_selectedTaskId = dialog.selectedTask();
    updateTaskLabel();
    updateButtonStates();
}
void UICloudProfileDetailsWidget::sltNameChanged(const QString &strName)
{
    /* Push changes back: */
    m_newData.m_strName = strName;

    /* Revalidate: */
    revalidate(m_pEditorName);
    /* Update button states: */
    updateButtonStates();
}
void UICloudProfileDetailsWidget::prepare()
{
    /* Prepare widgets: */
    prepareWidgets();

    /* Apply language settings: */
    retranslateUi();

    /* Update button states finally: */
    updateButtonStates();
}
Ejemplo n.º 9
0
AccountListDialog::AccountListDialog(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::AccountListDialog)
{
	ui->setupUi(this);

	m_accounts = MMC->accounts();
	// TODO: Make the "Active?" column show checkboxes or radio buttons.
	ui->listView->setModel(m_accounts.get());

	QItemSelectionModel* selectionModel = ui->listView->selectionModel();

	connect(selectionModel, &QItemSelectionModel::selectionChanged, 
			[this] (const QItemSelection& sel, const QItemSelection& dsel) { updateButtonStates(); });

	connect(m_accounts.get(), SIGNAL(listChanged), SLOT(listChanged));
	connect(m_accounts.get(), SIGNAL(activeAccountChanged), SLOT(listChanged));

	updateButtonStates();
}
Ejemplo n.º 10
0
void AddAction::updateForPageChange()
{
	if(indexOf(currentPage()) == 1) requestNextPress(); else cancelRequest();
	switch(indexOf(currentPage()))
	{	case 0: break;
		case 1: break;
		case 2: break;
		case 3: break;
		case 4: break;
	}
	updateButtonStates();
}
Ejemplo n.º 11
0
void MainWindow::on_actionAddFile_triggered()
{
    QSettings settings;
    auto files = QFileDialog::getOpenFileNames(this, tr("Select files to add"), settings.value(cSettingsAddFileDirectory, QString()).toString());
    if (files.size() > 0) {
        QFileInfo fileInfo(files.first());
        if (fileInfo.exists()) {
            settings.setValue(cSettingsAddFileDirectory, fileInfo.absolutePath());
        }
    }
    for (auto file : files) {
        addFileToList(file);
    }
    updateButtonStates();
}
Ejemplo n.º 12
0
// Play the color and sound for a pressed button until the button is released
void playPressedButtonColorAndSound()
{
    // Grab first color pressed by the user
    int pressedColor = getPressedColor();

    // Light corresponding light
    lightUpColor(pressedColor);

    // Loop until the user releases that button
    while (isPressed(pressedColor))
    {
        playSoundForColor(pressedColor);
        updateButtonStates();
    }
    noTone(SPEAKER_PIN);
    clearLights();
}
void UICloudProfileDetailsWidget::sltTableChanged(QTableWidgetItem *pItem)
{
    /* Make sure item is valid: */
    AssertPtrReturnVoid(pItem);
    const int iRow = pItem->row();
    AssertReturnVoid(iRow >= 0);

    /* Skip if one of items isn't yet created.
     * This can happen when 1st is already while 2nd isn't yet. */
    QTableWidgetItem *pItemK = m_pTableWidget->item(iRow, 0);
    QTableWidgetItem *pItemV = m_pTableWidget->item(iRow, 1);
    if (!pItemK || !pItemV)
        return;

    /* Push changes back: */
    const QString strKey = pItemK->text();
    const QString strValue = pItemV->text();
    m_newData.m_data[strKey] = qMakePair(strValue, m_newData.m_data.value(strKey).second);

    /* Revalidate: */
    revalidate(m_pTableWidget);
    /* Update button states: */
    updateButtonStates();
}
Ejemplo n.º 14
0
void AccountListDialog::listChanged()
{
	updateButtonStates();
}
Ejemplo n.º 15
0
void EclipsesBrowserDialog::updateEclipsesForYear( int year )
{
    m_eclModel->setYear( year );
    updateButtonStates();
}
Ejemplo n.º 16
0
int main(void) {
//	status_t status;		// Declaration of return variable for DAVE3 APIs (toggle comment if required)
	PORT0 ->HWSEL &= ~0x0000c000UL; //Faz pin 0.7 funcionar
	PORT0 ->HWSEL |= 0 << 14;
	DAVE_Init(); // Initialization of DAVE Apps
	//PORT0->HWSEL &= ~0x0000c000UL; //Faz pin 0.7 funcionar
	//PORT0->HWSEL |= 0 << 14;
	/*Etapa de inicializacao*/
	configure_E(); //Configura transceptor como emissor
	//IO004_SetPin(LED1); //Leds para debug
	//IO004_SetPin(LED2);
	//VER COMOFAS pra ligar analog do controle aqui ja

	psxHandShake();
	psxConfiguraControle();
	ADC001_GenerateLoadEvent(&ADC001_Handle0);
	ADC001_GetResult(&ADC001_Handle0, &result);
	Software_Timers_Init();
	/*Loop do controle*/
	while (1) {
		ADC001_GetResult(&ADC001_Handle0, &result);
		pwm_max = PWM_LIM;
		/*Inicializa o que sera mandado*/
		BOOLType blah2 = 1;
		BOOLType buzina = 1;
		BOOLType enable = 0;
		BOOLType albh2 = 1;
		BOOLType blah1 = 1;
		BOOLType albh1 = 1;
		int16_t pow1, pow2;
		/*Le controle*/
		psxLeControle();
		if (psx_status != 140) //Nao ta analogico
				{
			psxHandShake();
			psxConfiguraControle();
			continue;
		}
		/*Com dados do controle atribui valores e chama callbacks*/
		if (START && start) {
			start_state = 1;
			start();
		}
		if (SELECT && select) {
			select_state = 1;
			select();
		}
		if (L_DOIS && l_dois) {
			l_dois_state = 1;
			l_dois();
		}
		if (L_UM && l_um) {
			l_um_state = 1;
			l_um();
		}else if(!R_UM){
			acceleration_ticks=0;
		}
		if (L_TRES && l_tres) {
			l_tres_state = 1;
			l_tres();
		}
		if (R_UM && r_um) {
			r_um_state = 1;
			r_um();
		}else if(!L_UM){
			acceleration_ticks = 0;
		}
		if (R_DOIS && r_dois) {
			r_dois_state = 1;
			r_dois();
		}
		if (R_TRES && r_tres) {
			r_tres_state = 1;
			r_tres();
		}
		if (SQR && sqr) {
			sqr_state = 1;
			sqr(DEGRAU);
//			changeMode(DEGRAU);
		}
		if (TRIANGLE && triangle) {
			triangle_state = 1;
			triangle(LINEAR);
//			changeMode(LINEAR);
		}
		if (CIRCLE && circle) {
			circle_state = 1;
			circle(EXP);
//			changeMode(EXP);
		}
		if (CROSS && cross) {
			cross_state = 1;
			cross();
		}
		if (LEFT && left) {
			left_state = 1;
			left();
		}
		if (RIGHT && right) {
			right_state = 1;
			right();
		}
		if (UP && up) {
			up_state = 1;
			up();
		}
		if (DOWN && down) {
			down_state = 1;
			down();
		}

		//

		data_E[0] = pwm_max;
		//if (psxDado[5] == 0 && psxDado[3] == 0) continue; //Enquanto for zero nao faz nada -> tirar quando ligar o analogico
		pow1 = (psxDado[5] - 127); //<<1; //Analog esq //Subtrai 127 para saber o sentido
		pow2 = (psxDado[3] - 127); //<<1;
		data_E[3] = 0;
		int16_t temp; //Variavel para armazenamento temporario dos calculos
		if (!flipped) //Robo virado, variavel atribuida pelo clique de um botao
		{
			if (pow1 < -30)
				albh2 = 0; //ok
			else if (pow1 > 30)
				blah2 = 0; //ok
			else {
				albh2 = 1;
				blah2 = 0;
			}
			if (pow2 < -30)
				albh1 = 0;
			else if (pow2 > 30)
				blah1 = 0;
			else {
				albh1 = 1;
				blah1 = 0;
			}
			temp = pow1 > 0 ? pow1 * 2 : (-pow1) * 2;
			if (temp > 255)
				temp = 255;
			data_E[1] = temp * pwm_max / 100;
			temp = pow2 > 0 ? pow2 * 2 : (-pow2) * 2;
			if (temp > 255)
				temp = 255;
			data_E[2] = temp * pwm_max / 100;
		} else {
			if (pow2 > 30)
				albh2 = 0; //ok
			else if (pow2 < -30)
				blah2 = 0; //ok
			else {
				albh2 = 1;
				blah2 = 0;
			}
			if (pow1 > 30)
				albh1 = 0;
			else if (pow1 < -30)
				blah1 = 0;
			else {
				albh1 = 1;
				blah1 = 0;
			}
			temp = pow1 > 0 ? pow1 * 2 : (-pow1) * 2;
			if (temp > 255)
				temp = 255;
			data_E[2] = temp * pwm_max / 100;
			temp = pow2 > 0 ? pow2 * 2 : (-pow2) * 2;
			if (temp > 255)
				temp = 255;
			data_E[1] = temp * pwm_max / 100;
		}
		//if (data_E[1] > 20 || data_E[2] > 20) enable = 1;

		char data_0 = (mode & 1);
		char data_1 = ((mode >> 1) & 1);

//		data_E[3] = data_E[3] | (blah1 << BLAH1) | (blah2 << BLAH2)
//				| (albh1 << ALBH1) | (albh2 << ALBH2) | (enable << ENABLE)
//				| (buzina << BUZINA);
		data_E[3] = data_E[3] | (blah1 << BLAH1) | (blah2 << BLAH2)
						| (albh1 << ALBH1) | (albh2 << ALBH2) | (data_1 << ENABLE)
						| (data_0 << BUZINA);
		data_E[4] = result.Result >> 4; //Resultado tem precisao de 12bits, divide por 16 para obter 8 bits = 1 byte

		last_value_left = data_E[1];
		last_value_right = data_E[2];

		write_E();
		updateButtonStates();
	}
	return 0;
}
Ejemplo n.º 17
0
//it might not be a great idea to hard code the order of the button array into their actions but.....
//																						  whatever
void GUI::doButtonStuff(int buttonNum){
	switch(buttonNum){
	case -1:
		if(gesture==4)
			weShouldGoHomeNow();
	break;
	case 0:
		isHeadOn=true;isLeftArmOn=true;isRightArmOn=true;isChestOn=true;isPelvisOn=true;
		std::cout<<"ALL ON"<<buttonNum<<std::endl;
	break;
	case 1:
		isOcculusOn=false;isHeadOn=false;isLeftArmOn=false;isRightArmOn=false;isChestOn=false;isPelvisOn=false;
	break;
	case 3:
		isOcculusOn=false;
	break;
	case 4:
		isHeadOn=!isHeadOn;
	break;
	case 5:
		isLeftArmOn=!isLeftArmOn;
	break;
	case 6:
		isRightArmOn=!isRightArmOn;
	break;
	case 7:
		isChestOn=!isChestOn;
	break;
	case 8:
		isPelvisOn=!isPelvisOn;
	break;
	case 9:
		areWeRecording=!areWeRecording;
		if(areWeRecording){
			struct timeval tp;
			gettimeofday(&tp, NULL);
			startTime=tp.tv_sec * 1000 + tp.tv_usec / 1000;
			std::ostringstream concat;
			concat<<"/home/hoenir/valkrieCommandRecords/records"<<startTime;
			latestName=concat.str();
			std::ofstream fileCreator(latestName.c_str());
			fileCreator.close();
  		recordFile.open(latestName.c_str());
			weShouldGoHomeNow();
		}
		else{
			recordFile.close();
		}
	break;
	case 10:
		{
			std::ostringstream concat2;
			concat2<<"python ~/numl_catkin_ws/src/numl_val_mirror/src/publishSaveFile.py"<<latestName;
	 		system(concat2.str().c_str());
		}
	break;
	case 11:
		weShouldGoHomeNow();
	break;
	}
	updateButtonStates();
}
void TDriverExecuteDialog::stateChanged(QProcess::ProcessState /*newState*/)
{
    //ui->outputView->setTextColor(Qt::lightGray);
    //ui->outputView->append(tr("<i>PROCESS STATE changed to: %1</i>").arg(newState));
    updateButtonStates();
}
Ejemplo n.º 19
0
void PanelRadar::updateRadarDisplay()
{
	if (visibleItemsSelected())
	{
		mSelectedAvatar = mRadarList->getFirstSelected()->getUUID();
		//TODO: as we expand columns, make these numbers enums
		mSelectedDistance = mRadarList->getFirstSelected()->getColumn(1)->getValue().asReal(); 
	}
	else
	{
		mSelectedAvatar.setNull();
		mSelectedDistance = -1.0f;
	}

	S32 scroll_pos = mRadarList->getScrollPos();

	LLSD element;

	// Zap all the avie names. Zap zap zap!
	mRadarList->deleteAllItems();

	U32 chat_distance = gSavedSettings.getU32("ChatDistance");
	F32 range = gSavedSettings.getF32("NearMeRange");
	bool notify_chat = gSavedSettings.getBOOL("MiniMapNotifyChatRange");
	bool notify_sim = gSavedSettings.getBOOL("MiniMapNotifySimRange");
// [RLVa:KB] - Alternate: Imprudence-1.2.0
	if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
	{
		notify_chat = false;
		notify_sim = false;
	}
// [/RLVa:KB]

	std::map<LLUUID, PanelRadarEntry>::iterator mIt;
	for (mIt = mAvatars.begin(); mIt != mAvatars.end(); ++mIt)
	{
		PanelRadarEntry* entry = &mIt->second;

		LL_DEBUGS("Radar") << "Avatar :" << entry->getName()
						   << " Position: " << entry->getPosition()
						   << " Your Position: " << gAgent.getPositionGlobal()
						   << " Distance: " << entry->getDistance()
						   << " Status: " << entry->getStatus()
						   << " Notified: " << entry->getNotified()
						   << " Timer Seconds: " << entry->getStatusTimer().getElapsedTimeF32()
						   << LL_ENDL;

		// Check if they're in certain ranges and notify user if we've enabled that, starting with chat range
		// We round for accuracy when avs tp in
		std::string dist_string = llformat("%.1f", llround(entry->getDistance(), 0.1f));

		// Don't notify if we don't know their name. It takes a few seconds for names to load on OpenSim, anyway
		if (entry->getName() != getString("unknown_avatar"))
		{
			if (notify_sim && 
				(entry->getNotified() < RADAR_NOTIFIED_SIM))
			{
				LLViewerObject *av_obj = gObjectList.findObject(entry->getID());
				if (av_obj != NULL && av_obj->isAvatar())
				{
					LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
					if (avatarp != NULL)
					{
						if (avatarp->getRegion() == gAgent.getRegion())
						{
							LLChat chat;
							LLUIString notify = getString("entering_sim_range");
							notify.setArg("[NAME]", entry->getName());
							notify.setArg("[DISTANCE]", dist_string);
							chat.mText = notify;
							chat.mSourceType = CHAT_SOURCE_SYSTEM;
							LLFloaterChat::addChat(chat, FALSE, FALSE);
							entry->setNotified(RADAR_NOTIFIED_SIM);
						}
					}
				}
			}
			else if (notify_chat && 
					(entry->getDistance() < chat_distance) && 
					(entry->getNotified() < RADAR_NOTIFIED_CHAT))
			{
				LLChat chat;
				LLUIString notify = getString("entering_chat_range");
				notify.setArg("[NAME]", entry->getName());
				notify.setArg("[DISTANCE]", dist_string);
				chat.mText = notify;
				chat.mSourceType = CHAT_SOURCE_SYSTEM;
				LLFloaterChat::addChat(chat, FALSE, FALSE);
				entry->setNotified(RADAR_NOTIFIED_CHAT);
			}
		}

		// Only display avatars in range
		if (entry->getDistance() <= range)
		{
			// Append typing string
			std::string typing = "";
			if (entry->getStatus() == RADAR_STATUS_TYPING)
			{
				typing = getString("is_typing")+ " ";
			}

			std::string mute_text = LLMuteList::getInstance()->isMuted(entry->getID()) ? getString("is_muted") : "";
			element["id"] = entry->getID();
			element["columns"][0]["column"] = "avatar_name";
			element["columns"][0]["type"] = "text";
//			element["columns"][0]["value"] = typing + entry->getName() + " " + mute_text;
// [RLVa:KB] - Alternate: Imprudence-1.2.0
			element["columns"][0]["value"] =
				(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
					? gRlvHandler.getAnonym(entry->getName())
					: typing + entry->getName() + " " + mute_text;
// [/RLVa:KB]
			element["columns"][1]["column"] = "avatar_distance";
			element["columns"][1]["type"] = "text";
			element["columns"][1]["value"] = dist_string+"m";

			mRadarList->addElement(element, ADD_BOTTOM);
		}
	}

	mRadarList->sortItems();
	mRadarList->setScrollPos(scroll_pos);
	if (mSelectedAvatar.notNull())
	{
		mRadarList->selectByID(mSelectedAvatar);
	}

	LLUIString av_count_string = (mRadarList->getItemCount() == 1) ? getString("avatars_in_singular") : getString("avatars_in_plural");
	av_count_string.setArg("[COUNT]", llformat("%d", mRadarList->getItemCount()));
	childSetText("avatar_count", av_count_string.getString());

	updateButtonStates();

	LL_DEBUGS("Radar") << "mSelectedAvatar: " << mSelectedAvatar.asString() << LL_ENDL;
}