Esempio n. 1
0
OptionsWidget_userListForeground::OptionsWidget_userListForeground(QWidget * parent)
    : KviOptionsWidget(parent, "userlistlook_foreground_options_widget")
{
	createLayout();

	addFontSelector(0, 0, 1, 0, __tr2qs_ctx("Font:", "options"), KviOption_fontUserListView);

	KviTalGroupBox * g = addGroupBox(0, 1, 1, 1, Qt::Horizontal, __tr2qs_ctx("Nickname Colors", "options"));
	addColorSelector(g, __tr2qs_ctx("Normal:", "options"), KviOption_colorUserListViewNormalForeground);
	addColorSelector(g, __tr2qs_ctx("Selected:", "options"), KviOption_colorUserListViewSelectionForeground);
	addColorSelector(g, __tr2qs_ctx("IRC Op:", "options"), KviOption_colorUserListViewIrcOpForeground);
	addColorSelector(g, __tr2qs_ctx("Channel owner:", "options"), KviOption_colorUserListViewChanOwnerForeground);
	addColorSelector(g, __tr2qs_ctx("Channel admin:", "options"), KviOption_colorUserListViewChanAdminForeground);
	addColorSelector(g, __tr2qs_ctx("Op:", "options"), KviOption_colorUserListViewOpForeground);
	addColorSelector(g, __tr2qs_ctx("Half-op:", "options"), KviOption_colorUserListViewHalfOpForeground);
	addColorSelector(g, __tr2qs_ctx("Voice:", "options"), KviOption_colorUserListViewVoiceForeground);
	addColorSelector(g, __tr2qs_ctx("User-op:", "options"), KviOption_colorUserListViewUserOpForeground);

	KviTalHBox * ahb = new KviTalHBox(g);
	ahb->setSpacing(4);
	KviBoolSelector * ab = addBoolSelector(ahb, __tr2qs_ctx("Away (blend color):", "options"), KviOption_boolUserListViewUseAwayColor);
	QString szTip = __tr2qs("The color selected, will be blended with the user rank foreground color.<br>"
	                        "You should also consider your theme's style, color and the userlist background selected color for optimum visibility.<br>"
	                        "If no color is selected respective user rank color specified will be used instead.");

	KviColorSelector * as = addColorSelector(ahb, QString(), KviOption_colorUserListViewAwayForeground);
	connect(ab, SIGNAL(toggled(bool)), as, SLOT(setEnabled(bool)));
	mergeTip(ab, szTip);

	KviTalHBox * hb = new KviTalHBox(g);
	hb->setSpacing(4);
	KviBoolSelector * b = addBoolSelector(hb, __tr2qs_ctx("Use different color for own nick:", "options"), KviOption_boolUseDifferentColorForOwnNick);
	KviColorSelector * s = addColorSelector(hb, "", KviOption_colorUserListViewOwnForeground, KVI_OPTION_BOOL(KviOption_boolUseDifferentColorForOwnNick));
	connect(b, SIGNAL(toggled(bool)), s, SLOT(setEnabled(bool)));

	addRowSpacer(0, 3, 0, 3);
}
Esempio n. 2
0
OptionsWidget_dccAdvanced::OptionsWidget_dccAdvanced(QWidget * parent)
: KviOptionsWidget(parent)
{
	setObjectName("dccgeneral_options_widget");
	createLayout();

	KviTalGroupBox * g = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("Network Properties","options"));

	KviBoolSelector * b = addBoolSelector(g,__tr2qs_ctx("Use user-defined address or network interface","options"),KviOption_boolDccListenOnSpecifiedInterfaceByDefault);


	mergeTip(b,__tr2qs_ctx("<center>Enable this option if you are on a multihost machine and want " \
		"to force one of the available IP addresses to be used for outgoing DCCs.<br>This is especially useful " \
		"when you use IPv6 and IPv4 addresses.<br>You can force KVIrc to always choose the IPv4 interface.</center>","options"));

	KviStringSelector * s = addStringSelector(g,__tr2qs_ctx("Listen on address/interface:","options"),KviOption_stringDccListenDefaultInterface,KVI_OPTION_BOOL(KviOption_boolDccListenOnSpecifiedInterfaceByDefault));

	mergeTip(s,__tr2qs_ctx("<center>This is the IP address or name of the interface to use by default for outgoing DCC transfers.<br>" \
		"On UNIX systems that support it, you can also specify IPv4 interface names (such as <b>ppp0</b>).<br>" \
		"If you set it to <b>0.0.0.0</b>, KVIrc will try to use the first available IPv4 interface</center>","options"));

	connect(b,SIGNAL(toggled(bool)),s,SLOT(setEnabled(bool)));

 	b = addBoolSelector(g,__tr2qs_ctx("Use user-defined port range","options"),KviOption_boolUserDefinedPortRange);

	mergeTip(b,__tr2qs_ctx("<center>Enable this option if you want specify a local port range for DCC.</center>","options"));

	KviTalHBox * hb = new KviTalHBox(g);
	hb->setSpacing(4);
	KviUIntSelector * u = addUIntSelector(hb,__tr2qs_ctx("Lowest port:","options"),KviOption_uintDccMinPort,1,65535,5000,KVI_OPTION_BOOL(KviOption_boolUserDefinedPortRange));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));

	u = addUIntSelector(hb,__tr2qs_ctx("Highest port:","options"),KviOption_uintDccMaxPort,1,65535,30000,KVI_OPTION_BOOL(KviOption_boolUserDefinedPortRange));
	connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));

	b = addBoolSelector(g,__tr2qs_ctx("Send a fixed address in requests","options"),KviOption_boolDccSendFakeAddressByDefault);

	mergeTip(b,__tr2qs_ctx("<center>Enable this option if you want to always send a fake IP address in your DCC requests.<br>" \
		"This might be useful if you're behind a router with a static address that does network address translation (NAT) and forwards all or a range of ports.</center>","options"));

	s = addStringSelector(g,__tr2qs_ctx("Send address/interface:","options"),KviOption_stringDefaultDccFakeAddress,KVI_OPTION_BOOL(KviOption_boolDccSendFakeAddressByDefault));
	connect(b,SIGNAL(toggled(bool)),s,SLOT(setEnabled(bool)));

	mergeTip(s,__tr2qs_ctx("<center>This is the fixed address that will be sent with all DCC requests if you enable the option above.</center>","options"));

	KviBoolSelector * b2;
	b2 = addBoolSelector(g,__tr2qs_ctx("Guess address from IRC server if unroutable","options"),KviOption_boolDccGuessIpFromServerWhenLocalIsUnroutable,!KVI_OPTION_BOOL(KviOption_boolDccSendFakeAddressByDefault));
	connect(b,SIGNAL(toggled(bool)),b2,SLOT(setNotEnabled(bool)));

	mergeTip(b2,__tr2qs_ctx("<center>You can enable this option if you are behind a router that forwards all or a range of ports.<br>" \
			"KVIrc will try to guess the IP address to use for DCC by looking up the local hostname as seen " \
			"by the IRC server you're connected to.<br>This method is an exclusive alternative to the \"fixed address\" above.<br>" \
			"It might guess the correct address automatically if certain conditions are met (e.g. the IRC server does not mask hostnames).</center>","options"));

	b = addBoolSelector(g,__tr2qs_ctx("Use \"broken bouncer hack\" to detect address","options"),KviOption_boolDccBrokenBouncerHack,KVI_OPTION_BOOL(KviOption_boolDccGuessIpFromServerWhenLocalIsUnroutable));
	mergeTip(b,__tr2qs_ctx("<center>When you're behind a dialup router and also tunneling through a psyBNC bouncer, " \
				"you can use a bug in the bouncer to force KVIrc to bind the DCC connections to the dialup router's address.<br>" \
				"It's an ugly hack - use it only if nothing else works.</center>","options"));

	connect(b2,SIGNAL(toggled(bool)),b,SLOT(setEnabled(bool)));

	b = addBoolSelector(0,1,1,1,__tr2qs_ctx("Notify failed DCC handshakes to the remote end","options"),KviOption_boolNotifyFailedDccHandshakes);
	mergeTip(b,__tr2qs_ctx("<center>If you enable this option, when a DCC request from a remote " \
					"user can't be satisfied KVIrc will notify him by a CTCP ERRMSG. This is " \
					"a nice feature so it is a good idea to leave it on unless for some reason " \
					"you have deactivated the antiflood system: in this case turning off this option " \
					"might help if you often get attacked by CTCP floods.</center>","options"));

	u = addUIntSelector(0,2,1,2,__tr2qs_ctx("Maximum number of DCC sessions","options"),KviOption_uintMaxDccSlots,0,1000,64);
	mergeTip(u,__tr2qs_ctx("<center>This is the maximum number of concurrent DCC sessions " \
					"and it includes all the DCC types (send,chat,recv...). " \
					"KVIrc will refuse the requests when this limit is reached.</center>","options"));

	u = addUIntSelector(0,3,1,3,__tr2qs_ctx("DCC socket timeout:","options"),KviOption_uintDccSocketTimeout,10,65536,180);
	u->setSuffix(__tr2qs_ctx(" sec","options"));
	mergeTip(u,__tr2qs_ctx("<center>This is the amount of time that KVIrc will wait for a response before assuming that a DCC has failed " \
		"because the remote client was unable to connect to our listening socket.</center>","options"));

	addRowSpacer(0,4,1,4);
}
RegisteredUserEntryDialog::RegisteredUserEntryDialog(QWidget *p,KviRegisteredUser * r,bool bModal)
: KviTalTabDialog(p,"reguser_entry_editor",bModal)
{
	m_pUser = r;
	m_pCustomColor = new QColor();

	if(r)
	{
		QString col=r->getProperty("customColor");
		KviStringConversion::fromString(col,(*m_pCustomColor));
	}

	m_pPropertyDict = new KviPointerHashTable<QString,QString>(17,false);
	m_pPropertyDict->setAutoDelete(true);

	//setMinimumSize(400,450);

	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Linux)));
	setWindowTitle(__tr2qs_ctx("Registered User Entry","register"));

	QWidget * p1 = new QWidget(this);

	QGridLayout * g = new QGridLayout(p1);

	QLabel * l = new QLabel(__tr2qs_ctx("Name:","register"),p1);
	g->addWidget(l,0,0);

	m_pNameEdit = new QLineEdit(p1);
	g->addWidget(m_pNameEdit,0,1);

	l = new QLabel(__tr2qs_ctx("Comment:","register"),p1);
	g->addWidget(l,1,0);

	m_pCommentEdit = new QLineEdit(p1);
	g->addWidget(m_pCommentEdit,1,1);

	QFrame * f = new QFrame(p1);
	g->addWidget(f,2,0,1,2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);

	l = new QLabel(__tr2qs_ctx("Masks:","register"),p1);
	g->addWidget(l,3,0,1,2);

	m_pMaskListBox = new QListWidget(p1);
	connect(m_pMaskListBox,SIGNAL(itemSelectionChanged()),this,SLOT(maskCurrentChanged()));
	m_pMaskListBox->setMinimumSize(300,200);

	g->addWidget(m_pMaskListBox,4,0,1,2);

	KviTalHBox * b = new KviTalHBox(p1);
	g->addWidget(b,5,0,1,2);
	b->setSpacing(4);

	m_pAddMaskButton = new QPushButton(__tr2qs_ctx("&Add...","register"),b);
	connect(m_pAddMaskButton,SIGNAL(clicked()),this,SLOT(addMaskClicked()));
	m_pAddMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pDelMaskButton = new QPushButton(__tr2qs_ctx("Re&move","register"),b);
	m_pDelMaskButton->setEnabled(false);
	connect(m_pDelMaskButton,SIGNAL(clicked()),this,SLOT(delMaskClicked()));
	m_pDelMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::DeleteItem)));

	m_pEditMaskButton = new QPushButton(__tr2qs_ctx("&Edit","register"),b);
	m_pEditMaskButton->setEnabled(false);
	connect(m_pEditMaskButton,SIGNAL(clicked()),this,SLOT(editMaskClicked()));
	m_pEditMaskButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::EditItem)));

	g->setRowStretch(4,1);
	g->setColumnStretch(1,1);

	addTab(p1,__tr2qs_ctx("Identity","register"));

	QWidget * p2 = new QWidget(this);

	g = new QGridLayout(p2);

	m_pNotifyCheck = new QCheckBox(__tr2qs_ctx("Notify when user is online","register"),p2);
	g->addWidget(m_pNotifyCheck,0,0,1,3);

	m_pNotifyLabel = new QLabel(__tr2qs_ctx("Notify nicknames:","register"),p2);
	m_pNotifyLabel->setEnabled(m_pNotifyCheck->isChecked());
	g->addWidget(m_pNotifyLabel,1,0);
	m_pNotifyCheck->setToolTip(__tr2qs_ctx("<center>You can enter a space separated list of nicknames.</center>","register"));


	m_pNotifyNick = new QLineEdit(p2);
	m_pNotifyNick->setEnabled(false);

	g->addWidget(m_pNotifyNick,1,1,1,2);
	connect(m_pNotifyCheck,SIGNAL(toggled(bool)),this,SLOT(notifyCheckClicked(bool)));


	f = new QFrame(p2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	g->addWidget(f,2,0,1,3);

	m_pAvatar = 0;
	if(r)
	{
		const QString av = r->getProperty("avatar");
		if(!av.isEmpty())
		{
			m_pAvatar = new KviPixmap(av.toUtf8().data());
		}
	}
	if(!m_pAvatar)m_pAvatar = new KviPixmap();

	m_pAvatarSelector = new KviPixmapSelector(p2,__tr2qs_ctx("Avatar","register"),m_pAvatar,true);
	g->addWidget(m_pAvatarSelector,3,0,1,3);

	f = new QFrame(p2);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	g->addWidget(f,4,0,1,3);

	m_pCustomColorCheck = new QCheckBox(__tr2qs_ctx("Use custom color in userlist","register"),p2);
	if(r)
		m_pCustomColorCheck->setChecked(r->getBoolProperty("useCustomColor"));
	g->addWidget(m_pCustomColorCheck,5,0,1,2);

	m_pCustomColorSelector = new KviColorSelector(p2,QString(),m_pCustomColor,1);
	g->addWidget(m_pCustomColorSelector,5,2);

	QPushButton * pb = new QPushButton(__tr2qs_ctx("All Properties...","register"),p2);
	connect(pb,SIGNAL(clicked()),this,SLOT(editAllPropertiesClicked()));
	g->addWidget(pb,6,2);

	g->setColumnStretch(1,1);
	g->setRowStretch(3,1);

	addTab(p2,__tr2qs_ctx("Properties","register"));

	// Ignore TAB
	KviTalVBox * vb = new KviTalVBox(this);
	vb->setMargin(10);

	m_pIgnoreEnabled = new QCheckBox(__tr2qs_ctx("Enable ignore for this user","register"),vb);

	QGroupBox * gb = new QGroupBox(__tr2qs_ctx("Ignore features","register"),vb);
	connect(m_pIgnoreEnabled,SIGNAL(toggled(bool)),gb,SLOT(setEnabled(bool)));

	QVBoxLayout * layout = new QVBoxLayout(gb);
	layout->setMargin(20);
	layout->setSpacing(3);

	m_pIgnoreQuery = new QCheckBox(__tr2qs_ctx("Ignore query messages","register"),gb);
	layout->addWidget(m_pIgnoreQuery);

	m_pIgnoreChannel = new QCheckBox(__tr2qs_ctx("Ignore channel messages","register"),gb);
	layout->addWidget(m_pIgnoreChannel);

	m_pIgnoreNotice = new QCheckBox(__tr2qs_ctx("Ignore notice messages","register"),gb);
	layout->addWidget(m_pIgnoreNotice);

	m_pIgnoreCtcp = new QCheckBox(__tr2qs_ctx("Ignore CTCP messages","register"),gb);
	layout->addWidget(m_pIgnoreCtcp);

	m_pIgnoreInvite = new QCheckBox(__tr2qs_ctx("Ignore invites","register"),gb);
	layout->addWidget(m_pIgnoreInvite);

	m_pIgnoreDcc = new QCheckBox(__tr2qs_ctx("Ignore DCCs","register"),gb);
	layout->addWidget(m_pIgnoreDcc);

	QWidget *w = new QWidget(vb);
	w->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);

	addTab(vb,__tr2qs_ctx("Ignore","register"));

	setCancelButton(__tr2qs_ctx("Cancel","register"));
	setOkButton(__tr2qs_ctx("&OK","register"));
	connect(this,SIGNAL(applyButtonPressed()),this,SLOT(okClicked()));
	connect(this,SIGNAL(cancelButtonPressed()),this,SLOT(reject()));

	if(r)
	{
		m_pNameEdit->setText(r->name());
		m_pCommentEdit->setText(r->getProperty("comment"));
		for(KviIrcMask * m = r->maskList()->first();m;m = r->maskList()->next())
		{
			QString mk = m->nick();
			mk += QChar('!');
			mk += m->user();
			mk += QChar('@');
			mk += m->host();
			m_pMaskListBox->addItem(mk);
		}

		QString szNotifyNicks = r->getProperty("notify");
		if(!szNotifyNicks.isEmpty())
		{
			m_pNotifyCheck->setChecked(true);
			m_pNotifyNick->setText(szNotifyNicks);
			m_pNotifyNick->setEnabled(true);
		}

		if(r->propertyDict())
		{
			KviPointerHashTableIterator<QString,QString> it(*(r->propertyDict()));
			while(QString *s = it.current())
			{
				m_pPropertyDict->insert(it.currentKey(),new QString(*s));
				++it;
			}
		}

		m_pIgnoreEnabled->setChecked(r->ignoreEnagled());

		gb->setEnabled(r->ignoreEnagled());

		m_pIgnoreQuery->setChecked(r->ignoreFlags() & KviRegisteredUser::Query);
		m_pIgnoreChannel->setChecked(r->ignoreFlags() & KviRegisteredUser::Channel);
		m_pIgnoreNotice->setChecked(r->ignoreFlags() & KviRegisteredUser::Notice);
		m_pIgnoreCtcp->setChecked(r->ignoreFlags() & KviRegisteredUser::Ctcp);
		m_pIgnoreInvite->setChecked(r->ignoreFlags() & KviRegisteredUser::Invite);
		m_pIgnoreDcc->setChecked(r->ignoreFlags() & KviRegisteredUser::Dcc);
	} else {
		// default values
		if(!m_pIgnoreEnabled->isChecked())
		{
			gb->setEnabled(false);
		}
	}
}
RegisteredUserMaskDialog::RegisteredUserMaskDialog(QWidget * p,KviIrcMask * m)
: QDialog(p)
{
	setObjectName("reguser_mask_editor");
	setWindowModality(Qt::WindowModal);
	m_pMask = m;

	setWindowTitle(__tr2qs_ctx("Mask Editor","register"));

	QGridLayout * g = new QGridLayout(this);

	QLabel * l = new QLabel(__tr2qs_ctx("Insert a mask for this user.<br>It can contain the wildcard characters '*' and '?'.","register"),this);
	//l->setAlignment(Qt::AlignCenter);
	g->addWidget(l,0,0,1,2);

	KviTalHBox * b = new KviTalHBox(this);
	g->addWidget(b,1,0,1,2);

	m_pNickEdit = new QLineEdit(b);
	//m_pNickEdit->setMinimumWidth(120);
	m_pNickEdit->setAlignment(Qt::AlignRight);
	m_pNickEdit->setToolTip(__tr2qs_ctx("<center>This is the <b>nickname</b> that will match this user, default value is the registered name.</center>","register"));

	l = new QLabel("<center><b>!</b></center>",b);
	l->setAlignment(Qt::AlignCenter);
	//l->setMinimumWidth(40);

	m_pUserEdit = new QLineEdit(b);
	//m_pUserEdit->setMinimumWidth(120);
	m_pUserEdit->setAlignment(Qt::AlignCenter);
	m_pUserEdit->setToolTip(__tr2qs_ctx("<center>This is the <b>username</b> that will match this user. <b>*</b> will match any username.</center>","register"));

	l = new QLabel("<center><b>@</b></center>",b);
	l->setAlignment(Qt::AlignCenter);
	//l->setMinimumWidth(40);

	m_pHostEdit = new QLineEdit(b);
	//m_pHostEdit->setMinimumWidth(120);
	m_pHostEdit->setAlignment(Qt::AlignLeft);
	m_pHostEdit->setToolTip(__tr2qs_ctx("<center>This is the <b>hostname</b> that will match this user. <b>*</b> will match any hostname.</center>","register"));

	// just a spacer
//	l = new QLabel("<nobr>&nbsp;<nobr>",this);
//	g->addMultiCellWidget(l,2,2,0,1);

//	QFrame * f = new QFrame(this);
//	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);
//	g->addMultiCellWidget(f,3,3,0,1);

	b = new KviTalHBox(this);
	b->setSpacing(4);
	g->addWidget(b,2,1);

	QPushButton * pb = new QPushButton(__tr2qs_ctx("&OK","register"),b);
	connect(pb,SIGNAL(clicked()),this,SLOT(okClicked()));
	//pb->setMinimumWidth(120);

	pb = new QPushButton(__tr2qs_ctx("Cancel","register"),b);
	connect(pb,SIGNAL(clicked()),this,SLOT(reject()));
	//pb->setMinimumWidth(120);

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

	m_pNickEdit->setText(m->nick());
	m_pUserEdit->setText(m->user());
	m_pHostEdit->setText(m->host());
}
Esempio n. 5
0
OptionsDialog::OptionsDialog(QWidget * par,const QString &szGroup,bool bModal)
    : QDialog(par)
{
    setObjectName("general_options_dialog");

    setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::KVIrc)));

    m_szGroup = szGroup;

    QString szDialogTitle;

    if(szGroup.isEmpty() || KviQString::equalCI(szGroup,"general"))
    {
        szDialogTitle = __tr2qs_ctx("General Preferences","options");
    } else if(KviQString::equalCI(szGroup,"theme"))
    {
        szDialogTitle = __tr2qs_ctx("Theme Preferences","options");
    } else {
        szDialogTitle = __tr2qs_ctx("KVIrc Preferences","options");
    }

    QString szDialog = __tr2qs_ctx("This dialog contains a set of KVIrc settings.<br> Use the icons " \
                                   "on the left to navigate through the option pages. The text box in the " \
                                   "bottom left corner is a small search engine. It will highlight the " \
                                   "pages that contain options related to the search term you have entered.","options");


    QString szInfoTips;
    szInfoTips = __tr2qs_ctx("Many settings have tooltips that can be shown by holding " \
                             "the cursor over their label for a few seconds.","options");

    QString szOkCancelButtons = __tr2qs_ctx("When you have finished, click \"<b>OK</b>\" to accept your changes " \
                                            "or \"<b>Cancel</b>\" to discard them. Clicking \"<b>Apply</b>\" will commit your " \
                                            "changes without closing the window.","options");

    QString szFrontText = QString(
                              "<table width=\"100%\" height=\"100%\" valign=\"top\" align=\"center\" cellpadding=\"4\">" \
                              "<tr>" \
                              "<td bgcolor=\"#303030\" valign=\"top\">" \
                              "<center><h1><font color=\"#FFFFFF\">%1</font></h1></center>" \
                              "</td>" \
                              "</tr>" \
                              "<tr>" \
                              "<td valign=\"bottom\">" \
                              "<p>" \
                              "%2" \
                              "</p>" \
                              "<br style=\"line-height:5px;\"/>" \
                              "<p>" \
                              "%3" \
                              "</p>" \
                              "<br style=\"line-height:5px;\"/>" \
                              "<p>" \
                              "%4" \
                              "</p>" \
                              "</td>" \
                              "</tr>" \
                              "</table>"
                          ).arg(szDialogTitle, szDialog, szInfoTips, szOkCancelButtons);

    QString szCaption = szDialogTitle + " - KVIrc";
    setWindowTitle(szCaption);

    QGridLayout * g1 = new QGridLayout(this);
    QSplitter * spl = new QSplitter(Qt::Horizontal,this);
    spl->setChildrenCollapsible(false);

    g1->addWidget(spl,0,0,1,5);

    KviTalVBox * vbox = new KviTalVBox(spl);
    vbox->setSpacing(2);
    vbox->setMargin(3);

    // Controlling list view
    m_pTreeWidget = new QTreeWidget(vbox);

    m_pTreeWidget->header()->hide();
    m_pTreeWidget->setRootIsDecorated(true);
    m_pTreeWidget->setSortingEnabled(false);
    m_pTreeWidget->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
    m_pTreeWidget->setCurrentItem(NULL);

    connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem *)),this,SLOT(treeWidgetItemSelectionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));

    KviTalHBox * hbox = new KviTalHBox(vbox);
    hbox->setSpacing(2);
    hbox->setMargin(3);

    m_pSearchLineEdit = new QLineEdit(hbox);
    connect(m_pSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(searchClicked()));
    m_pSearchButton = new QToolButton(hbox);
    m_pSearchButton->setIconSize(QSize(16,16));
    m_pSearchButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Search)));
    connect(m_pSearchButton,SIGNAL(clicked()),this,SLOT(searchClicked()));
    connect(m_pSearchLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(searchLineEditTextChanged(const QString &)));

    QString szTip = __tr2qs_ctx("<p>This is the search tool for this options dialog.</p>" \
                                "<p>You can enter a search term either in your native " \
                                "language or in English and press the button on the right. " \
                                "The pages that contain some options related to the " \
                                "search term will be highlighted and you will be able " \
                                "to quickly find them.</p><p>Try \"nickname\" for example.</p>","options");
    KviTalToolTip::add(m_pSearchLineEdit,szTip);
    KviTalToolTip::add(m_pSearchButton,szTip);

    vbox = new KviTalVBox(spl);
    vbox->setSpacing(2);
    vbox->setMargin(3);

    m_pCategoryLabel = new QLabel("<b>&nbsp;</b>",vbox);
    m_pCategoryLabel->setObjectName("labgeneraloptions");

    QFrame * f = new QFrame(vbox);
    f->setFrameStyle(QFrame::HLine | QFrame::Sunken);

    // Widget stack
    m_pWidgetStack = new QStackedWidget(vbox);
    vbox->setStretchFactor(m_pWidgetStack,1);

    // First widget visible
    m_pFrontWidget = new OptionsDialogFrontWidget(m_pWidgetStack,szFrontText);
    m_pWidgetStack->addWidget(m_pFrontWidget);

    int idx = m_pWidgetStack->indexOf(m_pFrontWidget);
    m_pWidgetStack->widget(idx)->raise();

    //  Ok,Cancel,Help
    QPushButton * b = new QPushButton(__tr2qs_ctx("&OK","options"),this);
    b->setObjectName("btnok");
    KviTalToolTip::add(b,__tr2qs_ctx("Close this dialog, accepting all changes.","options"));
    connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));
    //b->setMinimumWidth(whatIsThisWidth);
    b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
    g1->addWidget(b,1,2);

    b = new QPushButton(__tr2qs_ctx("&Apply","options"),this);
    b->setObjectName("btnapply");
    KviTalToolTip::add(b,__tr2qs_ctx("Commit all changes immediately.","options"));
    connect(b,SIGNAL(clicked()),this,SLOT(applyClicked()));
    b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
    g1->addWidget(b,1,3);

    b = new QPushButton(__tr2qs_ctx("Cancel","options"),this);
    b->setObjectName("btncancel");
    KviTalToolTip::add(b,__tr2qs_ctx("Close this dialog, discarding all changes.","options"));
    b->setDefault(true);
    //b->setMinimumWidth(whatIsThisWidth);
    connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));
    b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)));
    g1->addWidget(b,1,4);

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


    fillTreeWidget(0,g_pOptionsInstanceManager->instanceEntryTree(),szGroup);

    if(!parent())
    {
        if(KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).y() < 5)
            KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).setY(5);

        //setGeometry(KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry));
        resize(KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).width(),
               KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).height());
        move(KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).x(),
             KVI_OPTION_RECT(KviOption_rectGeneralOptionsDialogGeometry).y());
    }

    new QShortcut(Qt::Key_Escape,this,SLOT(close()));

    if(bModal)
        setWindowModality(par ? Qt::WindowModal : Qt::ApplicationModal);
}
Esempio n. 6
0
ChannelsJoinDialog::ChannelsJoinDialog(const char * name)
: QDialog(g_pMainWindow)
{
	setObjectName(name);
	setWindowTitle(__tr2qs("Join Channels"));
	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Channel)));

	m_pConsole = 0;

	QGridLayout * g = new QGridLayout(this);

	m_pTreeWidget = new ChannelsJoinDialogTreeWidget(this);
	m_pTreeWidget->setHeaderLabel(__tr2qs("Channel"));
	m_pTreeWidget->setRootIsDecorated(true);
	m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	g->addWidget(m_pTreeWidget,0,0,1,2);
	//connect(m_pTreeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)),this,SLOT(itemDoubleClicked(QTreeWidgetItem *,int)));


	m_pGroupBox = new KviTalGroupBox(Qt::Horizontal,__tr2qs("Channel" ),this);
	QString szMsg = __tr2qs("Name");
	szMsg.append(":");

	new QLabel(szMsg,m_pGroupBox);

	m_pChannelEdit = new QLineEdit(m_pGroupBox);
	connect(m_pChannelEdit,SIGNAL(returnPressed()), this, SLOT(editReturnPressed()));
	connect(m_pChannelEdit,SIGNAL(textChanged(const QString &)),this,SLOT(editTextChanged(const QString &)));

	szMsg = __tr2qs("Password");
	szMsg.append(":");
	QLabel(szMsg,m_pGroupBox);

	m_pPass = new QLineEdit(m_pGroupBox);
	m_pPass->setEchoMode(QLineEdit::Password);

	g->addWidget(m_pGroupBox,1,0,1,2);

	KviTalHBox * hb = new KviTalHBox(this);
	hb->setSpacing(4);

	g->addWidget(hb,2,0,1,2,Qt::AlignHCenter);

	m_pJoinButton = new QPushButton(__tr2qs("&Join"),hb);
	// Join on return pressed
	m_pJoinButton->setDefault(true);
	connect(m_pJoinButton,SIGNAL(clicked()),this,SLOT(joinClicked()));

	m_pRegButton = new QPushButton(__tr2qs("&Register"),hb);
	// Join on return pressed
	connect(m_pRegButton,SIGNAL(clicked()),this,SLOT(regClicked()));

	m_pClearButton = new QPushButton(__tr2qs("Clear Recent"),hb);
	connect(m_pClearButton,SIGNAL(clicked()),this,SLOT(clearClicked()));

	m_pShowAtStartupCheck = new QCheckBox(__tr2qs("Show this window after connecting"),this);
	m_pShowAtStartupCheck->setChecked(KVI_OPTION_BOOL(KviOption_boolShowChannelsJoinOnIrc));
	g->addWidget(m_pShowAtStartupCheck,3,0);


	QPushButton * cancelButton = new QPushButton(__tr2qs("Close"),this);
	connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));

	g->addWidget(cancelButton,3,1);

/*
	KviTalHBox * hb = new KviTalHBox(this);
	hb->setSpacing(4);

	QPushButton * namesButton = new QPushButton("/names", hb);
	connect(namesButton,SIGNAL(clicked()),this,SLOT(namesClicked()));
	QPushButton * whoButton = new QPushButton("/who", hb);
	connect(whoButton,SIGNAL(clicked()),this,SLOT(whoClicked()));

	g->addWidget(hb,2,0);
*/

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

	fillListView();

	if(g_rectChannelsJoinGeometry.y() < 5)
		g_rectChannelsJoinGeometry.setY(5);

	resize(g_rectChannelsJoinGeometry.width(),g_rectChannelsJoinGeometry.height());
	//move(g_rectChannelsJoinGeometry.x(),g_rectChannelsJoinGeometry.y());

	QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
	move(rect.x() + ((rect.width() - g_rectChannelsJoinGeometry.width())/2),rect.y() + ((rect.height() - g_rectChannelsJoinGeometry.height())/2));

	enableJoin();
}
Esempio n. 7
0
AddonManagementDialog::AddonManagementDialog(QWidget * p)
: QWidget(p)
{
	setWindowTitle(__tr2qs_ctx("Manage Addons - KVIrc","addon"));
	setObjectName("Addon manager");
	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Addons)));

