📄 edituserinfodlg.cpp
字号:
/*************************************************************************** * Copyright (C) 2007 by Anistratov Oleg * * ower@users.sourceforge.net * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 2 * * as published by the Free Software Foundation; * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * ***************************************************************************/#include "edituserinfodlg.h"#include "pixlabel.h"#include "userinfo.h"#include "qchaticon.h"#include "globals.h"#include "qchatsettings.h"EditUserInfoDlg::EditUserInfoDlg(QWidget *parent) : QDialog (parent), m_profileName (""), m_photoFilename (""), m_pictureFilename(""), m_edited (false), m_readOnly (false){ QHBoxLayout* hbox = new QHBoxLayout(0); m_applyLab = new QLabel(this); m_okLab = new QLabel(this); m_cancelLab = new QLabel(this); m_photoLab = new QLabel(this); m_pictureLab = new QLabel(this); m_nickLab = new QLabel(this); m_lastNameLab = new QLabel(this); m_firstNameLab = new QLabel(this); m_secondNameLab = new QLabel(this); m_bornLab = new QLabel(this); m_addressLab = new QLabel(this); m_homePhoneLab = new QLabel(this); m_workPhoneLab = new QLabel(this); m_mobilePhoneLab = new QLabel(this); m_emailLab = new QLabel(this); m_icqLab = new QLabel(this); m_homepageLab = new QLabel(this); m_aboutLab = new QLabel(this); m_genderLab = new QLabel(this); m_grid = new QGridLayout(this); m_lastNameEdit = new QLineEdit(this); m_firstNameEdit = new QLineEdit(this); m_secondNameEdit = new QLineEdit(this); m_nickNameEdit = new QLineEdit(this); m_homePhoneEdit = new QLineEdit(this); m_workPhoneEdit = new QLineEdit(this); m_mobilePhoneEdit = new QLineEdit(this); m_e_mailEdit = new QLineEdit(this); m_homepageEdit = new QLineEdit(this); m_icqEdit = new QLineEdit(this); m_dateOfBornEdit = new QDateEdit(this); m_addressEdit = new QLineEdit(this); m_aboutInfoEdit = new QTextEdit(this); m_applyBtn = new QPushButton(this); m_okBtn = new QPushButton(this); m_cancelBtn = new QPushButton(this); m_setPhoto = new PixLabel ("", this); m_setPic = new PixLabel ("", this); m_statusLab = new QLabel (this); mw_statusDescription = new QLineEdit (this); m_genderCmbx = new QComboBox (this); // col 0 1 m_grid->addWidget(m_genderLab , 0, 0); m_grid->addWidget(m_nickLab , 1, 0); m_grid->addWidget(m_lastNameLab , 2, 0); m_grid->addWidget(m_firstNameLab , 3, 0); m_grid->addWidget(m_secondNameLab, 4, 0); m_grid->addWidget(m_bornLab , 5, 0); m_grid->addWidget(m_addressLab , 6, 0); m_genderCmbx->setMinimumWidth(100); m_grid->addWidget(m_genderCmbx , 0, 1); m_nickNameEdit->setMinimumWidth(100); m_grid->addWidget(m_nickNameEdit , 1, 1); m_lastNameEdit->setMinimumWidth(100); m_grid->addWidget(m_lastNameEdit , 2, 1); m_firstNameEdit->setMinimumWidth(100); m_grid->addWidget(m_firstNameEdit , 3, 1); m_secondNameEdit->setMinimumWidth(100); m_grid->addWidget(m_secondNameEdit , 4, 1); m_dateOfBornEdit->setMinimumWidth(100); m_grid->addWidget(m_dateOfBornEdit , 5, 1); m_addressEdit->setMinimumWidth(100); m_grid->addWidget(m_addressEdit , 6, 1, 1, 3); // col 2 3 m_grid->addWidget(m_homePhoneLab , 0, 2); m_grid->addWidget(m_workPhoneLab , 1, 2); m_grid->addWidget(m_mobilePhoneLab, 2, 2); m_grid->addWidget(m_emailLab , 3, 2); m_grid->addWidget(m_icqLab , 4, 2); m_grid->addWidget(m_homepageLab , 5, 2); m_grid->addWidget(m_homePhoneEdit , 0, 3); m_homePhoneEdit ->setMinimumWidth(100); m_grid->addWidget(m_workPhoneEdit , 1, 3); m_workPhoneEdit ->setMinimumWidth(100); m_grid->addWidget(m_mobilePhoneEdit, 2, 3); m_mobilePhoneEdit->setMinimumWidth(100); m_grid->addWidget(m_e_mailEdit , 3, 3); m_e_mailEdit ->setMinimumWidth(100); m_grid->addWidget(m_icqEdit , 4, 3); m_icqEdit ->setMinimumWidth(100); m_grid->addWidget(m_homepageEdit , 5, 3); m_homepageEdit ->setMinimumWidth(100); m_grid->addWidget(m_photoLab , 7, 0, 1, 2); m_grid->addWidget(m_pictureLab, 7, 2, 1, 2); m_setPhoto ->setMinimumWidth (260); m_setPhoto ->setMinimumHeight(195); m_setPhoto ->setMaximumWidth (260); m_setPhoto ->setMaximumHeight(195); m_setPic ->setMinimumWidth (260); m_setPic ->setMinimumHeight(195); m_setPic ->setMaximumWidth (260); m_setPic ->setMaximumHeight(195); m_grid->addWidget(m_setPhoto , 8, 0, 1, 2); m_grid->addWidget(m_setPic , 8, 2, 1, 2); m_grid->addWidget(m_aboutLab, 9, 0, 1, 2); m_grid->addWidget(m_aboutInfoEdit, 10, 0, 1, 4); m_aboutInfoEdit->setMinimumHeight(150); m_aboutInfoEdit->setMaximumHeight(1500); m_aboutInfoEdit->setMaximumWidth (1500); hbox->addWidget(m_statusLab ); hbox->addWidget(mw_statusDescription); m_grid->addLayout(hbox, 11, 0, 1, 4); mw_statusDescription->setReadOnly(true); m_grid->addWidget(m_okBtn , 0, 4); m_grid->addWidget(m_applyBtn , 1, 4); m_grid->addWidget(m_cancelBtn, 2, 4); m_grid->setColumnStretch(0, 1); m_grid->setColumnStretch(1, 2); m_grid->setColumnStretch(2, 1); m_grid->setColumnStretch(3, 2); m_grid->setRowStretch(8, 1); m_grid->setRowStretch(10, 2); m_aboutInfoEdit->setMaximumWidth(1000); m_aboutInfoEdit->setMaximumHeight(1000); m_aboutInfoEdit->resize(300, 200); setTabOrder(m_nickNameEdit , m_lastNameEdit); setTabOrder(m_lastNameEdit , m_firstNameEdit); setTabOrder(m_firstNameEdit , m_secondNameEdit); setTabOrder(m_dateOfBornEdit , m_addressEdit); setTabOrder(m_addressEdit , m_homePhoneEdit); setTabOrder(m_homePhoneEdit , m_workPhoneEdit); setTabOrder(m_workPhoneEdit , m_mobilePhoneEdit); setTabOrder(m_mobilePhoneEdit, m_e_mailEdit); setTabOrder(m_e_mailEdit , m_icqEdit); setTabOrder(m_icqEdit , m_homepageEdit); setTabOrder(m_homepageEdit , m_aboutInfoEdit); setTabOrder(m_aboutInfoEdit , m_okBtn); setTabOrder(m_okBtn , m_applyBtn); setTabOrder(m_applyBtn , m_cancelBtn); m_applyBtn ->setEnabled(false); m_okBtn ->setDefault(false); m_applyBtn ->setDefault(true); m_cancelBtn->setDefault(false); m_dateOfBornEdit->setDisplayFormat("dd / MMM / yyyy"); connect(m_okBtn , SIGNAL(clicked()) , this, SLOT (slot_sendInfo())); connect(m_okBtn , SIGNAL(clicked()) , this, SLOT (slot_accept ())); connect(m_okBtn , SIGNAL(clicked()) , this, SIGNAL(infoChanged ())); connect(m_applyBtn , SIGNAL(clicked()) , this, SLOT (slot_sendInfo())); connect(m_applyBtn , SIGNAL(clicked()) , this, SIGNAL(infoChanged ())); connect(m_cancelBtn , SIGNAL(clicked()) , this, SLOT (slot_cancel ())); connect(m_nickNameEdit , SIGNAL(textEdited(const QString )), this, SLOT (slot_edited())); connect(m_lastNameEdit , SIGNAL(textEdited(const QString )), this, SLOT (slot_edited())); connect(m_firstNameEdit , SIGNAL(textEdited(const QString )), this, SLOT (slot_edited()));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -