コード例 #1
0
K3bExternalEncoderSettingsWidget::K3bExternalEncoderSettingsWidget( QWidget* parent, const QVariantList& args )
    : K3b::PluginConfigWidget( parent, args )
{
    setupUi( this );

    connect( m_viewEncoders, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
             this, SLOT(slotSelectionChanged(QTreeWidgetItem*)) );
    connect( m_viewEncoders, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
             this, SLOT(slotEditCommand()) );
    connect( m_buttonAdd, SIGNAL(clicked()),
             this, SLOT(slotNewCommand()) );
    connect( m_buttonEdit, SIGNAL(clicked()),
             this, SLOT(slotEditCommand()) );
    connect( m_buttonRemove, SIGNAL(clicked()),
             this, SLOT(slotRemoveCommand()) );

    m_editDlg = new K3bExternalEncoderEditDialog( this );
    slotSelectionChanged( 0 );
}
コード例 #2
0
KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, QWidget *parent, const char *name, KDialogBase *dlg) : QWidget(parent, name)
{
    m_cmd = new QComboBox(this);
    connect(m_cmd, SIGNAL(activated(int)), SLOT(slotCommandSelected(int)));
    QPushButton *m_add = new KPushButton(this);
    QPushButton *m_edit = new KPushButton(this);
    m_add->setPixmap(SmallIcon("filenew"));
    m_edit->setPixmap(SmallIcon("configure"));
    connect(m_add, SIGNAL(clicked()), SLOT(slotAddCommand()));
    connect(m_edit, SIGNAL(clicked()), SLOT(slotEditCommand()));
    QToolTip::add(m_add, i18n("New command"));
    QToolTip::add(m_edit, i18n("Edit command"));
    m_shortinfo = new QLabel(this);
    m_helpbtn = new KPushButton(this);
    m_helpbtn->setIconSet(SmallIconSet("help"));
    connect(m_helpbtn, SIGNAL(clicked()), SLOT(slotHelpCommand()));
    QToolTip::add(m_helpbtn, i18n("Information"));
    m_helpbtn->setEnabled(false);

    m_line = 0;
    m_usefilter = 0;
    QPushButton *m_browse = 0;

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);

    if(canBeNull)
    {
        m_line = new QLineEdit(this);
        m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
        m_usefilter = new QCheckBox(i18n("Use co&mmand:"), this);
        connect(m_browse, SIGNAL(clicked()), SLOT(slotBrowse()));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_line, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_browse, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_cmd, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_add, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_edit, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_shortinfo, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), SLOT(slotXmlCommandToggled(bool)));
        m_usefilter->setChecked(true);
        m_usefilter->setChecked(false);
        // setFocusProxy(m_line);
        setTabOrder(m_usefilter, m_cmd);
        setTabOrder(m_cmd, m_add);
        setTabOrder(m_add, m_edit);

        QHBoxLayout *l1 = new QHBoxLayout(0, 0, 10);
        l0->addLayout(l1);
        l1->addWidget(m_line);
        l1->addWidget(m_browse);

        KSeparator *sep = new KSeparator(Qt::Horizontal, this);
        l0->addWidget(sep);
    }
    else
        setFocusProxy(m_cmd);

    QGridLayout *l2 = new QGridLayout(0, 2, (m_usefilter ? 3 : 2), 0, 5);
    int c(0);
    l0->addLayout(l2);
    if(m_usefilter)
    {
        l2->addWidget(m_usefilter, 0, c++);
    }
    l2->addWidget(m_cmd, 0, c);
    QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5);
    l2->addLayout(l4, 1, c);
    l4->addWidget(m_helpbtn, 0);
    l4->addWidget(m_shortinfo, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, 0);
    l2->addLayout(l3, 0, c + 1);
    l3->addWidget(m_add);
    l3->addWidget(m_edit);

    if(dlg)
        connect(this, SIGNAL(commandValid(bool)), dlg, SLOT(enableButtonOK(bool)));

    loadCommands();
}
コード例 #3
0
ファイル: kxmlcommanddlg.cpp プロジェクト: Fat-Zer/tdelibs
KXmlCommandDlg::KXmlCommandDlg(TQWidget *parent, const char *name)
: KDialogBase(parent, name, true, TQString::null, Ok|Cancel|Details, Ok, true)
{
	setButtonText(Details, i18n("&Mime Type Settings"));
	m_cmd = 0;

	TQWidget	*dummy = new TQWidget(this, "TopDetail");
	TQWidget	*topmain = new TQWidget(this, "TopMain");

	TQGroupBox	*m_gb1 = new TQGroupBox(0, Qt::Horizontal, i18n("Supported &Input Formats"), dummy);
	TQGroupBox	*m_gb2 = new TQGroupBox(0, Qt::Horizontal, i18n("Requirements"), topmain);

	m_description = new TQLineEdit(topmain);
	m_idname = new TQLabel(topmain);
	m_requirements = new TDEListView(m_gb2);
	m_requirements->addColumn("");
	m_requirements->header()->hide();
	m_addreq = new TQToolButton(m_gb2);
	m_addreq->setIconSet(SmallIconSet("filenew"));
	m_removereq = new TQToolButton(m_gb2);
	m_removereq->setIconSet(SmallIconSet("editdelete"));
	TQPushButton	*m_edit = new KPushButton(KGuiItem(i18n("&Edit Command..."), "edit"), topmain);
	m_mimetype = new TQComboBox(dummy);
	m_availablemime = new TDEListBox(m_gb1);
	m_selectedmime = new TDEListBox(m_gb1);
	m_addmime = new TQToolButton(m_gb1);
	m_addmime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("forward") : SmallIconSet("back"));
	m_removemime = new TQToolButton(m_gb1);
	m_removemime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("back" ) : SmallIconSet("forward"));
	m_gb2->setMinimumWidth(380);
	m_gb1->setMinimumHeight(180);
	m_requirements->setMaximumHeight(80);
	m_removereq->setEnabled(false);
	m_addmime->setEnabled(false);
	m_removemime->setEnabled(false);

	TQLabel	*m_desclab = new TQLabel(i18n("&Description:"), topmain);
	m_desclab->setBuddy(m_description);
	TQLabel	*m_mimetypelab = new TQLabel(i18n("Output &format:"), dummy);
	m_mimetypelab->setBuddy(m_mimetype);
	TQLabel	*m_idnamelab = new TQLabel(i18n("ID name:"), topmain);

	TQFont	f(m_idname->font());
	f.setBold(true);
	m_idname->setFont(f);

	KSeparator	*sep1 = new KSeparator(TQFrame::HLine, dummy);

	TQVBoxLayout	*l0 = new TQVBoxLayout(topmain, 0, 10);
	TQGridLayout	*l5 = new TQGridLayout(0, 2, 2, 0, 5);
	l0->addLayout(TQT_TQLAYOUT(l5));
	l5->addWidget(m_idnamelab, 0, 0);
	l5->addWidget(m_idname, 0, 1);
	l5->addWidget(m_desclab, 1, 0);
	l5->addWidget(m_description, 1, 1);
	l0->addWidget(m_gb2);
	TQHBoxLayout	*l3 = new TQHBoxLayout(0, 0, 0);
	l0->addLayout(l3);
	l3->addWidget(m_edit);
	l3->addStretch(1);

	TQVBoxLayout	*l7 = new TQVBoxLayout(dummy, 0, 10);
	TQHBoxLayout	*l6 = new TQHBoxLayout(0, 0, 5);
	l7->addWidget(sep1);
	l7->addLayout(l6);
	l6->addWidget(m_mimetypelab, 0);
	l6->addWidget(m_mimetype, 1);
	l7->addWidget(m_gb1);
	TQGridLayout	*l2 = new TQGridLayout(TQT_TQLAYOUT(m_gb1->layout()), 4, 3, 10);
	l2->addMultiCellWidget(m_availablemime, 0, 3, 2, 2);
	l2->addMultiCellWidget(m_selectedmime, 0, 3, 0, 0);
	l2->addWidget(m_addmime, 1, 1);
	l2->addWidget(m_removemime, 2, 1);
	l2->setRowStretch(0, 1);
	l2->setRowStretch(3, 1);
	TQHBoxLayout	*l4 = new TQHBoxLayout(TQT_TQLAYOUT(m_gb2->layout()), 10);
	l4->addWidget(m_requirements);
	TQVBoxLayout	*l8 = new TQVBoxLayout(0, 0, 0);
	l4->addLayout(l8);
	l8->addWidget(m_addreq);
	l8->addWidget(m_removereq);
	l8->addStretch(1);

	connect(m_addmime, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddMime()));
	connect(m_removemime, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveMime()));
	connect(m_edit, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditCommand()));
	connect(m_requirements, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotReqSelected(TQListViewItem*)));
	connect(m_availablemime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotAvailableSelected(TQListBoxItem*)));
	connect(m_selectedmime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotSelectedSelected(TQListBoxItem*)));
	connect(m_addreq, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddReq()));
	connect(m_removereq, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveReq()));

	KMimeType::List	list = KMimeType::allMimeTypes();
	for (TQValueList<KMimeType::Ptr>::ConstIterator it=list.begin(); it!=list.end(); ++it)
	{
		TQString	mimetype = (*it)->name();
		m_mimelist << mimetype;
	}

	m_mimelist.sort();
	m_mimetype->insertStringList(m_mimelist);
	m_availablemime->insertStringList(m_mimelist);

	setMainWidget(topmain);
	setDetailsWidget(dummy);
}