コード例 #1
0
ファイル: owner.cpp プロジェクト: j0wl/licq
QWidget* UserPages::Owner::createPageSettings(QWidget* parent)
{
  QGroupBox* accountBox = new QGroupBox(tr("Account"));
  QGridLayout* accountLayout = new QGridLayout(accountBox);

  QLabel* idLabel = new QLabel(tr("User ID:"));
  accountLayout->addWidget(idLabel, 0, 0);
  myAccountEdit = new QLineEdit();
  myAccountEdit->setEnabled(false);
  accountLayout->addWidget(myAccountEdit, 0, 1);
  SkinnableLabel* protocolLabel = new SkinnableLabel();
  accountLayout->addWidget(protocolLabel, 0, 2);

  QLabel* passwordLabel = new QLabel(tr("Password:"******"Save"));
  accountLayout->addWidget(mySavePwdCheck, 1, 2);

  QLabel* serverLabel = new QLabel(tr("Server:"));
  accountLayout->addWidget(serverLabel, 2, 0);
  myServerHostEdit = new QLineEdit();
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
  myServerHostEdit->setPlaceholderText(tr("Protocol default"));
#endif
  myServerHostEdit->setToolTip(tr("Host name or IP address of server to connect to. "
      "Leave blank to use protocol default."));
  accountLayout->addWidget(myServerHostEdit, 2, 1);
  myServerPortSpin = new SpecialSpinBox(0, 0xFFFF, tr("Auto"));
  myServerPortSpin->setToolTip(tr("Port number for server. \"Auto\" will use protocol default."));
  accountLayout->addWidget(myServerPortSpin, 2, 2);


  QLabel* statusLabel = new QLabel(tr("Startup status:"));
  accountLayout->addWidget(statusLabel, 3, 0);
  myAutoLogonCombo = new QComboBox();
  myAutoLogonCombo->setToolTip(tr("Automatically log on when first starting up."));
  accountLayout->addWidget(myAutoLogonCombo, 3, 1);

#define ADD_STATUS(status, cond) \
  if (cond) \
    myAutoLogonCombo->addItem(User::statusToString(status).c_str(), status);

  ADD_STATUS(User::OfflineStatus, true);
  ADD_STATUS(User::OnlineStatus, true);
  ADD_STATUS(User::OnlineStatus | User::AwayStatus, true);
  ADD_STATUS(User::OnlineStatus | User::NotAvailableStatus, myProtocolId != MSN_PPID);
  ADD_STATUS(User::OnlineStatus | User::OccupiedStatus, myProtocolId != JABBER_PPID);
  ADD_STATUS(User::OnlineStatus | User::DoNotDisturbStatus, myProtocolId != MSN_PPID);
  ADD_STATUS(User::OnlineStatus | User::FreeForChatStatus, myProtocolId != MSN_PPID);
#undef ADD_STATUS

  myAutoLogonInvisibleCheck = new QCheckBox(tr("Invisible"));
  if (myProtocolId == JABBER_PPID)
    myAutoLogonInvisibleCheck->setEnabled(false);
  accountLayout->addWidget(myAutoLogonInvisibleCheck, 3, 2);


  QGroupBox* icqBox = NULL;
  if (myProtocolId == ICQ_PPID)
  {
    icqBox = new QGroupBox(tr("ICQ"));
    QGridLayout* icqLayout = new QGridLayout(icqBox);

    mySSListCheck = new QCheckBox(tr("Use server side contact list"));
    mySSListCheck->setToolTip(tr("Store your contacts on the server so they are accessible from different locations and/or programs"));
    icqLayout->addWidget(mySSListCheck, 0, 0);

    myReconnectAfterUinClashCheck = new QCheckBox(tr("Reconnect after Uin clash"));
    myReconnectAfterUinClashCheck->setToolTip(tr("Licq can reconnect you when you got "
        "disconnected because your Uin was used "
        "from another location. Check this if you "
        "want Licq to reconnect automatically."));
    icqLayout->addWidget(myReconnectAfterUinClashCheck, 1, 0);

    myAutoUpdateInfoCheck = new QCheckBox(tr("Auto update contact information"));
    myAutoUpdateInfoCheck->setToolTip(tr("Automatically update users' server stored information."));
    icqLayout->addWidget(myAutoUpdateInfoCheck, 0, 1);

    myAutoUpdateInfoPluginsCheck = new QCheckBox(tr("Auto update info plugins"));
    myAutoUpdateInfoPluginsCheck->setToolTip(tr("Automatically update users' Phone Book and Picture."));
    icqLayout->addWidget(myAutoUpdateInfoPluginsCheck, 1, 1);

    myAutoUpdateStatusPluginsCheck = new QCheckBox(tr("Auto update status plugins"));
    myAutoUpdateStatusPluginsCheck->setToolTip(tr("Automatically update users' Phone \"Follow Me\", File Server and ICQphone status."));
    icqLayout->addWidget(myAutoUpdateStatusPluginsCheck, 2, 1);
  }


  Licq::ProtocolPlugin::Ptr protocol = Licq::gPluginManager.getProtocolPlugin(myProtocolId);
  if (protocol.get() != NULL)
  {
    protocolLabel->setText(QString::fromLocal8Bit(protocol->name().c_str()));
    protocolLabel->setPrependPixmap(IconManager::instance()->iconForProtocol(myProtocolId));
  }


  QWidget* w = new QWidget(parent);
  QVBoxLayout* mainLayout = new QVBoxLayout(w);
  mainLayout->setContentsMargins(0, 0, 0, 0);
  mainLayout->addWidget(accountBox);
  if (icqBox != NULL)
    mainLayout->addWidget(icqBox);
  mainLayout->addStretch(1);
  return w;
}
コード例 #2
0
ファイル: ownereditdlg.cpp プロジェクト: j0wl/licq
void OwnerEditDlg::init()
{
  Support::setWidgetProps(this, "OwnerEdit");
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(tr("Edit Account"));

  QGridLayout* lay = new QGridLayout(this);
  lay->setColumnStretch(2, 2);
  lay->setColumnMinimumWidth(1, 8);

  SkinnableLabel* protocolName = new SkinnableLabel();

  edtId = new QLineEdit();
  connect(edtId, SIGNAL(returnPressed()), SLOT(slot_ok()));

  edtPassword = new QLineEdit();
  edtPassword->setEchoMode(QLineEdit::Password);
  connect(edtPassword, SIGNAL(returnPressed()), SLOT(slot_ok()));

  myHostEdit = new QLineEdit();
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
  myHostEdit->setPlaceholderText(tr("Protocol default"));
#endif
  myPortSpin = new SpecialSpinBox(0, 0xffff, tr("Auto"));
  myPortSpin->setValue(0);

  int i = 0;
  QLabel* lbl;

#define ADDWIDGET(name, widget) \
  lbl = new QLabel(name); \
  lbl->setBuddy(widget); \
  lay->addWidget(lbl, i, 0); \
  lay->addWidget(widget, i++, 2)

  ADDWIDGET(tr("Protocol:"), protocolName);
  ADDWIDGET(tr("&User ID:"), edtId);
  ADDWIDGET(tr("&Password:"******"&Save Password"));
  lay->addWidget(chkSave, i++, 0, 1, 3);

  ADDWIDGET(tr("S&erver:"), myHostEdit);
  ADDWIDGET(tr("P&ort:"), myPortSpin);

#undef ADDWIDGET

  lay->setRowStretch(i++, 2);

  QDialogButtonBox* buttons = new QDialogButtonBox();
  buttons->addButton(QDialogButtonBox::Ok);
  buttons->addButton(QDialogButtonBox::Cancel);
  connect(buttons, SIGNAL(accepted()), SLOT(slot_ok()));
  connect(buttons, SIGNAL(rejected()), SLOT(close()));
  lay->addWidget(buttons, i++, 0, 1, 3);


  Licq::ProtocolPlugin::Ptr protocol = Licq::gPluginManager.getProtocolPlugin(myPpid);
  if (protocol.get() != NULL)
    protocolName->setText(protocol->name().c_str());
  protocolName->setPrependPixmap(IconManager::instance()->iconForProtocol(myPpid));
}