#ifdef COMPILE_WEBKIT_SUPPORT
	m_pWebInterfaceDialog = NULL;
#endif //COMPILE_WEBKIT_SUPPORT

	m_pInstance = this;
	QGridLayout * g = new QGridLayout(this);

	KviTalHBox *hb = new KviTalHBox(this);
	hb->setMargin(1);
	hb->setSpacing(1);
	g->addWidget(hb,0,0);

	QToolButton * tb;
	QFrame * sep;

	m_pConfigureButton = new QToolButton(hb);
	m_pConfigureButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_ADDONS)));
	m_pConfigureButton->setIconSize(QSize(32,32));
	KviTalToolTip::add(m_pConfigureButton,__tr2qs_ctx("Configure addon...","addon"));
	connect(m_pConfigureButton,SIGNAL(clicked()),this,SLOT(configureScript()));

	m_pHelpButton = new QToolButton(hb);
	m_pHelpButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_HELP)));
	m_pHelpButton->setIconSize(QSize(32,32));
	KviTalToolTip::add(m_pHelpButton,__tr2qs_ctx("Show help","addon"));
	connect(m_pHelpButton,SIGNAL(clicked()),this,SLOT(showScriptHelp()));

	m_pUninstallButton = new QToolButton(hb);
	m_pUninstallButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_REMOVE)));
	m_pUninstallButton->setIconSize(QSize(32,32));
	KviTalToolTip::add(m_pUninstallButton,__tr2qs_ctx("Delete selected addon","addon"));
	connect(m_pUninstallButton,SIGNAL(clicked()),this,SLOT(uninstallScript()));

	sep = new QFrame(hb);
	sep->setFrameStyle(QFrame::VLine | QFrame::Sunken);
	sep->setMinimumWidth(12);

	m_pPackButton = new QToolButton(hb);
	m_pPackButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK)));
	m_pPackButton->setIconSize(QSize(32,32));
	KviTalToolTip::add(m_pPackButton,__tr2qs_ctx("Create an addon as a distributable package","addon"));
	connect(m_pPackButton,SIGNAL(clicked()),this,SLOT(packScript()));

	sep = new QFrame(hb);
	sep->setFrameStyle(QFrame::VLine | QFrame::Sunken);
	sep->setMinimumWidth(12);

	tb = new QToolButton(hb);
	tb->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_OPEN)));
	tb->setIconSize(QSize(32,32));
	KviTalToolTip::add(tb,__tr2qs_ctx("Install addon package from disk","addon"));
	connect(tb,SIGNAL(clicked()),this,SLOT(installScript()));

	tb = new QToolButton(hb);
	tb->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_WWW)));
	tb->setIconSize(QSize(32,32));
	KviTalToolTip::add(tb,__tr2qs_ctx("Get more addons...","addon"));
	connect(tb,SIGNAL(clicked()),this,SLOT(getMoreScripts()));

	QWidget *w= new QWidget(hb);
	w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

	m_pListWidget = new KviTalListWidget(this);
	KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(m_pListWidget);

	m_pListWidget->setItemDelegate(itemDelegate);
	m_pListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	m_pListWidget->setSortingEnabled(true);
	m_pListWidget->setMinimumHeight(400);
	m_pListWidget->setMinimumWidth(380);
	g->addWidget(m_pListWidget,1,0);

	fillListView();

	currentChanged(0,0);
	connect(m_pListWidget,SIGNAL(currentItemChanged(QListWidgetItem *,QListWidgetItem *)),this,SLOT(currentChanged(QListWidgetItem *,QListWidgetItem *)));
	m_pListWidget->setCurrentItem(m_pListWidget->item(0));

	QPushButton * pCloseBtn = new QPushButton(__tr2qs_ctx("Close","addon"),this);
	pCloseBtn->setMaximumSize(pCloseBtn->sizeHint().width(),pCloseBtn->sizeHint().height());
	connect(pCloseBtn,SIGNAL(clicked()),this,SLOT(closeClicked()));
	g->addWidget(pCloseBtn,2,0);

	g->setMargin(5);
	g->setSpacing(5);
	g->setAlignment(pCloseBtn,Qt::AlignRight);

	if(g_rectManagementDialogGeometry.y() < 5)
	{
		g_rectManagementDialogGeometry.setY(5);
	}
	resize(g_rectManagementDialogGeometry.width(),
		g_rectManagementDialogGeometry.height());

	QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
	move(rect.x() + ((rect.width() - g_rectManagementDialogGeometry.width())/2),rect.y() + ((rect.height() - g_rectManagementDialogGeometry.height())/2));

	new QShortcut(Qt::Key_Escape, this, SLOT(closeClicked()));
}
Esempio n. 8
0
KviTalWizard::KviTalWizard(QWidget * pParent)
: QDialog(pParent)
{
	m_p = new KviTalWizardPrivate;
	m_p->pPageList = new KviPointerList<KviTalWizardPageData>;
	m_p->pPageList->setAutoDelete(true);
	m_p->pCurrentPage = NULL;
	m_p->iEnabledPageCount = 0;
	m_p->pLayout = new QGridLayout(this);

	m_p->pTitleLabel = new QLabel(this);
	m_p->pLayout->addWidget(m_p->pTitleLabel,0,0,1,3);

	m_p->pStepsLabel = new QLabel(this);
	m_p->pStepsLabel->setMinimumWidth(80);
	m_p->pStepsLabel->setAlignment(Qt::AlignRight);
	m_p->pLayout->addWidget(m_p->pStepsLabel,0,4,1,3);

	QFrame * f1 = new QFrame(this);
	f1->setFrameStyle(QFrame::Sunken | QFrame::HLine);
	m_p->pLayout->addWidget(f1,1,0,1,7);

	m_p->pWidgetStack = new QStackedWidget(this);
	m_p->pLayout->addWidget(m_p->pWidgetStack,2,0,1,7);

	QFrame * f2 = new QFrame(this);
	f2->setFrameStyle(QFrame::Sunken | QFrame::HLine);
	m_p->pLayout->addWidget(f2,3,0,1,7);

	KviTalHBox * pButtonBox = new KviTalHBox(this);
	m_p->pLayout->addWidget(pButtonBox,4,0,1,7);

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


	m_p->pCancelButton = new QPushButton(__tr("Cancel"),pButtonBox);
	m_p->pCancelButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pCancelButton,
			SIGNAL(clicked()),
			this,
			SLOT(cancelButtonClicked())
		);

	QWidget * pSpacer = new QWidget(pButtonBox);
	pSpacer->setFixedWidth(4);

	m_p->pHelpButton = new QPushButton(__tr("Help"),pButtonBox);
	m_p->pHelpButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pHelpButton,
			SIGNAL(clicked()),
			this,
			SLOT(helpButtonClicked())
		);

	QWidget * pLargeSpacer = new QWidget(pButtonBox);
	pLargeSpacer->setMinimumWidth(50);
	pButtonBox->setStretchFactor(pLargeSpacer,100);

	QString szText = "< ";
	szText += __tr("Back");
	m_p->pBackButton = new QPushButton(szText,pButtonBox);
	m_p->pBackButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pBackButton,
			SIGNAL(clicked()),
			this,
			SLOT(backButtonClicked())
		);

	m_p->pNextSpacer = new QWidget(pButtonBox);
	m_p->pNextSpacer->setFixedWidth(4);

	szText = __tr("Next");
	szText += " >";
	m_p->pNextButton = new QPushButton(szText,pButtonBox);
	m_p->pNextButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pNextButton,
			SIGNAL(clicked()),
			this,
			SLOT(nextButtonClicked())
		);

	m_p->pFinishSpacer = new QWidget(pButtonBox);
	m_p->pFinishSpacer->setFixedWidth(4);

	m_p->pFinishButton = new QPushButton(__tr("Finish"),pButtonBox);
	m_p->pFinishButton->setMinimumWidth(80);
	QObject::connect(
			m_p->pFinishButton,
			SIGNAL(clicked()),
			this,
			SLOT(finishButtonClicked())
		);

	m_p->pLayout->setMargin(8);
	m_p->pLayout->setSpacing(4);
	m_p->pLayout->setRowStretch(2,1);
	m_p->pLayout->setColumnStretch(0,1);
}
Esempio n. 9
0
RegisteredUsersDialog::RegisteredUsersDialog(QWidget * par)
: QWidget(par)
{
	g_pRegisteredUsersDialog = this;

	g_pLocalRegisteredUserDataBase = new KviRegisteredUserDataBase();
	g_pLocalRegisteredUserDataBase->copyFrom(g_pRegisteredUserDataBase);

	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::RegUsers)));
	setWindowTitle(__tr2qs_ctx("Registered Users - KVIrc","register"));

	QGridLayout * g = new QGridLayout(this);


	m_pListView = new KviRegisteredUsersListView(this);
	m_pListView->setItemDelegate(new RegisteredUsersDialogItemDelegate());

	connect(m_pListView,SIGNAL(itemPressed(QTreeWidgetItem *,int)),this,SLOT(itemPressed(QTreeWidgetItem *,int)));
	connect(m_pListView,SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),this,SLOT(itemDoubleClicked(QTreeWidgetItem *, int)));

	g->addWidget(m_pListView,0,0,2,2);

	KviTalVBox * vbox = new KviTalVBox(this);
	vbox->setSpacing(4);
	g->addWidget(vbox,0,2);

	m_pWizardAddButton = new QPushButton(__tr2qs_ctx("Add (Wizard)...","register"),vbox);
	connect(m_pWizardAddButton,SIGNAL(clicked()),this,SLOT(addWizardClicked()));
	m_pWizardAddButton->setToolTip(__tr2qs_ctx("Add a registered user by means of a user-friendly wizard.","register"));
	m_pWizardAddButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItemByWizard)));


	m_pAddButton = new QPushButton(__tr2qs_ctx("&Add...","register"),vbox);
	connect(m_pAddButton,SIGNAL(clicked()),this,SLOT(addClicked()));
	m_pAddButton->setToolTip(__tr2qs_ctx("Open the edit dialog to create a new user entry.","register"));
	m_pAddButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pAddGroupButton = new QPushButton(__tr2qs_ctx("&Add Group...","register"),vbox);
	connect(m_pAddGroupButton,SIGNAL(clicked()),this,SLOT(addGroupClicked()));
	m_pAddGroupButton->setToolTip(__tr2qs_ctx("Adds a new group","register"));
	m_pAddGroupButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::NewItem)));

	m_pRemoveButton = new QPushButton(__tr2qs_ctx("Re&move","register"),vbox);
	connect(m_pRemoveButton,SIGNAL(clicked()),this,SLOT(removeClicked()));
	m_pRemoveButton->setEnabled(false);
	m_pRemoveButton->setToolTip(__tr2qs_ctx("Remove the currently selected entries.","register"));
	m_pRemoveButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::DeleteItem)));


	m_pEditButton = new QPushButton(__tr2qs_ctx("&Edit...","register"),vbox);
	connect(m_pEditButton,SIGNAL(clicked()),this,SLOT(editClicked()));
	m_pEditButton->setEnabled(false);
	m_pEditButton->setToolTip(__tr2qs_ctx("Edit the first selected entry.","register"));
	m_pEditButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::EditItem)));

	QFrame * f = new QFrame(vbox);
	f->setFrameStyle(QFrame::HLine | QFrame::Sunken);

	m_pSelectAllButton = new QPushButton(__tr2qs_ctx("Select all","register"),vbox);
	connect(m_pSelectAllButton,SIGNAL(clicked()),this,SLOT(selectAllClicked()));
	m_pSelectAllButton->setToolTip(__tr2qs_ctx("Select all the entries","register"));
	m_pSelectAllButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)));

	m_pExportButton = new QPushButton(__tr2qs_ctx("Export To...","register"),vbox);
	m_pExportButton->setEnabled(false);
	connect(m_pExportButton,SIGNAL(clicked()),this,SLOT(exportClicked()));
	m_pExportButton->setToolTip(__tr2qs_ctx("Export the selected entries to a file.<br>All the data associated with the selected registered users will be exported.<br>You (or anyone else) can later import the entries by using the \"Import\" button.","register"));
	m_pExportButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Floppy)));


	m_pImportButton = new QPushButton(__tr2qs_ctx("Import From...","register"),vbox);
	connect(m_pImportButton,SIGNAL(clicked()),this,SLOT(importClicked()));
	m_pImportButton->setToolTip(__tr2qs_ctx("Import entries from a file exported earlier by the \"export\" function of this dialog.","register"));
	m_pImportButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Folder)));


	KviTalHBox * hbox = new KviTalHBox(this);
	hbox->setSpacing(4);
	g->addWidget(hbox,3,1,1,2);

	QPushButton * b;


	b = new QPushButton(__tr2qs_ctx("&OK","register"),hbox);
	connect(b,SIGNAL(clicked()),this,SLOT(okClicked()));
	b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
	//b->setMinimumWidth(120);

	b = new QPushButton(__tr2qs_ctx("Cancel","register"),hbox);
	connect(b,SIGNAL(clicked()),this,SLOT(cancelClicked()));
	b->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)));
	//b->setMinimumWidth(120);

	g->addItem(new QSpacerItem(0, 15), 2, 0);
	g->setColumnStretch(0,1);
	g->setRowStretch(1,1);

	connect(m_pListView,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
	connect(m_pListView,SIGNAL(rightButtonPressed(QTreeWidgetItem *, QPoint)),this,SLOT(rightButtonPressed(QTreeWidgetItem *, QPoint)));

	new QShortcut(Qt::Key_Escape, this, SLOT(cancelClicked()));

	fillList();

	if(!parent())
	{
		if(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).y() < 5)
			KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).setY(5);

		//setGeometry(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry));
		resize(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width(),
			KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height());

		QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
		move(rect.x() + ((rect.width() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width())/2),rect.y() + ((rect.height() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height())/2));

	}
}
Esempio n. 10
0
IdentityProfileEditor::IdentityProfileEditor(QWidget * pParent)
: QDialog(pParent)
{
	setObjectName("identity_profile_editor");
	setWindowTitle(__tr2qs_ctx("Profile Editor - KVIrc","options"));

	m_szName = __tr2qs_ctx("Profile Name","options");
	m_szNetwork = __tr2qs_ctx("MyNetwork","options");
	m_szNick = __tr2qs_ctx("MyNick","options");
	m_szAltNick = __tr2qs_ctx("MyNick2","options");
	m_szUserName = __tr2qs_ctx("MyUserName","options");
	m_szRealName = __tr2qs_ctx("MyRealName","options");

	QGridLayout * pLayout = new QGridLayout(this);

	QLabel * pLabel = new QLabel(__tr2qs_ctx("Profile Name:","options"),this);
	pLayout->addWidget(pLabel,0,0);

	m_pNameEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pNameEdit,__tr2qs_ctx("Put here the name of the profile","options"));
	pLayout->addWidget(m_pNameEdit,0,1,1,2);
	connect(m_pNameEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	pLabel = new QLabel(__tr2qs_ctx("Network Name:","options"),this);
	pLayout->addWidget(pLabel,1,0);

	m_pNetworkEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pNetworkEdit,__tr2qs_ctx("Put here the name of the network","options"));
	pLayout->addWidget(m_pNetworkEdit,1,1,1,2);
	connect(m_pNetworkEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	pLabel = new QLabel(__tr2qs_ctx("Nickname:","options"),this);
	pLayout->addWidget(pLabel,2,0);

	m_pNickEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pNickEdit,__tr2qs_ctx("Put here the nickname you want to use","options"));
	pLayout->addWidget(m_pNickEdit,2,1,1,2);
	connect(m_pNickEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	pLabel = new QLabel(__tr2qs_ctx("Alternative Nickname:","options"),this);
	pLayout->addWidget(pLabel,3,0);

	m_pAltNickEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pAltNickEdit,__tr2qs_ctx("Put here the alternative nickname you want to use","options"));
	pLayout->addWidget(m_pAltNickEdit,3,1,1,2);
	connect(m_pAltNickEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	pLabel = new QLabel(__tr2qs_ctx("Username:"******"options"),this);
	pLayout->addWidget(pLabel,4,0);

	m_pUserNameEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pUserNameEdit,__tr2qs_ctx("Put here the username you want to use","options"));
	pLayout->addWidget(m_pUserNameEdit,4,1,1,2);
	connect(m_pUserNameEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	pLabel = new QLabel(__tr2qs_ctx("Realname:","options"),this);
	pLayout->addWidget(pLabel,5,0);

	m_pRealNameEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pRealNameEdit,__tr2qs_ctx("Put here the realname you want to use","options"));
	pLayout->addWidget(m_pRealNameEdit,5,1,1,2);
	connect(m_pRealNameEdit,SIGNAL(textChanged(const QString &)),this,SLOT(toggleButton(const QString &)));

	KviTalHBox * pBox = new KviTalHBox(this);
	pBox->setAlignment(Qt::AlignRight);
	pLayout->addWidget(pBox,6,0);

	QPushButton * p = new QPushButton(__tr2qs_ctx("Cancel","options"),pBox);
	//p->setMinimumWidth(100);
	connect(p,SIGNAL(clicked()),this,SLOT(reject()));

	m_pBtnOk = new QPushButton(__tr2qs_ctx("OK","options"),pBox);
	m_pBtnOk->setEnabled(false);
	connect(m_pBtnOk,SIGNAL(clicked()),pParent,SLOT(editProfileOkPressed()));

	pLayout->setColumnStretch(1,1);

	setMinimumWidth(250);
}
Esempio n. 11
0
KviIdentityGeneralOptionsWidget::KviIdentityGeneralOptionsWidget(QWidget * parent)
: KviOptionsWidget(parent)
{
	m_szAltNicknames[0] = KVI_OPTION_STRING(KviOption_stringNickname2);
	m_szAltNicknames[1] = KVI_OPTION_STRING(KviOption_stringNickname3);
	m_szAltNicknames[2] = KVI_OPTION_STRING(KviOption_stringNickname4);


	createLayout();
	layout()->setMargin(10);

	KviTalGroupBox * gbox = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("Basic Properties","options"));
	KviTalHBox * hb = new KviTalHBox(gbox);
	hb->setSpacing(0);
	hb->setMargin(0);

	KviStringSelector * sel = addStringSelector(hb,__tr2qs_ctx("Nickname:","options"),KviOption_stringNickname1);
	sel->setMinimumLabelWidth(120);
	mergeTip(sel,__tr2qs_ctx("<center>Your <b>nickname</b> is your primary form of identification on IRC.<br>" \
			"Since servers cannot accept multiple users sharing the same nickname " \
			"(case insensitive), you can provide alternative nicknames to be used in case"\
			"the server refuses to accept the default one.</center>","options"));

	QValidator * v = new QRegExpValidator(QRegExp("[^-0-9 ][^ ]*"),hb);
	sel->setValidator(v);

	QPushButton * pb = new QPushButton(__tr2qs_ctx("Alternatives...","options"),hb);
	connect(pb,SIGNAL(clicked()),this,SLOT(setNickAlternatives()));

	sel = addStringSelector(gbox,__tr2qs_ctx("Username:"******"options"),KviOption_stringUsername);
	sel->setMinimumLabelWidth(120);
	mergeTip(sel,__tr2qs_ctx("<center>This is the <b>username</b> that you will use to connect to the server.<br>" \
				"In the past, it was used as a form of authentication, but it normally has no special use now.<br>" \
				"In addition to your nickname, you are identified on IRC by your <b>username@hostname</b>.</br>" \
				"Basically, you can enter any word you like here. :D</center>","options"));

	sel = addStringSelector(gbox,__tr2qs_ctx("Real name:","options"),KviOption_stringRealname);
	sel->setMinimumLabelWidth(120);

	mergeTip(sel,__tr2qs_ctx("<center>This text will appear when someone does a /WHOIS on you.<br>" \
				"It is intended to be your real name, but people tend to put random quotes and phrases here too.</center>","options"));


	QString szOptionalCtcpUserInfo = __tr2qs_ctx("This field is optional and will appear as part of the CTCP USERINFO reply.","options");
	QString szCenterBegin("<center>");
	QString szCenterEnd("</center>");
	QString szTrailing = "<br><br>" + szOptionalCtcpUserInfo + szCenterEnd;

	gbox = addGroupBox(0,1,0,1,Qt::Horizontal,__tr2qs_ctx("Profile","options"));

	hb = new KviTalHBox(gbox);
	hb->setSpacing(4);

	QLabel * l = new QLabel(__tr2qs_ctx("Age:","options"),hb);
	l->setMinimumWidth(120);

	m_pAgeCombo = new QComboBox(hb);
	QString szTip1 = szCenterBegin + __tr2qs_ctx("Here you can specify your age.","options") + szTrailing;
	KviTalToolTip::add(l,szTip1);
	KviTalToolTip::add(m_pAgeCombo,szTip1);
	m_pAgeCombo->addItem(__tr2qs_ctx("Unspecified","options"));
	unsigned int i;
	for(i=1;i<120;i++)
	{
		QString tmp;
		tmp.setNum(i);
        m_pAgeCombo->insertItem(m_pAgeCombo->count(),tmp);
	}

	bool bOk;
	i = KVI_OPTION_STRING(KviOption_stringCtcpUserInfoAge).toUInt(&bOk);
	if(!bOk)i = 0;
	if(i > 120)i = 120;
	m_pAgeCombo->setCurrentIndex(i);

	hb->setStretchFactor(m_pAgeCombo,1);


	hb = new KviTalHBox(gbox);
	hb->setSpacing(4);

	l = new QLabel(__tr2qs_ctx("Gender:","options"),hb);
	l->setMinimumWidth(120);

	m_pGenderCombo = new QComboBox(hb);
	QString szTip2 =  szCenterBegin + __tr2qs_ctx("Here you can specify your gender.","options") + szTrailing;
	KviTalToolTip::add(l,szTip2);
	KviTalToolTip::add(m_pGenderCombo,szTip2);
	m_pGenderCombo->addItem(__tr2qs_ctx("Unspecified","options"));
	m_pGenderCombo->addItem(__tr2qs_ctx("Female","options"));
	m_pGenderCombo->addItem(__tr2qs_ctx("Male","options"));

	if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender),"Male"))
		m_pGenderCombo->setCurrentIndex(2);
	else if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender),"Female"))
		m_pGenderCombo->setCurrentIndex(1);
	else
		m_pGenderCombo->setCurrentIndex(0);

	hb->setStretchFactor(m_pGenderCombo,1);

	sel = addStringSelector(gbox,__tr2qs_ctx("Location:","options"),KviOption_stringCtcpUserInfoLocation);
	sel->setMinimumLabelWidth(120);
	mergeTip(sel,szCenterBegin + __tr2qs_ctx("You can describe here your approximate physical location. " \
				"Something like \"Region, Country\" will be ok. Please note that this information will be viewable " \
				"by anyone so putting more data (like the exact address), generally, <b>is not a good idea</b>.","options") + szTrailing);

	sel = addStringSelector(gbox,__tr2qs_ctx("Languages:","options"),KviOption_stringCtcpUserInfoLanguages);
	sel->setMinimumLabelWidth(120);
	mergeTip(sel,szCenterBegin + __tr2qs_ctx("You can put here the short names of the languages you can speak. " \
				"An example might be \"EN,IT\" that would mean that you speak both Italian and English.","options") + szTrailing);

	sel = addStringSelector(gbox,__tr2qs_ctx("Other:","options"),KviOption_stringCtcpUserInfoOther);
	sel->setMinimumLabelWidth(120);
	mergeTip(sel,szCenterBegin + __tr2qs_ctx("You can put here some additional personal data. " \
				"It might be a funny quote or your homepage url... " \
				"Please note that this information will be viewable " \
				"by anyone so <b>don't put any sensible data</b> (passwords, telephone or credit card numbers).","options") + szTrailing);

	addRowSpacer(0,2,0,2);
}
Esempio n. 12
0
ThemeManagementDialog::ThemeManagementDialog(QWidget * parent)
: QWidget(parent)
{
	m_pItemDelegate = NULL;
#ifdef COMPILE_WEBKIT_SUPPORT
	m_pWebThemeInterfaceDialog = NULL;
#endif
	setObjectName("theme_options_widget");
	setWindowTitle(__tr2qs_ctx("Manage Themes - KVIrc","theme"));
	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Theme)));

	m_pInstance = this;

	//QGridLayout * g = new QGridLayout(this);
	QVBoxLayout * pVBox = new QVBoxLayout(this);
	KviTalHBox * pHBox = new KviTalHBox(this);
	pHBox->setMargin(1);
	pHBox->setSpacing(1);
	//g->addWidget(pHBox,0,0);
	pVBox->addWidget(pHBox);
	QToolButton * pTool;
	QFrame * pSep;

	pTool = new QToolButton(pHBox);
	pTool->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_SAVE)));
	pTool->setIconSize(QSize(32,32));
	pTool->setToolTip(__tr2qs_ctx("Save Current Theme...","theme"));
	connect(pTool,SIGNAL(clicked()),this,SLOT(saveCurrentTheme()));

	pSep = new QFrame(pHBox);
	pSep->setFrameStyle(QFrame::VLine | QFrame::Sunken);
	pSep->setMinimumWidth(12);

	m_pPackThemeButton = new QToolButton(pHBox);
	m_pPackThemeButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_PACK)));

	m_pPackThemeButton->setIconSize(QSize(32,32));
	m_pPackThemeButton->setToolTip(__tr2qs_ctx("Export Selected Themes to a Distributable Package","theme"));
	connect(m_pPackThemeButton,SIGNAL(clicked()),this,SLOT(packTheme()));

	m_pDeleteThemeButton = new QToolButton(pHBox);
	m_pDeleteThemeButton->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_REMOVE)));
	m_pDeleteThemeButton->setIconSize(QSize(32,32));
	m_pDeleteThemeButton->setToolTip(__tr2qs_ctx("Delete Selected Themes","theme"));
	connect(m_pDeleteThemeButton,SIGNAL(clicked()),this,SLOT(deleteTheme()));

	pSep = new QFrame(pHBox);
	pSep->setFrameStyle(QFrame::VLine | QFrame::Sunken);
	pSep->setMinimumWidth(12);

	pTool = new QToolButton(pHBox);
	pTool->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_OPEN)));
	pTool->setIconSize(QSize(32,32));
	pTool->setToolTip(__tr2qs_ctx("Install Theme Package From Disk","theme"));
	connect(pTool,SIGNAL(clicked()),this,SLOT(installFromFile()));

	pTool = new QToolButton(pHBox);
	pTool->setIcon(*(g_pIconManager->getBigIcon(KVI_BIGICON_WWW)));
	pTool->setIconSize(QSize(32,32));
	pTool->setToolTip(__tr2qs_ctx("Get More Themes...","theme"));
	connect(pTool,SIGNAL(clicked()),this,SLOT(getMoreThemes()));

	QWidget *w= new QWidget(pHBox);
	w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

	m_pListWidget = new KviTalListWidget(this);
	m_pListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
	m_pItemDelegate = new KviTalIconAndRichTextItemDelegate(m_pListWidget);
	m_pItemDelegate->setDefaultIcon(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME)));
	m_pListWidget->setItemDelegate(m_pItemDelegate);
	m_pListWidget->setMinimumHeight(400);
	m_pListWidget->setMinimumWidth(420);

	m_pListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
	m_pListWidget->setSortingEnabled(true);
	connect(m_pListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem *)),this,SLOT(applyTheme(QListWidgetItem *)));


	//FIXME tooltip
	//connect(m_pListWidget,SIGNAL(tipRequest(QListWidgetItem *,const QPoint &)),this,SLOT(tipRequest(QListWidgetItem *,const QPoint &)));
	connect(m_pListWidget,SIGNAL(customContextMenuRequested(const QPoint &)),
		this,SLOT(contextMenuRequested(const QPoint &)));
	connect(m_pListWidget,SIGNAL(itemSelectionChanged()),this,SLOT(enableDisableButtons()));

	pSep = new QFrame(this);
	pSep->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	pSep->setMinimumWidth(300);
	pSep->setMinimumHeight(8);
	pVBox->addWidget(pSep);

	//g->addWidget(pSep,2,0);

	m_pCurrentInstalledThemeLabel = new QLabel(this);
	m_pCurrentInstalledThemeLabel->setText(__tr2qs_ctx("<b><u>Current Installed Theme:</u> ","theme") + " " + KVI_OPTION_STRING(KviOption_stringIconThemeSubdir) + "</b>");
