Exemplo n.º 1
0
CustomToolBarPropertiesDialog::CustomToolBarPropertiesDialog(QWidget * p,const QString &szText,const QString &szId,const QString &szLabel,const QString &szIconId)
: QDialog(p)
{
	m_szId = szId;
	m_szOriginalId = szId;
	m_szLabel = szLabel;

	setWindowTitle(__tr2qs_ctx("ToolBar Properties","editor"));
	setWindowIcon(QIcon(*(g_pIconManager->getSmallIcon(KviIconManager::ToolBar))));
	setModal(true);

	QGridLayout * g = new QGridLayout(this);

	QLabel * l = new QLabel(szText,this);
	g->addWidget(l,0,0,1,6);

	l = new QLabel(__tr2qs_ctx("Label","editor") + ":",this);
	g->addWidget(l,1,0);

	m_pLabelEdit = new QLineEdit(this);
	g->addWidget(m_pLabelEdit,1,1,1,5);
	m_pLabelEdit->setText(szLabel);
	connect(m_pLabelEdit,SIGNAL(textChanged(const QString &)),this,SLOT(labelTextChanged(const QString &)));

	l = new QLabel(__tr2qs_ctx("Icon","editor") + ":",this);
	g->addWidget(l,2,0);

	m_pIconEdit = new QLineEdit(this);
	m_pIconEdit->setReadOnly(true);
	g->addWidget(m_pIconEdit,2,1,1,4);

	m_pIconButton = new QPushButton(this);
	g->addWidget(m_pIconButton,2,5,1,1);
	connect(m_pIconButton,SIGNAL(clicked()),this,SLOT(iconButtonClicked()));

	iconSelected(szIconId);

	m_pAdvanced = new QWidget(this);
	QGridLayout * ag = new QGridLayout(m_pAdvanced);

	l = new QLabel(__tr2qs_ctx("Id","editor") + ":",m_pAdvanced);
	l->setMinimumWidth(100);
	ag->addWidget(l,0,0);

	m_pIdEdit = new QLineEdit(m_pAdvanced);
	ag->addWidget(m_pIdEdit,0,1);
	ag->setRowStretch(0,1);

	m_pIdEdit->setText(szId);

	g->addWidget(m_pAdvanced,3,0,1,6);
	m_pAdvanced->hide();

	m_pLabelEdit->setFocus();

	QPushButton * pb = new QPushButton(__tr2qs_ctx("OK","editor"),this);
	connect(pb,SIGNAL(clicked()),this,SLOT(okClicked()));
	pb->setMinimumWidth(80);
	g->addWidget(pb,4,4,1,2);

	pb = new QPushButton(__tr2qs_ctx("Cancel","editor"),this);
	connect(pb,SIGNAL(clicked()),this,SLOT(reject()));
	pb->setMinimumWidth(80);
	g->addWidget(pb,4,3);

	m_pAdvancedButton = new QPushButton(__tr2qs_ctx("Advanced...","editor"),this);
	connect(m_pAdvancedButton,SIGNAL(clicked()),this,SLOT(advancedClicked()));
	m_pAdvancedButton->setMinimumWidth(100);
	g->addWidget(m_pAdvancedButton,4,0,1,2);

	g->setRowStretch(0,1);
	g->setColumnStretch(2,1);
}
Exemplo n.º 2
0
KviInput::KviInput(KviWindow * pPar, KviUserListView * pView)
: QWidget(pPar)
{
	setObjectName("input_widget");
	m_pLayout=new QGridLayout(this);

	m_pLayout->setMargin(0);
	m_pLayout->setSpacing(0);

	m_pWindow = pPar;
	m_pMultiLineEditor = 0;

	m_pHideToolsButton = new QToolButton(this);
	m_pHideToolsButton->setObjectName("hide_container_button");

	m_pHideToolsButton->setIconSize(QSize(22,22));
	m_pHideToolsButton->setFixedWidth(16);

	if(g_pIconManager->getBigIcon("kvi_horizontal_left.png"))
		m_pHideToolsButton->setIcon(QIcon(*(g_pIconManager->getBigIcon("kvi_horizontal_left.png"))));

	connect(m_pHideToolsButton,SIGNAL(clicked()),this,SLOT(toggleToolButtons()));

	m_pButtonContainer = new KviTalHBox(this);
	m_pButtonContainer->setSpacing(0);
	m_pButtonContainer->setMargin(0);

	m_pButtonContainer->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
	//if(m_pButtonContainer->layout())
	// m_pButtonContainer->layout()->setSizeConstraint(QLayout::SetMinimumSize);

	m_pHistoryButton = new QToolButton(m_pButtonContainer);
	m_pHistoryButton->setObjectName("historybutton");

	m_pHistoryButton->setIconSize(QSize(22,22));
	//m_pHistoryButton->setUpdatesEnabled(true); ???
	QIcon is1;
	if(KVI_OPTION_BOOL(KviOption_boolEnableInputHistory))//G&N mar 2005
	{
		is1.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::Time)));
		m_pHistoryButton->setIcon(is1);
		KviTalToolTip::add(m_pHistoryButton,__tr2qs("Show History<br>&lt;Ctrl+PageUp&gt;"));
		connect(m_pHistoryButton,SIGNAL(clicked()),this,SLOT(historyButtonClicked()));
	} else {
		is1.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::HandlerDisabled)));
		m_pHistoryButton->setIcon(is1);
		KviTalToolTip::add(m_pHistoryButton,__tr2qs("Input History Disabled"));
	}

	m_pIconButton = new QToolButton(m_pButtonContainer);
	m_pIconButton->setObjectName("iconbutton");

	m_pIconButton->setIconSize(QSize(22,22));
	QIcon is3;
	is3.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::BigGrin)));
	m_pIconButton->setIcon(is3);
	KviTalToolTip::add(m_pIconButton,__tr2qs("Show Icons Popup<br>&lt;Ctrl+I&gt;<br>See also /help texticons"));
	connect(m_pIconButton,SIGNAL(clicked()),this,SLOT(iconButtonClicked()));

	m_pCommandlineModeButton = new QToolButton(m_pButtonContainer);
	m_pCommandlineModeButton->setObjectName("commandlinemodebutton");

	m_pCommandlineModeButton->setIconSize(QSize(22,22));
	m_pCommandlineModeButton->setCheckable(true);
	QIcon is0;
	is0.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::SaySmile)),QIcon::Normal,QIcon::On);
	is0.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::SayKvs)),QIcon::Normal,QIcon::Off);
	m_pCommandlineModeButton->setIcon(is0);
	KviTalToolTip::add(m_pCommandlineModeButton,__tr2qs("User friendly commandline mode<br>See also /help commandline"));
	if(KVI_OPTION_BOOL(KviOption_boolCommandlineInUserFriendlyModeByDefault))
		m_pCommandlineModeButton->setChecked(true);


	m_pMultiEditorButton = new QToolButton(m_pButtonContainer);
	m_pMultiEditorButton->setObjectName("multieditorbutton");

	m_pMultiEditorButton->setCheckable(true);
	m_pMultiEditorButton->setIconSize(QSize(22,22));
	QIcon is2;
	is2.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::IrcView)),QIcon::Normal,QIcon::On);
	is2.addPixmap(*(g_pIconManager->getSmallIcon(KviIconManager::Terminal)),QIcon::Normal,QIcon::Off);
	m_pMultiEditorButton->setIcon(is2);
	QString szTip = __tr2qs("Multi-line Editor<br>&lt;Alt+Return&gt;");
	KviTalToolTip::add(m_pMultiEditorButton,szTip);

	connect(m_pMultiEditorButton,SIGNAL(toggled(bool)),this,SLOT(multiLineEditorButtonToggled(bool)));

	m_pInputEditor = new KviInputEditor(this,pPar,pView);
	connect(m_pInputEditor,SIGNAL(enterPressed()),this,SLOT(inputEditorEnterPressed()));
	m_pInputEditor->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Ignored));


	m_pMultiEditorButton->setAutoRaise(true);
	m_pCommandlineModeButton->setAutoRaise(true);
	m_pIconButton->setAutoRaise(true);
	m_pHistoryButton->setAutoRaise(true);
	m_pHideToolsButton->setAutoRaise(true);

	m_pLayout->addWidget(m_pHideToolsButton,0,2,2,1);
	m_pLayout->addWidget(m_pButtonContainer,0,1,2,1);
	m_pLayout->addWidget(m_pInputEditor,0,0,2,1);

	installShortcuts();
}
OptionsWidget_messageColors::OptionsWidget_messageColors(QWidget * parent)
: KviOptionsWidget(parent)
{
	setObjectName("messages");

	createLayout();

	int i;
	m_pLastItem = 0;

	m_pListView = new MessageListWidget(this);
	m_pListViewItemDelegate = new MessageListWidgetItemDelegate(m_pListView);
	m_pListView->setItemDelegate(m_pListViewItemDelegate);
	m_pListView->setSelectionMode(QAbstractItemView::SingleSelection);
	m_pListView->setFont(KVI_OPTION_FONT(KviOption_fontIrcView));
	m_pListView->viewport()->setAutoFillBackground(false);

	addWidgetToLayout(m_pListView,0,0,2,0);

	KviTalVBox * box = new KviTalVBox(this);
	addWidgetToLayout(box,3,0,3,0);

	new QLabel(__tr2qs_ctx("Background:","options"),box);

	m_pBackListWidget = new KviTalListWidget(box);
	m_pBackListWidget->setMaximumWidth(150);
	m_pBackListWidgetDelegate = new MessageColorListWidgetItemDelegate(m_pBackListWidget);
	m_pBackListWidget->setItemDelegate(m_pBackListWidgetDelegate);

	m_pBackItems[16] = new MessageColorListWidgetItem(m_pBackListWidget,KviControlCodes::Transparent);
	for(i=0;i<16;i++)
	{
		m_pBackItems[i] = new MessageColorListWidgetItem(m_pBackListWidget,i);
	}

	new QLabel(__tr2qs_ctx("Foreground:","options"),box);

	m_pForeListWidget = new KviTalListWidget(box);
	m_pForeListWidget->setMaximumWidth(150);
	m_pForeListWidgetDelegate = new MessageColorListWidgetItemDelegate(m_pForeListWidget);
	m_pForeListWidget->setItemDelegate(m_pForeListWidgetDelegate);

	for(i=0;i<16;i++)
	{
		m_pForeItems[i] = new MessageColorListWidgetItem(m_pForeListWidget,i);
	}

	new QLabel(__tr2qs_ctx("Alert level:","options"),box);

	m_pLevelListWidget = new KviTalListWidget(box);
	m_pLevelListWidget->setMaximumWidth(150);

	for(i=0;i<6;i++)
	{
		QString tmpn;
		tmpn.setNum(i);
		new KviTalListWidgetText(m_pLevelListWidget,tmpn);
	}

	m_pIconButton = new QToolButton(box);
	connect(m_pIconButton,SIGNAL(clicked()),this,SLOT(iconButtonClicked()));

    m_pIconPopup = new QMenu(this);
	KviIconWidget * iw = new KviIconWidget(m_pIconPopup);
	connect(iw,SIGNAL(selected(KviIconManager::SmallIcon)),this,SLOT(newIconSelected(KviIconManager::SmallIcon)));
    m_pIconPopup->addAction(new QWidgetAction(iw));


	m_pEnableLogging = new QCheckBox(__tr2qs_ctx("Log this","options"),box);

	KviTalHBox * h = new KviTalHBox(this);
	addWidgetToLayout(h,0,1,3,1);
	QPushButton * b = new QPushButton(__tr2qs_ctx("Load From...","options"),h);
	connect(b,SIGNAL(clicked()),this,SLOT(load()));
	b = new QPushButton(__tr2qs_ctx("Save As...","options"),h);
	connect(b,SIGNAL(clicked()),this,SLOT(save()));


	for(i=0;i<KVI_NUM_MSGTYPE_OPTIONS;i++)
		new MessageListWidgetItem(m_pListView,i);

	layout()->setRowStretch(0,1);
	layout()->setColumnStretch(0,1);

	connect(m_pListView,SIGNAL(itemSelectionChanged ()),this,SLOT(itemChanged()));
	connect(m_pForeListWidget,SIGNAL(itemSelectionChanged ()),this,SLOT(colorChanged()));
	connect(m_pBackListWidget,SIGNAL(itemSelectionChanged ()),this,SLOT(colorChanged()));

	itemChanged();
}