Example #1
0
	void Button::baseUpdateEnable()
	{
		updateButtonState();
		if (!getEnabled())
		{
			mIsMouseFocus = false;
		}
	}
Example #2
0
	void Button::setStateSelected(bool _check)
	{
		if (mStateSelected == _check)
			return;

		mStateSelected = _check;
		updateButtonState();
	}
Example #3
0
	void Button::setState(state s)
	{
		if (s == _state)
			return;
		//printf("set state: %d\n", (int)s);
		_state = s;
		updateButtonState(s);
	}
Example #4
0
	void StrangeButton::baseUpdateEnable()
	{
		updateButtonState();
		if (!mEnabled)
		{
			mIsMouseFocus = false;
		}
	}
Example #5
0
void VAttachmentList::deleteSelectedItems()
{
    QVector<ConfirmItemInfo> items;
    const QList<QListWidgetItem *> selectedItems = m_attachmentList->selectedItems();

    if (selectedItems.isEmpty()) {
        return;
    }

    for (auto const & item : selectedItems) {
        items.push_back(ConfirmItemInfo(item->text(),
                                        item->text(),
                                        "",
                                        NULL));
    }

    QString text = tr("Are you sure to delete these attachments of note "
                      "<span style=\"%1\">%2</span>?")
                     .arg(g_config->c_dataTextStyle).arg(m_file->getName());

    QString info = tr("Deleted files could be found in the recycle "
                      "bin of this note.<br>"
                      "Click \"Cancel\" to leave them untouched.");

    VConfirmDeletionDialog dialog(tr("Confirm Deleting Attachments"),
                                  text,
                                  info,
                                  items,
                                  false,
                                  false,
                                  false,
                                  g_mainWin);
    if (dialog.exec()) {
        items = dialog.getConfirmedItems();

        QVector<QString> names;
        for (auto const & item : items) {
            names.push_back(item.m_name);
        }

        if (!m_file->deleteAttachments(names)) {
            VUtils::showMessage(QMessageBox::Warning,
                                tr("Warning"),
                                tr("Fail to delete attachments of note <span style=\"%1\">%2</span>.")
                                  .arg(g_config->c_dataTextStyle)
                                  .arg(m_file->getName()),
                                tr("Please check the attachments folder and "
                                   "maintain the configuration file manually."),
                                QMessageBox::Ok,
                                QMessageBox::Ok,
                                g_mainWin);
        }

        updateButtonState();

        updateContent();
    }
}
Example #6
0
void DialogueBoxWidget::showOptionDialogueBox(const NPCData::OptionDialogueNode& optionNode)
{
    _dialoguePartIndex = 0;
    _currentDialogueNode = dynamic_cast<const NPCData::DialogueNode*>(&optionNode);

    // Update current dialogue index
    updateDialogue(0);
    updateButtonState();
}
Example #7
0
	void Button::onMouseButtonPressed(int _left, int _top, MouseButton _id)
	{
		if (_id == MouseButton::Left) {
			mIsMousePressed = true;
			updateButtonState();
		}

		Base::onMouseButtonPressed(_left, _top, _id);
	}
Example #8
0
	void StrangeButton::onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id)
	{
		if (_id == MyGUI::MouseButton::Left)
		{
			mIsMousePressed = false;
			updateButtonState();
		}

		Base::onMouseButtonReleased(_left, _top, _id);
	}
Example #9
0
void Button::onLButtonUp()
{
	mouseDown_ = false;
	updateButtonState();

	if (clickFunc_)
	{
		clickFunc_(this);
	}
}
Example #10
0
    void SharedStateButton::setStateSelected(bool _value)
    {
        Base::setStateSelected(_value);
        updateButtonState();

        for (ButtonGroup::iterator it = mSharedWith.begin(); it != mSharedWith.end(); ++it)
        {
            (*it)->MyGUI::Button::setStateSelected(getStateSelected());
        }
    }
