From 84d92c0d2a619816c042856226eaf56dd275183e Mon Sep 17 00:00:00 2001 From: Elvio Basello Date: Mon, 7 Apr 2008 20:38:35 +0000 Subject: initial port for reguser module git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1414 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/reguser/wizard.cpp | 219 ++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 111 deletions(-) (limited to 'src/modules/reguser/wizard.cpp') diff --git a/src/modules/reguser/wizard.cpp b/src/modules/reguser/wizard.cpp index a14ed1b2d..6dae150d5 100644 --- a/src/modules/reguser/wizard.cpp +++ b/src/modules/reguser/wizard.cpp @@ -31,18 +31,16 @@ #include "kvi_pixmap.h" #include "kvi_regusersdb.h" #include "kvi_iconmanager.h" -#ifdef COMPILE_USE_QT4 -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include extern KVIRC_API KviRegisteredUserDataBase * g_pRegisteredUserDataBase; @@ -61,40 +59,40 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere g_pRegistrationWizardList->append(this); - QGridLayout* m_pPage1Layout; - QGridLayout* m_pPage2Layout; - QGridLayout* m_pPage3Layout; - QGridLayout* m_pPage4Layout; - QGridLayout* m_pPage5Layout; + QGridLayout* m_pPage1Layout; + QGridLayout* m_pPage2Layout; + QGridLayout* m_pPage3Layout; + QGridLayout* m_pPage4Layout; + QGridLayout* m_pPage5Layout; - QLabel* TextLabel10_2; - QLabel* TextLabel10; - QLabel* TextLabel10_3; - QLabel* TextLabel10_3_2; + QLabel* TextLabel10_2; + QLabel* TextLabel10; + QLabel* TextLabel10_3; + QLabel* TextLabel10_3_2; QFrame * f; // resize( 490, 456 ); - setCaption(__tr2qs("User Registration Wizard - KVIrc")); + setCaption(__tr2qs("User Registration Wizard - KVIrc")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_LINUX))); - setSizeGripEnabled( TRUE ); + setSizeGripEnabled( TRUE ); - m_pPage1 = new QWidget(this); - m_pPage1Layout = new QGridLayout(m_pPage1); - m_pPage1Layout->setSpacing(4); - m_pPage1Layout->setMargin(8); + m_pPage1 = new QWidget(this); + m_pPage1Layout = new QGridLayout(m_pPage1); + m_pPage1Layout->setSpacing(4); + m_pPage1Layout->setMargin(8); - m_pLabel1 = new QLabel(m_pPage1); - m_pLabel1->setText(__tr2qs("

Welcome to the user registration wizard.
This process allows you to add an IRC user to the database and set properties for that user. KVIrc will be (hopefully) able to recognize the user, add him to the notify list, and display the associated avatar.

First of all, you must insert an entry name or real name for the user you're going to register. The name will be used to identify the database entry and has no specific requirements, it can be a given name, nickname, or just some text to remind you of the real person.
Examples: \"George W Bush\", \"Dubya\".\n

" )); + m_pLabel1 = new QLabel(m_pPage1); + m_pLabel1->setText(__tr2qs("

Welcome to the user registration wizard.
This process allows you to add an IRC user to the database and set properties for that user. KVIrc will be (hopefully) able to recognize the user, add him to the notify list, and display the associated avatar.

First of all, you must insert an entry name or real name for the user you're going to register. The name will be used to identify the database entry and has no specific requirements, it can be a given name, nickname, or just some text to remind you of the real person.
Examples: \"George W Bush\", \"Dubya\".\n

" )); - m_pPage1Layout->addWidget(m_pLabel1, 0, 0); + m_pPage1Layout->addWidget(m_pLabel1, 0, 0); - m_pEditRealName = new QLineEdit(m_pPage1); - //m_pEditRealName->setAlignment(int(QLineEdit::AlignHCenter)); + m_pEditRealName = new QLineEdit(m_pPage1); + //m_pEditRealName->setAlignment(int(QLineEdit::AlignHCenter)); - m_pPage1Layout->addWidget(m_pEditRealName,1,0); - addPage( m_pPage1,__tr2qs("Step 1: Entry Name")); + m_pPage1Layout->addWidget(m_pEditRealName,1,0); + addPage( m_pPage1,__tr2qs("Step 1: Entry Name")); if(mask.nick() != "*")m_pEditRealName->setText(mask.nick()); @@ -103,15 +101,15 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere // PAGE 2 - m_pPage2 = new QWidget(this); - m_pPage2Layout = new QGridLayout( m_pPage2 ); - m_pPage2Layout->setSpacing( 4 ); - m_pPage2Layout->setMargin( 8 ); + m_pPage2 = new QWidget(this); + m_pPage2Layout = new QGridLayout( m_pPage2 ); + m_pPage2Layout->setSpacing( 4 ); + m_pPage2Layout->setMargin( 8 ); - m_pLabel2 = new QLabel( m_pPage2); - m_pLabel2->setText(__tr2qs("

