Example #1
3
void VirtualKeyboard::Update()
{
//TODO font set here
    imli_script_t script = imli_get_active_script(context_);
    if (script == SCRIPT_UNSUPPORTED) 
        return;
    
    QFont font = styles_[script].font();
    //font.setPointSize((script == SCRIPT_ASCII) ? 12 : 14);
    font.setPointSize(8);
    
    const QObjectList& objects = this->verticalLayoutWidget->children();

    int index = (shifted_ ? 1 : 0);
    
    for (int i = 0; i < objects.size(); i++)
    {
		
        QPushButton* child = dynamic_cast<QPushButton*>(objects.at(i));
        if (child)
        {
			child->setEnabled(true);
            QString name = getObjectName(child->objectName());
            if (name.length() > 2){
				continue;
            }
            
            child->setFont(font);
            char key = name.toAscii()[index];
            if (script != SCRIPT_ASCII)
            {
                syl_t syl = SYL_INVALID;
                int del;
                syl = imli_process_key(context_,
                                       key,
                                       SCRIPT_UNSUPPORTED,
                                       SYL_INVALID,
                                       FLAG_NONE,
                                       &del);
                if (syl != SYL_INVALID)
                {
                    QByteArray glyphs;
                    glyphs.reserve(32);
                    size_t len = 0;
                    
                    imli_status_t status = syl_to_glyphs(context_,
                                                         syl,
                                                         script,
                                                         (byte_t*)glyphs.data(), 
                                                         glyphs.capacity(),
                                                         &len);
                    if (status == IMLI_STATUS_OK)
                    {
                        glyphs.resize(len);
                        child->setText(QString::fromAscii(glyphs, glyphs.size()));
                    }
                    else
                    {
                        child->setText("");
                    }
                }
                else
                {
                    child->setText("");
                }
            }
            else
            {
                QString label(key);
                if (key == '&')
                    label.append('&');
                
                child->setText(label);
            }
            if(child->text().operator ==("")){
				child->setDisabled(true); //Disable empty buttons
            }
        }
    }
}
void AddCourseDialog::selectItem()
{
	QPushButton *button = qobject_cast<QPushButton *>( sender() );
	if( !button )
		return;

	int row = listWidget->currentRow();
	if( button->objectName() == "upButton" )
	{
		if( --row <= 0 )
			row = 0;
	}
	else if( button->objectName() == "downButton" )
	{
		if( ++row >= listWidget->count() )
		{
			row = listWidget->count() - 1;
			if( row <= 0 )
				row = 0;
		}
	}

	QListWidgetItem *item = listWidget->item(row);
	if( !item )
		return;
	
	listWidget->setCurrentItem( item );
	item->setSelected( true );

	listWidget->setFocus();
}
void CustomizeThemeDialog::openChooseIconDialog()
{
	QPushButton *button = qobject_cast<QPushButton *>(sender());
	SettingsPrivate *settings = SettingsPrivate::instance();

	// It's always more convenient when the dialog re-open at the same location
	QString openPath;
	QVariant variantOpenPath = settings->value("customIcons/lastOpenPath");
	if (variantOpenPath.isValid()) {
		openPath = variantOpenPath.toString();
	} else {
		openPath = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first();
	}

	QString path = QFileDialog::getOpenFileName(this, tr("Choose your custom icon"), openPath, tr("Pictures (*.jpg *.jpeg *.png)"));

	// Reset custom icon if path is empty (delete key in settings too)
	settings->setCustomIcon(button->objectName() + "Button", path);

	for (MediaButton *b : _mainWindow->findChildren<MediaButton*>(button->objectName() + "Button")) {
		if (b) {
			b->setIcon(QIcon(path));
		}
	}

	MediaButton *b = _mainWindow->findChild<MediaButton*>(button->objectName() + "Button");
	if (path.isEmpty()) {
		button->setIcon(QIcon(":/player/" + Settings::instance()->theme() + "/" + button->objectName()));
		b->setIcon(QIcon());
	} else {
		settings->setValue("customIcons/lastOpenPath", QFileInfo(path).absolutePath());
		button->setIcon(QIcon(path));
		b->setIcon(QIcon(path));
	}
}
Example #4
0
void LineEditPropertyFactory::OnButtonClicked()
{
    QPushButton *button = qobject_cast<QPushButton*>(sender());
    if (!button)
        return;

    QString function;
    for(uint i = 0; i < (uint)buttons_.size(); ++i)
    {
        if (buttons_[i].objectName == button->objectName())
        {
            function = buttons_[i].method;
            break;
        }
    }

    if(!function.isNull())
    {
        foreach(const ComponentWeakPtr &comp_ptr, components_)
        {
            ComponentPtr comp = comp_ptr.lock();
            if (comp)
            {
                QVariantList list;
                list.push_back(QVariant(button->objectName()));
                FunctionInvoker::Invoke(comp.get(), function, list);
            }
        }
Example #5
0
void VirtualKeyboard::SetupConnections()
{
    const QObjectList& objects = this->verticalLayoutWidget->children();
    for (int i = 0; i < objects.size(); i++)
    {
        QPushButton* button = qobject_cast<QPushButton*>(objects.at(i));
        if (button && button->objectName() != "caps" && button->objectName() != "shift")
        {
            connect(button, SIGNAL(clicked()), this, SLOT(Clicked()));
        }
    }
    connect(this->shift, SIGNAL(toggled(bool)), this, SLOT(setShifted(bool)));
}
void CatalogueDialog::okButtonClicked()
{
	bool close = false;
	QPushButton *button = qobject_cast<QPushButton *>( sender() );
	if( !button )
		close = false;
	else
	{
		if( button->objectName() == "showCloseButton" )
			close = true;
	}

	QTreeWidgetItem *item = treeWidget->currentItem();
	if( !item )
		return;

	int count = item->childCount();
	if( count == 0 )
	{
		QString str = item->text(0);
		emit pageRequested(str);

		if( close )
			accept();
	}
}
Example #7
0
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
	QPushButton *pBut = (QPushButton*)obj;
	QString objName = pBut->objectName();

	return QMainWindow::eventFilter(obj, event);
}
void TASARIM_BELGE_DEGISKENLERI_SECIMI::SLOT_DEGISKEN_KULLAN()
{
    QPushButton *button = static_cast<QPushButton*>(sender());

    m_degisken_listesi.at( button->objectName().split("\t").at(0).toInt())->SET_VISIBLE( true );
    button->setEnabled( false );

}
Example #9
0
void MainWindow::makeSignalMapper() {
    signalMapper = new QSignalMapper(this);

    for (int i=0; i < buttons->size(); ++i) {
        QPushButton *button = buttons->at(i);
        connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(button, button->objectName());
    }

    connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(cardClicked(const QString &)));
}
Example #10
0
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
	QPushButton *pBut = (QPushButton*)obj;
	QString objName = pBut->objectName();
	int index = 0;
	if ( objName.compare("pushButton_0") == 0 ) index = DISPLAYTYPE;
	else if( objName.compare("pushButton_1") == 0 ) index = DISPLAYTYPE1;
	else if( objName.compare("pushButton_2") == 0 ) index = DISPLAYTYPE2;
	else if( objName.compare("pushButton_3") == 0 ) index = DISPLAYTYPE3;
	else if( objName.compare("pushButton_4") == 0 ) index = DISPLAYTYPE4;
	else if( objName.compare("pushButton_5") == 0 ) index = DISPLAYTYPE5;
	else if( objName.compare("pushButton_6") == 0 ) index = DISPLAYTYPE6;
	else if( objName.compare("pushButton_7") == 0 ) index = DISPLAYTYPE7;
	else if( objName.compare("pushButton_8") == 0 ) index = DISPLAYTYPE8;
	else if( objName.compare("pushButton_9") == 0 ) index = DISPLAYTYPE9;
	else if( objName.compare("pushButton_10") == 0 ) index = DISPLAYTYPE10;
	else if( objName.compare("pushButton_11") == 0 ) index = DISPLAYTYPE11;
	else if( objName.compare("pushButton_12") == 0 ) index = DISPLAYTYPE12;
	else if( objName.compare("pushButton_13") == 0 ) index = DISPLAYTYPE13;
	else if( objName.compare("pushButton_14") == 0 ) index = DISPLAYTYPE14;
	else if( objName.compare("pushButton_15") == 0 ) index = DISPLAYTYPE15;
	else if( objName.compare("pushButton_16") == 0 ) index = DISPLAYTYPE16;
	else if( objName.compare("pushButton_17") == 0 ) index = DISPLAYTYPE17;
	else index = -1;

	QString passwd = passWord.at(index);
	if(event->type()==QEvent::MouseButtonPress && pBut -> isEnabled() && (index < DISPLAYTOT || index >= DISPLAYTYPE))
	{
		QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
		if (mouseEvent->buttons() & Qt::LeftButton) 
		{
			if(passwd.compare("") != 0)
			{
				//qDebug("Password: %s", passwd.toStdString().c_str());
#if 0
				Password pword(passwd, new QWidget());
				if(pword.getStatus()== true) displayDockWidget(index, pBut);
#endif
#if 1
				displayDockWidget(index, pBut);
#endif
			}
			else
			{
				displayDockWidget(index, pBut);
			}
			return true;
		}
		return false;
	} 

	return QMainWindow::eventFilter(obj, event);
}
Example #11
0
void MainWindow::setEnableButtons(QPushButton *pobj)
{
	QList<QPushButton *> allPButtons = findChildren<QPushButton *>();
	QString objName;

	for (int i = 0; i < allPButtons.size(); ++i) 
	{
		QPushButton *pushbutton = (QPushButton*)allPButtons.at(i);
		objName = pushbutton->objectName();
		if ( objName.compare(pobj->objectName()) == 0 ) pushbutton -> setEnabled(false);
		else pushbutton -> setEnabled(true);
	};

}
void PrevNextButtonGroup::buttonClick()
{
	QPushButton *button = static_cast<QPushButton *>( sender() );
	if( !button )
		return;

	QString name = button->objectName();
	if( name == "firstButton" )
		emit buttonClicked(0);
	else if( name == "prevButton" )
		emit buttonClicked(1);
	else if( name == "nextButton" )
		emit buttonClicked(2);
	else if( name == "lastButton" )
		emit buttonClicked(3);
}
Example #13
0
void CompanyForm::removeButton_clicked()
{
        try
        {
                QPushButton* button = qobject_cast<QPushButton*>(this->sender());
                if  (button)
                {
                        this->ShowCompanyDetails(button->objectName().toStdString());

                        QMessageBox messageBox;
                        messageBox.setText("Are you sure you want to delete this company?");
                        messageBox.setInformativeText("This company and all applications and contacts associated with it will be deleted. Are you sure?");
                        messageBox.setStandardButtons(QMessageBox::No|QMessageBox::Yes);
                        messageBox.setIcon(QMessageBox::Question);

                        if (messageBox.exec() == QMessageBox::Yes)
                        {
                                this->database->DeleteCompany(this->selectedCompany->ID);

                                this->LoadCompanySummaries();
                        }
                }
        }
        catch(WarningException& e)
        {
                this->DisplayProblem(e.problem);

                Logger::GetInstance().Warn(e);
        }
        catch(FatalException& e)
        {
                this->DisplayProblem(e.problem);

                Logger::GetInstance().Fatal(e);
        }
        catch(...)
        {
                QMessageBox messageBox;
                messageBox.setText("Unhandled exception");
                messageBox.setInformativeText("CompanyForm::removeButton_clicked Unhandled exception");
                messageBox.setStandardButtons(QMessageBox::Ok);
                messageBox.setIcon(QMessageBox::Critical);

                Logger::GetInstance().Fatal("CompanyForm::removeButton_clicked Unhandled exception");
        }

}
void dacDialog::sendDACMessage()
{
    QObject *callerPB = QObject::sender();
    QPushButton *caller = qobject_cast<QPushButton *>(callerPB);
    bool readNotWrite;
    if("readPushButton" == caller->objectName())
        readNotWrite = true;
    else
        readNotWrite = false;

    SET_GROUP(activeMsg->header, DAC_MSG);
    readNotWrite ? activeMsg->header |= 0x01 : activeMsg->header &= 0xFE;
    EN_GROUP(activeMsg->header);
    activeMsg->size = GUI_MSG_SIZE;
    QString pageString = ui->pageLineEdit->text();
    pageString.remove("0x", Qt::CaseSensitive);
    QString addressString = ui->addressLineEdit->text();
    addressString.remove("0x", Qt::CaseSensitive);
    QString dataString = ui->dataLineEdit->text();
    dataString.remove("0x", Qt::CaseSensitive);
    bool ok;
    unsigned short page = pageString.toShort(&ok, 16);
    if(!ok)
        return;
    unsigned short address = addressString.toShort(&ok, 16);
    if(!ok)
        return;
    unsigned short data;
    if(!readNotWrite)
    {
        data = dataString.toShort(&ok, 16);
        if(!ok)
            return;
    }
    else
        data = 0;

    activeMsg->data[0] = page;
    activeMsg->data[1] = address;
    activeMsg->data[2] = data;
    for(int i = 3; i < GUI_MSG_SIZE - 2; ++i)
        activeMsg->data[i] = 0;

    writeGUIMessage(activeMsg);
}
Example #15
0
void ConfigWidget::changeHotkey()
{
    ScanHotkeyDialog dial(this);
    dial.setModal(true);
    if (dial.exec()) {
        QPushButton* b = qobject_cast<QPushButton*>(sender());
        if (b) {
            QString settingsKey("general/");
            settingsKey += b->objectName();

            _settings->setValue(settingsKey, dial.key());

            b->setText(dial.key());

            registerActualHotkeys();
        }
    }
}
Example #16
0
void MainWindow::registerPushButtonsEvent()
{
	QList<QPushButton *> allPButtons = findChildren<QPushButton *>();
	QString objName;

	qDebug("Button Size:%d", allPButtons.size());

	for (int i = 0; i < allPButtons.size(); ++i) 
	{
		QPushButton *pushbutton = (QPushButton*)allPButtons.at(i);
		objName = pushbutton->objectName();
		if(objName.contains("pushButton"))
		{
			pushbutton -> installEventFilter(this);
			qDebug("ObjectName:%s", objName.toStdString().c_str());
		}
	};
}
Example #17
0
void voxUI::showSpecialChars()
{
    QRegExp rx("specialChar_(\\d+)");
    QList<QPushButton*> allPushButtons = ui->addP->findChildren<QPushButton*>();
    QListIterator<QPushButton*> pBIter(allPushButtons);

    while(pBIter.hasNext()){
        QPushButton* next = pBIter.next();
        if(next->objectName().contains(rx)){
            if(rx.cap(1).toInt() < curSpecialList->size()){
                next->setText(curSpecialList->at(rx.cap(1).toInt()));
            }
            else{
                next->hide();
            }
        }
    }

}
void WidgetGestionSequences::supprimerScene()
{
    QObject * emetteur = sender();
    QPushButton * emetteurCasted = qobject_cast<QPushButton*>(emetteur);

    if(emetteurCasted)
    {



        QTreeWidgetItem *recup = ui->treeWidget->currentItem();

        GestionXML::supprimerSceneDeSequence(recup->text(1), this->listeUUIDsequence[emetteurCasted->objectName().toInt()]);



        this->changementIndex();
    }
}
Example #19
0
void MainWindow::ToolsClicked( QWidget * wdg )
{
  QPushButton * button = dynamic_cast<QPushButton*>(wdg);

  if( lastToolClicked == button )
  {
    lastToolClicked = NULL;
    tool_action = nothing;
    return;
  }
  else
  {
    if( lastToolClicked )
      lastToolClicked->setChecked( false );
    lastToolClicked = button;
    QString & objname = button->objectName();
    Helper * helper = Helper::Instance();
    if( objname == QString("cursor") )
      tool_action = cursor;
    else if( objname == helper->GetItemNameByState( s_original ) )
      tool_action = set_original;
    else if( objname == helper->GetItemNameByState( s_bunny ) )
      tool_action = set_bunny;
    else if( objname == helper->GetItemNameByState( s_active ) )
      tool_action = set_active;
    else if( objname == helper->GetItemNameByState( s_bomb ) )
      tool_action = set_bomb;
    else if( objname == helper->GetItemNameByState( s_fire ) )
      tool_action = set_fire;
    else if( objname == helper->GetItemNameByState( s_block ) )
      tool_action = set_block;
    else if( objname == helper->GetItemNameByState( s_strong ) )
      tool_action = set_strong;
    else if( objname == helper->GetItemNameByState( s_teleport ) )
      tool_action = set_teleport;
    else if( objname == helper->GetItemNameByState( s_monster ) )
      tool_action = set_monster;
		else if( objname == helper->GetItemNameByState( s_invisible ) )
			tool_action = set_visibility;
  }

};
Example #20
0
void MainWindow::registerPushButtonsEvent()
{
	QList<QPushButton *> allPButtons = findChildren<QPushButton *>();
	QString objName;

	/* 
		At first, allPButtons--QList-- included all buttons inherited from QPushButton. 
		And this implemented installEventFilter(this) even for CAPushButtons.
	 */
	for (int i = 0; i < allPButtons.size(); ++i) 
	//for (int i = 0; i < displayDocklist.size(); ++i) 
	{
		QPushButton *pushbutton = (QPushButton*)allPButtons.at(i);
		objName = pushbutton->objectName();
		if(objName.contains("pushButton"))
		{
			pushbutton -> installEventFilter(this);
			qDebug("ObjectName:%s", objName.toStdString().c_str());
		}
	};
}
Example #21
0
void CompanyForm::editButton_clicked()
{
        try
        {
                QPushButton* button = qobject_cast<QPushButton*>(this->sender());
                if (button)
                {
                        this->ShowCompanyDetails(button->objectName().toStdString());

                        CompanyEditDialog dialog(this, this->database, this->selectedCompany);
                        if (dialog.exec() == QDialog::Accepted)
                        {
                                this->LoadCompanySummaries();
                        }
                }
        }
        catch(WarningException& e)
        {
                this->DisplayProblem(e.problem);

                Logger::GetInstance().Warn(e);
        }
        catch(FatalException& e)
        {
                this->DisplayProblem(e.problem);

                Logger::GetInstance().Fatal(e);
        }
        catch(...)
        {
                QMessageBox messageBox;
                messageBox.setText("Unhandled exception");
                messageBox.setInformativeText("CompanyForm::editButton_clicked Unhandled exception");
                messageBox.setStandardButtons(QMessageBox::Ok);
                messageBox.setIcon(QMessageBox::Critical);

                Logger::GetInstance().Fatal("CompanyForm::editButton_clicked Unhandled exception");
        }
}
Example #22
0
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
	QPushButton *pBut = (QPushButton*)obj;
	QString objName = pBut->objectName();
	int index = 0;
	if ( objName.compare("pushButton_0") == 0 ) index = DISPLAYTYPE;
	else if( objName.compare("pushButton_1") == 0 ) index = DISPLAYTYPE1;
	else index = -1;

	if(event->type()==QEvent::MouseButtonPress && pBut -> isEnabled() && (index < DISPLAYTOT || index >= DISPLAYTYPE))
	{    
		QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
		if (mouseEvent->buttons() & Qt::LeftButton) 
		{
			displayDockWidget(index, pBut);
			return true;
		};
		return false;
	};

	return QMainWindow::eventFilter(obj, event);
}
Example #23
0
void voxUI::connectFct()
{
    // unsauber aber funktioniert - bitte ändern
    QList<QPushButton*> allPBs = ui->addP->findChildren<QPushButton*>();
    QList<QLineEdit*> allLineEdit = ui->addP->findChildren<QLineEdit*>();
    QListIterator<QPushButton*> lPBitIter(allPBs);
    QListIterator<QLineEdit*> lEditIter(allLineEdit);
    QRegExp specLabel("^specialChar_(\\d+)$");

    while(lPBitIter.hasNext()){
        QPushButton* next = lPBitIter.next();
        if(next->objectName().contains(specLabel)){
            connect(next, SIGNAL(clicked()), this, SLOT(specialButtonClicked()));
        }
    }

    //    while(lEditIter.hasNext()){
    //        QWidget* next = lEditIter.next();
    ////        connect(next, SIGNAL(), this, SLOT(specialButtonClicked()));
    //    }
    //connect(ui->wordTableView, SIGNAL(activated(QModelIndex)), this, SLOT(specialButtonClicked()));
    connect(ui->practToWordListB, SIGNAL(clicked()), this, SLOT(on_goButton_clicked()));
}
Example #24
0
void RotationSettings::applyRotation()
{
    QPushButton *sendButton = qobject_cast<QPushButton *>(sender());
//hacky at best
    setRotation(sendButton->objectName().remove("rot").toInt());
}