Example #11
0
void FaceTrackNoIR::startTracker( ) {
    b->save();
    loadSettings();
    bindKeyboardShortcuts();

    if (Libraries)
        delete Libraries;
    Libraries = new SelectedLibraries(this);

    if (!Libraries->correct)
    {
        QMessageBox::warning(this, "Something went wrong", "Tracking can't be initialized, probably protocol prerequisites missing", QMessageBox::Ok, QMessageBox::NoButton);
        stopTracker();
        return;
    }
    
#if defined(_WIN32)
    keybindingWorker = new KeybindingWorker(*this, keyCenter, keyToggle);
    keybindingWorker->start();
#endif

    if (tracker) {
        tracker->wait();
        delete tracker;
    }

    {
        QSettings settings("opentrack");
        QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
        QSettings iniFile( currentFile, QSettings::IniFormat );

        for (int i = 0; i < 6; i++)
        {
            axis(i).curve.loadSettings(iniFile);
            axis(i).curveAlt.loadSettings(iniFile);
        }
    }

    tracker = new Tracker ( this, s );

    if (pTrackerDialog && Libraries->pTracker) {
        pTrackerDialog->registerTracker( Libraries->pTracker );
	}
    
    if (pFilterDialog && Libraries->pFilter)
        pFilterDialog->registerFilter(Libraries->pFilter);
    
    tracker->start();

    ui.video_frame->show();

    timUpdateHeadPose.start(50);

    updateButtonState(true);
}
Example #12
0
void Wizard::setCurrentPage(int indx)
{
    m_currentId = indx;
    m_pages[indx]->initializePage();

    m_stack->setCurrentIndex(indx);
    m_title->setText(m_pages[indx]->title());
    m_subTitle->setTitle(m_pages[indx]->subTitle());

    updateButtonState();
}
Example #13
0
void TabCombo::addChild(Handler<Element> const& h, std::string const& title)
{
	//ボタンの作成
	Handler<TabButton> const btn(new TabButton(log(), world(), top_));
	btn->text(title);
	btn->setVertical( (this->buttonPosition_ == ButtonPosition::Left) || (this->buttonPosition_ == ButtonPosition::Right) );
	btn->tab(self().cast<TabCombo>());
	btn->element(h);

	//ボタンの登録
	Handler<Element> front = this->frontChild(); //もともとの最終エレメント
	this->buttonMap_.insert(h, btn);
	this->frame_->addChild(h);
	this->buttons_->addChild(btn, SplitComboContext(1));

	//トグル状態の変更を通知
	updateButtonState(h, btn);
	if(front){ //ボタンがない状態で最初の登録をした時、これはnullになる
		updateButtonState(front, Handler<TabButton>());
	}
}
Example #14
0
Handler<Element> TabCombo::removeChild(Handler<Element> const& h)
{
	auto it = this->buttonMap_.find(h);
	Handler<TabButton> btn(it->second);
	this->buttonMap_.erase(it);
	this->buttons_->removeChild(btn);
	this->frame_->removeChild(h);
	if(Handler<Element> front = this->frontChild()){ //もうボタンが残っていない場合、nullが帰ってくるので
		updateButtonState(front, Handler<TabButton>());
	}
	return h;
}
Example #15
0
Handler<Element> TabCombo::removeChild(std::size_t const& idx)
{
	Handler<Element> elm(this->frame_->removeChild(idx));
	auto const it = this->buttonMap_.find(elm);
	Handler<TabButton> btn(it->second);
	this->buttonMap_.erase(it);
	this->buttons_->removeChild(btn);
	if(Handler<Element> front = this->frontChild()){ //もうボタンが残っていない場合、nullが帰ってくるので
		updateButtonState(front, Handler<TabButton>());
	}
	return elm;
}
EqualizerPresetManager::EqualizerPresetManager( QWidget *parent )
        : KDialog( parent )
{
    setCaption( i18n("Presets") );
    setModal( true );
    setButtons( Ok | Cancel | Default );
    setDefaultButton( Ok );
    showButtonSeparator( true );

    QWidget *mainWidget = new QWidget( this );
    setMainWidget( mainWidget );
    QHBoxLayout *mainLayout = new QHBoxLayout( mainWidget, 0, spacingHint() );

    m_presetsView = new K3ListView( mainWidget );
    m_presetsView->setObjectName( "presetListView" );
    m_presetsView->addColumn( i18n( "Presets" ) );
    m_presetsView->setFullWidth( true );
    connect(m_presetsView, SIGNAL( selectionChanged() ), SLOT( updateButtonState() ));
    connect(m_presetsView, SIGNAL( doubleClicked ( Q3ListViewItem*, const QPoint&, int ) ), SLOT( slotRename() ));
    mainLayout->addWidget( m_presetsView );

    QVBoxLayout* buttonsLayout = new QVBoxLayout( mainLayout );

    m_renameBtn = new QPushButton( i18n("&Rename"), mainWidget, "renameBtn" );
    m_deleteBtn = new QPushButton( i18n("&Delete"), mainWidget, "deleteBtn" );

    buttonsLayout->addWidget( m_renameBtn );
    buttonsLayout->addWidget( m_deleteBtn );

    connect(m_renameBtn, SIGNAL( clicked() ), SLOT( slotRename() ));
    connect(m_deleteBtn, SIGNAL( clicked() ), SLOT( slotDelete() ));
    connect(this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ));

    QSpacerItem* spacer = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );
    buttonsLayout->addItem( spacer );

    updateButtonState();

    resize( QSize(300, 250).expandedTo(minimumSizeHint()) );
}
Example #17
0
void GroupWisePrivacyDialog::slotApply()
{
	if ( m_dirty )
	{
		commitChanges();
		m_dirty = false;
		updateButtonState();
	}
#ifdef __GNUC__
#warning "kde4: port it"
#endif
	//KDialogBase::slotApply();
}
Example #18
0
	void StrangeButton::onMouseLostFocus(MyGUI::Widget* _new)
	{
		Base::onMouseLostFocus(_new);
		mIsMouseFocus = false;

		if (mText == nullptr) return;
		std::string s, str = mText->getCaption();
		for (int i = (int)str.length() - 1; i >= 0; i--)
			s += str[i];
		
		mText->setCaption(s);

		updateButtonState();
	}