//	g->addWidget(pLabel,2,0);
	pVBox->addWidget(m_pCurrentInstalledThemeLabel);

	pSep = new QFrame(this);
	pSep->setFrameStyle(QFrame::HLine | QFrame::Sunken);
	pSep->setMinimumWidth(300);

//	g->addWidget(pSep,3,0);
	pVBox->addWidget(pSep);

//	g->addWidget(m_pListWidget,4,0);
	pVBox->addWidget(m_pListWidget);

//	KviDynamicToolTip * tip = new KviDynamicToolTip(m_pListWidget);
//	connect(tip,SIGNAL(tipRequest(KviDynamicToolTip *,const QPoint &)),this,SLOT(tipRequest(KviDynamicToolTip *,const QPoint &)));

	QPushButton * b = new QPushButton(__tr2qs("Close"),this);
	b->setMaximumSize(b->sizeHint().width(),b->sizeHint().height());
	connect(b,SIGNAL(clicked()),this,SLOT(closeClicked()));
//	g->addWidget(b,5,0);
	pVBox->addWidget(b);

//	g->setMargin(1);
//	g->setSpacing(1);
	pVBox->setAlignment(b,Qt::AlignRight);
	fillThemeBox();
	m_pContextPopup = new QMenu(this);

	if(g_rectManagementDialogGeometry.y() < 5)
	{
		g_rectManagementDialogGeometry.setY(5);
	}
	resize(g_rectManagementDialogGeometry.width(),
		g_rectManagementDialogGeometry.height());

	QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
	move(rect.x() + ((rect.width() - g_rectManagementDialogGeometry.width())/2),rect.y() + ((rect.height() - g_rectManagementDialogGeometry.height())/2));

	new QShortcut(Qt::Key_Escape, this, SLOT(closeClicked()));
}