A registered user is identified by one or more IRC masks.
A mask must be in the following form:
nickname!username@hostname
and can contain wildcard characters '*' and '?'. Be careful in choosing the masks, as they are the only way to verify the identity of a registered user.

You can enter at most two masks here, if you wish to add more masks, use the \"Edit\" button in the Registered Users dialog. You must enter at least one mask.

")); + m_pLabel2 = new QLabel( m_pPage2); + m_pLabel2->setText(__tr2qs("

A registered user is identified by one or more IRC masks.
A mask must be in the following form:
nickname!username@hostname
and can contain wildcard characters '*' and '?'. Be careful in choosing the masks, as they are the only way to verify the identity of a registered user.

You can enter at most two masks here, if you wish to add more masks, use the \"Edit\" button in the Registered Users dialog. You must enter at least one mask.

")); - m_pPage2Layout->addMultiCellWidget(m_pLabel2,0,0,0,4); + m_pPage2Layout->addMultiCellWidget(m_pLabel2,0,0,0,4); //KviStr szMask; @@ -119,68 +117,68 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere //KviIrcMask masktempl(szMask.ptr()); - m_pNicknameEdit1 = new QLineEdit(m_pPage2); - m_pNicknameEdit1->setAlignment(Qt::AlignRight); + m_pNicknameEdit1 = new QLineEdit(m_pPage2); + m_pNicknameEdit1->setAlignment(Qt::AlignRight); if(mask.nick() != "*")m_pNicknameEdit1->setText(mask.nick()); connect(m_pNicknameEdit1,SIGNAL(textChanged(const QString &)),this,SLOT(maskChanged(const QString &))); - m_pPage2Layout->addWidget( m_pNicknameEdit1, 1, 0 ); + m_pPage2Layout->addWidget( m_pNicknameEdit1, 1, 0 ); - m_pUsernameEdit1 = new QLineEdit(m_pPage2); - m_pUsernameEdit1->setAlignment(Qt::AlignHCenter); + m_pUsernameEdit1 = new QLineEdit(m_pPage2); + m_pUsernameEdit1->setAlignment(Qt::AlignHCenter); if(mask.hasUser())m_pUsernameEdit1->setText(mask.user()); connect(m_pUsernameEdit1,SIGNAL(textChanged(const QString &)),this,SLOT(maskChanged(const QString &))); - m_pPage2Layout->addWidget(m_pUsernameEdit1,1,2); + m_pPage2Layout->addWidget(m_pUsernameEdit1,1,2); m_pHostEdit1 = new QLineEdit(m_pPage2); if(mask.hasHost())m_pHostEdit1->setText(mask.host()); connect(m_pHostEdit1,SIGNAL(textChanged(const QString &)),this,SLOT(maskChanged(const QString &))); m_pPage2Layout->addWidget(m_pHostEdit1,1,4); - m_pNicknameEdit2 = new QLineEdit(m_pPage2); - m_pNicknameEdit2->setAlignment(Qt::AlignRight); - m_pPage2Layout->addWidget(m_pNicknameEdit2,2,0); + m_pNicknameEdit2 = new QLineEdit(m_pPage2); + m_pNicknameEdit2->setAlignment(Qt::AlignRight); + m_pPage2Layout->addWidget(m_pNicknameEdit2,2,0); - m_pUsernameEdit2 = new QLineEdit(m_pPage2); - m_pUsernameEdit2->setAlignment(Qt::AlignHCenter); - m_pPage2Layout->addWidget(m_pUsernameEdit2,2,2); + m_pUsernameEdit2 = new QLineEdit(m_pPage2); + m_pUsernameEdit2->setAlignment(Qt::AlignHCenter); + m_pPage2Layout->addWidget(m_pUsernameEdit2,2,2); - m_pHostEdit2 = new QLineEdit(m_pPage2); - m_pPage2Layout->addWidget(m_pHostEdit2,2,4); + m_pHostEdit2 = new QLineEdit(m_pPage2); + m_pPage2Layout->addWidget(m_pHostEdit2,2,4); - TextLabel10_2 = new QLabel(m_pPage2); - TextLabel10_2->setText("
!
"); - TextLabel10_2->setAlignment(int(Qt::AlignCenter)); - m_pPage2Layout->addWidget(TextLabel10_2,2,1); + TextLabel10_2 = new QLabel(m_pPage2); + TextLabel10_2->setText("
!
"); + TextLabel10_2->setAlignment(int(Qt::AlignCenter)); + m_pPage2Layout->addWidget(TextLabel10_2,2,1); - TextLabel10 = new QLabel(m_pPage2); - TextLabel10->setText("
!
"); - TextLabel10->setAlignment(int(Qt::AlignCenter)); - m_pPage2Layout->addWidget(TextLabel10,1,1); + TextLabel10 = new QLabel(m_pPage2); + TextLabel10->setText("
!
"); + TextLabel10->setAlignment(int(Qt::AlignCenter)); + m_pPage2Layout->addWidget(TextLabel10,1,1); - TextLabel10_3 = new QLabel(m_pPage2); - TextLabel10_3->setText("
@
"); - TextLabel10_3->setAlignment(int(Qt::AlignCenter)); - m_pPage2Layout->addWidget(TextLabel10_3,1,3); + TextLabel10_3 = new QLabel(m_pPage2); + TextLabel10_3->setText("
@
"); + TextLabel10_3->setAlignment(int(Qt::AlignCenter)); + m_pPage2Layout->addWidget(TextLabel10_3,1,3); - TextLabel10_3_2 = new QLabel(m_pPage2); - TextLabel10_3_2->setText("
@
"); - TextLabel10_3_2->setAlignment(int(Qt::AlignCenter)); - m_pPage2Layout->addWidget(TextLabel10_3_2,2,3); + TextLabel10_3_2 = new QLabel(m_pPage2); + TextLabel10_3_2->setText("
@
"); + TextLabel10_3_2->setAlignment(int(Qt::AlignCenter)); + m_pPage2Layout->addWidget(TextLabel10_3_2,2,3); - addPage(m_pPage2,__tr2qs("Step 2: Mask Selection")); + addPage(m_pPage2,__tr2qs("Step 2: Mask Selection")); - m_pPage3 = new QWidget(this); - m_pPage3Layout = new QGridLayout(m_pPage3); - m_pPage3Layout->setSpacing(4); - m_pPage3Layout->setMargin(8); + m_pPage3 = new QWidget(this); + m_pPage3Layout = new QGridLayout(m_pPage3); + m_pPage3Layout->setSpacing(4); + m_pPage3Layout->setMargin(8); - m_pLabel3 = new QLabel(m_pPage3); - m_pLabel3->setText(__tr2qs("