Example #19
0
void SatellitesConfigDialog::setupDataSourcesTab()
{
    connect( m_configWidget->buttonAddDataSource,
        SIGNAL(clicked()), SLOT(addDataSource()) );
    connect( m_configWidget->buttonOpenDataSource,
        SIGNAL(clicked()), SLOT(openDataSource()) );
    connect( m_configWidget->buttonRemoveDataSource,
        SIGNAL(clicked()), SLOT(removeSelectedDataSource()) );
    connect( m_configWidget->buttonReloadDataSources,
        SIGNAL(clicked()), SLOT(reloadDataSources()) );

    connect( m_configWidget->listDataSources,
        SIGNAL(itemSelectionChanged()), SLOT(updateButtonState()) );
}
Example #20
0
void Wizard::addPage(WizardPage* page)
{

    m_pages.push_back(page);
    m_stack->addWidget(page);
    page->setWizard(this);

    if (m_currentId == -1)
    {
        setCurrentPage(0);
    }

    updateButtonState();
}
Example #21
0
void GroupWisePrivacyDialog::slotAllowClicked()
{
	// take each selected item from the deny list and add it to the allow list
	for( int i = m_privacy.denyList->count() - 1; i >= 0 ; --i )
	{
		if ( m_privacy.denyList->isSelected( i ) )
		{
			m_dirty = true;
			Q3ListBoxItem * lbi = m_privacy.denyList->item( i );
			m_privacy.denyList->takeItem( lbi );
			m_privacy.allowList->insertItem( lbi );
		}
	}
	updateButtonState();
}
Example #22
0
	void Button::setEnabled(bool _enabled)
	{
		if (mEnabled == _enabled) return;
		mEnabled = _enabled;

		for (VectorWidgetPtr::iterator iter = mWidgetChild.begin(); iter != mWidgetChild.end(); ++iter) {
			(*iter)->setEnabled(_enabled);
		}

		updateButtonState();

		if ( ! mEnabled) {
			InputManager::getInstance()._unlinkWidget(this);
			mIsMouseFocus = false;
		}
	}
