QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent, QgsShortcutsManager* manager )
    : QDialog( parent )
    , mManager( manager )
    , mGettingShortcut( false )
    , mModifiers( 0 )
    , mKey( 0 )
{
  setupUi( this );

  if ( !mManager )
    mManager = QgsShortcutsManager::instance();

  connect( btnChangeShortcut, SIGNAL( clicked() ), this, SLOT( changeShortcut() ) );
  connect( btnResetShortcut, SIGNAL( clicked() ), this, SLOT( resetShortcut() ) );
  connect( btnSetNoShortcut, SIGNAL( clicked() ), this, SLOT( setNoShortcut() ) );
  connect( btnSaveShortcuts, SIGNAL( clicked() ), this, SLOT( saveShortcuts() ) );
  connect( btnLoadShortcuts, SIGNAL( clicked() ), this, SLOT( loadShortcuts() ) );

  connect( treeActions, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
           this, SLOT( actionChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

  populateActions();

  restoreState();
}
Example #2
0
void configwidget::acceptShortcut(const QKeySequence& seq)
{
    if (checkUsedShortcuts() == false)
    {
	// iterate for
	if (avalibelGlobalShortcuts(seq) == true)
	{
	    changeShortcut(seq);
	}
	else
	{
	    QMessageBox msg;
	    msg.setWindowTitle(tr("Error"));
	    msg.setText(tr("This key is exist in global shortcuts on yoy system! Please select other keys"));
	    msg.setIcon(QMessageBox::Information);
	    msg.setStandardButtons(QMessageBox::Ok);
	    msg.exec();
	    m_ui->keyWidget->clearKeySequence();
	}
    }
    else if (checkUsedShortcuts() == true && seq.toString() != "")
    {
	QMessageBox msg;
	msg.setWindowTitle(tr("Error"));
	msg.setText(tr("This key is exist! Please select other keys"));
	msg.setIcon(QMessageBox::Information);
	msg.setStandardButtons(QMessageBox::Ok);
	msg.exec();
	m_ui->keyWidget->clearKeySequence();
    }
}
QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent )
    : QDialog( parent ), mGettingShortcut( false )
{
  setupUi( this );

  connect( btnChangeShortcut, SIGNAL( clicked() ), this, SLOT( changeShortcut() ) );
  connect( btnResetShortcut, SIGNAL( clicked() ), this, SLOT( resetShortcut() ) );
  connect( btnSetNoShortcut, SIGNAL( clicked() ), this, SLOT( setNoShortcut() ) );
  connect( btnSaveShortcuts, SIGNAL( clicked() ), this, SLOT( saveShortcuts() ) );
  connect( btnLoadShortcuts, SIGNAL( clicked() ), this, SLOT( loadShortcuts() ) );

  connect( treeActions, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
           this, SLOT( actionChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

  populateActions();
}
Example #4
0
configwidget::configwidget(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::configwidget)
{
    m_ui->setupUi(this);
    conf = Config::instance();

    m_ui->tabWidget->setCurrentIndex(0);
    loadSettings();
    on_defDelay_valueChanged(conf->getDefDelay());
    setVisibleDateTplEdit(conf->getDateTimeInFilename());    

    connect(m_ui->butSaveOpt, SIGNAL(clicked()), this, SLOT(saveSettings()));
    connect(m_ui->buttonBrowse, SIGNAL(clicked()), this, SLOT(selectDir()));
    connect(m_ui->butRestoreOpt, SIGNAL(clicked()), this, SLOT(restoreDefaults()) );
    connect(m_ui->checkIncDate, SIGNAL(toggled(bool)), this, SLOT(setVisibleDateTplEdit(bool)));
    connect(m_ui->keyWidget, SIGNAL(keySequenceAccepted(QKeySequence)), this, SLOT(acceptShortcut(QKeySequence)));
    connect(m_ui->keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(changeShortcut(QKeySequence)));
    connect(m_ui->keyWidget, SIGNAL(keyNotSupported()), this, SLOT(keyNotSupported()));
    on_editDateTmeTpl_textEdited(conf->getDateTimeTpl());

    m_ui->treeKeys->expandAll();
    m_ui->treeKeys->header()->setResizeMode(QHeaderView::Stretch);
    
    // adding shortcut values in treewidget    
    int action = 0;
    QTreeWidgetItemIterator iter(m_ui->treeKeys);
    while(*iter)
    {
	if ((*iter)->parent() != NULL)
	{
	    (*iter)->setData(1, Qt::DisplayRole, conf->shortcuts()->getShortcut(action));
	    ++action;
	}
	++iter;
    }
    
    // set false visibility to edit hokey controls
    m_ui->labUsedShortcut->setVisible(false);
    m_ui->keyWidget->setVisible(false);

}