If you want to store an avatar image for this user, you can set it here. KVIrc will show the avatar in the userlist next to the user's nickname.
An avatar can be in any supported image format (PNG is recommended). Keep in mind that KVIrc stores avatars in memory and has to resize them to fit in the userlist, thus it's better to use small, low-resolution images.

")); - m_pPage3Layout->addWidget(m_pLabel3,0,0); + m_pLabel3 = new QLabel(m_pPage3); + m_pLabel3->setText(__tr2qs("

If you want to store an avatar image for this user, you can set it here. KVIrc will show the avatar in the userlist next to the user's nickname.
An avatar can be in any supported image format (PNG is recommended). Keep in mind that KVIrc stores avatars in memory and has to resize them to fit in the userlist, thus it's better to use small, low-resolution images.

")); + m_pPage3Layout->addWidget(m_pLabel3,0,0); f = new QFrame(m_pPage3); f->setFrameStyle(QFrame::HLine | QFrame::Sunken); @@ -192,66 +190,66 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere m_pPage3Layout->setRowStretch(0,1); - addPage(m_pPage3,__tr2qs( "Step 3: Avatar Selection")); + addPage(m_pPage3,__tr2qs( "Step 3: Avatar Selection")); - m_pPage4 = new QWidget(this); - m_pPage4Layout = new QGridLayout(m_pPage4); - m_pPage4Layout->setSpacing(4); - m_pPage4Layout->setMargin(8); + m_pPage4 = new QWidget(this); + m_pPage4Layout = new QGridLayout(m_pPage4); + m_pPage4Layout->setSpacing(4); + m_pPage4Layout->setMargin(8); - m_pLabel4 = new QLabel(m_pPage4); - m_pLabel4->setText(__tr2qs("

If you want to be notified when this user is online or goes offline, you must specify the list of nicknames that KVIrc will look for.

You can enter at most two nicknames here, if you wish to add more nicknames, use the \"Edit\" button in the Registered Users dialog.

")); - m_pPage4Layout->addMultiCellWidget(m_pLabel4,0,0,0,1); + m_pLabel4 = new QLabel(m_pPage4); + m_pLabel4->setText(__tr2qs("

If you want to be notified when this user is online or goes offline, you must specify the list of nicknames that KVIrc will look for.

You can enter at most two nicknames here, if you wish to add more nicknames, use the \"Edit\" button in the Registered Users dialog.