Example #23
0
void GroupWisePrivacyDialog::slotBlockClicked()
{
	// take each selected item from the allow list and add it to the deny list
	// start at the bottom, as we are changing the contents of the list as we go
	for( int i = m_privacy.allowList->count() - 1; i >= 0 ; --i )
	{
		if ( m_privacy.allowList->isSelected( i ) )
		{
			m_dirty = true;
			Q3ListBoxItem * lbi = m_privacy.allowList->item( i );
			m_privacy.allowList->takeItem( lbi );
			m_privacy.denyList->insertItem( lbi );
		}
	}
	updateButtonState();
}
Example #24
0
bool Pendant::update() {
  now = millis();

  if (buttonPressedAt) {
    // Cycle modes when held for a long time
    if (now > (buttonPressedAt + PENDANT_CYCLE_DELAY)) {
      toggleCycleMode();
    } else if (now > (buttonPressedAt + PENDANT_SLEEP_DELAY)) {
      sleepOnRelease = true;
    }
  }

  // Update pushed button state.
  updateButtonState();

  // Handle button release.
  if (buttonReleased()) {
    if (sleepOnRelease) {
      sleepNow();
    } else if (changeModeOnRelease) {
      mode++;
      if (cyclingMode) lastCycle = now;
    } else {
      changeModeOnRelease = true;
    }
  }

  // Cycle mode if we are cycling, and it's time.
  if (cyclingMode && (now > (lastCycle + PENDANT_CYCLE_DURATION))) {
    lastCycle = now;
    mode++;
  }

  // Go black to indicate power off.
  if (sleepOnRelease) {
    FastLED.showColor(CRGB::Black);
  }

  // Do the animations!
  // YAY!
  else {
    if (mode >= modes) mode = 0;
    return true;
  }

  return false;
}
Example #25
0
void FaceTrackNoIR::stopTracker( ) {
    ui.game_name->setText("Not connected");
#if defined(_WIN32)
    if (keybindingWorker)
    {
        keybindingWorker->should_quit = true;
        keybindingWorker->wait();
        delete keybindingWorker;
        keybindingWorker = NULL;
    }
#endif
	timUpdateHeadPose.stop();
    ui.pose_display->rotateBy(0, 0, 0);

    if (pTrackerDialog) {
        pTrackerDialog->unRegisterTracker();
        delete pTrackerDialog;
        pTrackerDialog = nullptr;
    }
    if (pProtocolDialog) {
        pProtocolDialog->unRegisterProtocol();
        delete pProtocolDialog;
        pProtocolDialog = nullptr;
    }
    if (pFilterDialog)
    {
        pFilterDialog->unregisterFilter();
        delete pFilterDialog;
        pFilterDialog = nullptr;
    }
    if (pSecondTrackerDialog)
    {
        pSecondTrackerDialog->unRegisterTracker();
        delete pSecondTrackerDialog;
        pSecondTrackerDialog = nullptr;
    }

    if ( tracker ) {
		delete tracker;
		tracker = 0;
        if (Libraries) {
            delete Libraries;
            Libraries = NULL;
        }
	}
    updateButtonState(false);
}
Example #26
0
void DialogueBoxWidget::showBox()
{
    _dialoguePartIndex = 0;

    // Get a random dialogue node
    const std::vector<NPCData::DialogueNode>& dialogue_tree = _npcData->dialogues.dialogue_tree;
    std::default_random_engine rdEngine(time(NULL));
    std::uniform_int_distribution<std::size_t> dis(0, dialogue_tree.size() - 1);

    size_t randomDialogueIndex = dis(rdEngine);
    _currentDialogueNode = &dialogue_tree[randomDialogueIndex];

    // Update current dialogue index
    updateDialogue(0);
    updateButtonState();
    this->show();
}
Example #27
0
void Wizard::next()
{
    if (currentPageIsComplete() && validateCurrentPage())
    {

        updateButtonState();
        int nId = nextId();

        if ((nId == -1) && (m_currentId < m_pages.size()))
        {
            setCurrentPage(m_currentId + 1);
        }

        if (nId > -1 && nId < m_pages.size())
        {
            setCurrentPage(nId);
        }
    }
}
//删除当前的图像
void MeasureMarkersWindow::deleteImg() {
  if (mImgs.size() > 0) {
    //找到当前选择的文件名
    int index = mSlider->value();
    int name = mImgs[index - 1];

    //删除对应的文件
    QString n;
    n.sprintf("%d", name);
    QFile::remove(mMeasureFolder + "left_" + n + ".jpg");
    QFile::remove(mMeasureFolder + "right_" + n + ".jpg");
    QFile::remove(mMeasureFolder + "left_" + n + ".bmp");
    QFile::remove(mMeasureFolder + "right_" + n + ".bmp");
    QFile::remove(mMeasureFolder + n + ".txt");

    mImgs.erase(mImgs.begin() + index - 1);

    updateButtonState();
    updateCurrent(index);
  }
}
Example #29
0
/*!
 * Initializes the dialog window.
 * \param hint Default text sample.
 * \param replace Determines whether replace controls should be displayed.
 */
void SearchDialog::initialize(const QString & hint, bool replace)
{
  if (replace)
    setWindowTitle(tr("Replace"));
  else
    setWindowTitle(tr("Find"));

  ui_->findEdit->setText(hint);
  ui_->replaceLabel->setVisible(replace);
  ui_->replaceEdit->setVisible(replace);
  ui_->replaceButton->setVisible(replace);
  ui_->replaceAllButton->setVisible(replace);
  ui_->replaceButton->setDefault(replace);
  ui_->nextButton->setDefault(!replace);

  updateButtonState();

  // adjust widget height
  QApplication::processEvents();

  resize(width(), 0);
}
Example #30
0
void VAttachmentList::addAttachment()
{
    if (!m_file) {
        return;
    }

    static QString lastPath = QDir::homePath();
    QStringList files = QFileDialog::getOpenFileNames(g_mainWin,
                                                      tr("Select Files As Attachments"),
                                                      lastPath);
    if (files.isEmpty()) {
        return;
    }

    // Update lastPath
    lastPath = QFileInfo(files[0]).path();

    addAttachments(files);

    updateButtonState();

    updateContent();
}