")); + m_pPage4Layout->addMultiCellWidget(m_pLabel4,0,0,0,1); f = new QFrame(m_pPage4); f->setFrameStyle(QFrame::HLine | QFrame::Sunken); m_pPage4Layout->addMultiCellWidget(f,1,1,0,1); - m_pNotifyCheck = new QCheckBox(m_pPage4); - m_pNotifyCheck->setText(__tr2qs("Add this user to the notify list")); + m_pNotifyCheck = new QCheckBox(m_pPage4); + m_pNotifyCheck->setText(__tr2qs("Add this user to the notify list")); m_pNotifyCheck->setChecked(false); connect(m_pNotifyCheck,SIGNAL(toggled(bool)),this,SLOT(notifyCheckToggled(bool))); - m_pPage4Layout->addMultiCellWidget(m_pNotifyCheck,2,2,0,1); + m_pPage4Layout->addMultiCellWidget(m_pNotifyCheck,2,2,0,1); - m_pNotifyNickLabel1 = new QLabel(m_pPage4); - m_pNotifyNickLabel1->setText(__tr2qs("Nickname:")); - m_pPage4Layout->addWidget(m_pNotifyNickLabel1,3,0); + m_pNotifyNickLabel1 = new QLabel(m_pPage4); + m_pNotifyNickLabel1->setText(__tr2qs("Nickname:")); + m_pPage4Layout->addWidget(m_pNotifyNickLabel1,3,0); - m_pNotifyNickLabel2 = new QLabel(m_pPage4); - m_pNotifyNickLabel2->setText(__tr2qs("Nickname 2:")); - m_pPage4Layout->addWidget(m_pNotifyNickLabel2,4,0); + m_pNotifyNickLabel2 = new QLabel(m_pPage4); + m_pNotifyNickLabel2->setText(__tr2qs("Nickname 2:")); + m_pPage4Layout->addWidget(m_pNotifyNickLabel2,4,0); - m_pNotifyNickEdit1 = new QLineEdit(m_pPage4); + m_pNotifyNickEdit1 = new QLineEdit(m_pPage4); if(mask.nick() != "*")m_pNotifyNickEdit1->setText(mask.nick()); connect(m_pNotifyNickEdit1,SIGNAL(textChanged(const QString &)),this,SLOT(notifyNickChanged(const QString &))); - m_pPage4Layout->addWidget(m_pNotifyNickEdit1,3,1); + m_pPage4Layout->addWidget(m_pNotifyNickEdit1,3,1); - m_pNotifyNickEdit2 = new QLineEdit(m_pPage4); + m_pNotifyNickEdit2 = new QLineEdit(m_pPage4); connect(m_pNotifyNickEdit2,SIGNAL(textChanged(const QString &)),this,SLOT(notifyNickChanged(const QString &))); - m_pPage4Layout->addWidget(m_pNotifyNickEdit2,4,1); + m_pPage4Layout->addWidget(m_pNotifyNickEdit2,4,1); m_pPage4Layout->setRowStretch(0,1); - addPage(m_pPage4,__tr2qs("Step 4: Notify List")); + addPage(m_pPage4,__tr2qs("Step 4: Notify List")); - m_pPage5 = new QWidget(this); - m_pPage5Layout = new QGridLayout(m_pPage5); - m_pPage5Layout->setSpacing(4); - m_pPage5Layout->setMargin(8); + m_pPage5 = new QWidget(this); + m_pPage5Layout = new QGridLayout(m_pPage5); + m_pPage5Layout->setSpacing(4); + m_pPage5Layout->setMargin(8); - m_pTextLabel5 = new QLabel(m_pPage5); - m_pTextLabel5->setText(__tr2qs("

That's it. The user registration has been completed.

Click \"Finish\" to close this dialog.

")); - m_pPage5Layout->addWidget(m_pTextLabel5,0,0); + m_pTextLabel5 = new QLabel(m_pPage5); + m_pTextLabel5->setText(__tr2qs("

That's it. The user registration has been completed.

Click \"Finish\" to close this dialog.

")); + m_pPage5Layout->addWidget(m_pTextLabel5,0,0); - addPage(m_pPage5,__tr2qs("Registration Complete")); + addPage(m_pPage5,__tr2qs("Registration Complete")); setFinishEnabled(m_pPage5,true); QString dummy; @@ -261,7 +259,7 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere setMinimumSize(QSize(350,420)); - // signals and slots connections + // signals and slots connections } KviRegistrationWizard::~KviRegistrationWizard() @@ -321,7 +319,7 @@ void KviRegistrationWizard::accept() { // ops... no way // FIXME: spit an error message ? - debug("Ops.. something wrong with the regusers db"); + qDebug("Ops.. something wrong with the regusers db"); //delete this; return; } @@ -464,4 +462,3 @@ void KviRegistrationWizard::notifyCheckToggled(bool) #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "wizard.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - -- cgit v1.3.1-10-gc9f91