Пример #1
0
MessageConfig::MessageConfig(QWidget *parent, void *_data)
        : MessageConfigBase(parent)
{
	m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

    CoreUserData *data = (CoreUserData*)_data;
    chkOnline->setChecked((data->OpenOnOnline) != 0);
    chkStatus->setChecked((data->LogStatus) != 0);
    switch (data->OpenNewMessage){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
Пример #2
0
WeatherCfg::WeatherCfg(QWidget *parent, WeatherPlugin *plugin)
        : WeatherCfgBase(parent)
{
    m_plugin = plugin;
    lblLnk->setUrl("http://www.weather.com/?prod=xoap&par=1004517364");
    lblLnk->setText(QString("Weather data provided by weather.com") + QChar((unsigned short)174));
    connect(btnSearch, SIGNAL(clicked()), this, SLOT(search()));
    connect(cmbLocation->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbLocation, SIGNAL(activated(int)), this, SLOT(activated(int)));
    textChanged("");
    fill();
    memset(&m_handler, 0, sizeof(m_handler));
    m_handler.startElement = p_element_start;
    m_handler.endElement   = p_element_end;
    m_handler.characters   = p_char_data;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_iface = new WIfaceCfg(tab, plugin);
        tab->addTab(m_iface, i18n("Interface"));
        tab->adjustSize();
        break;
    }
}
Пример #3
0
MessageConfig::MessageConfig(QWidget *parent, SIM::PropertyHubPtr _data)
  : QWidget(parent)
{
    setupUi(this);
    m_file = NULL;
    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if(!tab)
            continue;
        m_file = new FileConfig(tab, _data);
        tab->addTab(m_file, i18n("File"));
        tab->adjustSize();
        break;
    }

	SIM::PropertyHubPtr data = _data;
    chkOnline->setChecked(data->value("OpenOnOnline").toBool());
    chkStatus->setChecked(data->value("LogStatus").toBool());
    switch (data->value("OpenNewMessage").toUInt()){
    case NEW_MSG_NOOPEN:
        btnNoOpen->setChecked(true);
        break;
    case NEW_MSG_MINIMIZE:
        btnMinimize->setChecked(true);
        break;
    case NEW_MSG_RAISE:
        btnRaise->setChecked(true);
        break;
    }
}
Пример #4
0
ActionConfig::ActionConfig(QWidget *parent, SIM::PropertyHubPtr data, ActionPlugin *plugin)
  : QWidget(parent)
  , m_menu(NULL)
  , m_data(data)
  , m_plugin(plugin)
{
    setupUi(this);
    setButtonsPict(this);

    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));

    int row = 0;
    addRow(lstEvent, row, Icon("SIM"), i18n("Contact online"), CONTACT_ONLINE, data->value("OnLine").toString() );

    row++;
    addRow(lstEvent, row, Icon("SIM"), i18n("Status changed"), CONTACT_STATUS, data->value("Status").toString() );

    CommandDef *cmd;
    CorePlugin *core = GET_CorePlugin();
    CommandsMapIterator it(core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon.isEmpty()) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
            continue;
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
            continue;
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.indexOf("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).toUpper() + type.mid(1);

        row++;
        addRow(lstEvent, row, Icon(cmd->icon), type, cmd->id, data->stringMapValue("Message", cmd->id));
    }
    EventTmplHelpList e;
    e.process();
    LineEditDelegate *dg = new LineEditDelegate(1, lstEvent);
    dg->setHelpList(e.helpList());
    lstEvent->setItemDelegate(dg);
    lstEvent->resizeColumnToContents(0);
    lstEvent->sortByColumn(0, Qt::AscendingOrder);

    for (QObject *p = parent; p != NULL; p = p->parent()){
        QTabWidget *tab = qobject_cast<QTabWidget*>(p);
        if (!tab)
            continue;
        m_menu = new MenuConfig(tab, data);
        tab->addTab(m_menu, i18n("Menu"));
        tab->adjustSize();
        break;
    }
}
Пример #5
0
SoundConfig::SoundConfig(QWidget *parent, SoundPlugin *plugin)
        : SoundConfigBase(parent)
{
    m_plugin = plugin;
    user_cfg = NULL;
#ifdef USE_KDE
    bool bSound = false;
    connect(chkArts, SIGNAL(toggled(bool)), this, SLOT(artsToggled(bool)));
    chkArts->setChecked(plugin->getUseArts());
#else
    chkArts->hide();
#ifndef WIN32
    bool bSound = QSound::available();
#endif
#endif

#if defined( WIN32 ) || defined( __OS2__ )
    lblPlayer->hide();
    edtPlayer->hide();
#else
    if (bSound){
        lblPlayer->setText(i18n("Qt provides sound output so you just need to set a player if you don't like Qt's sound."));
    }
    edtPlayer->setText(QString::fromLocal8Bit(plugin->getPlayer()));
#endif
    string s;
    s = plugin->fullName(plugin->getStartUp());
    edtStartup->setText(QFile::decodeName(s.c_str()));
    s = plugin->fullName(plugin->getFileDone());
    edtFileDone->setText(QFile::decodeName(s.c_str()));
    s = plugin->fullName(plugin->getMessageSent());
    edtSent->setText(QFile::decodeName(s.c_str()));

    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        void *data = getContacts()->getUserData(plugin->user_data_id);
        user_cfg = new SoundUserConfig(tab, data, plugin);
        tab->addTab(user_cfg, i18n("Events"));
        tab->adjustSize();
        break;
    }
}
Пример #6
0
SoundConfig::SoundConfig(QWidget *parent, SoundPlugin *plugin)
        : SoundConfigBase(parent)
{
    m_plugin = plugin;
    user_cfg = NULL;
#ifdef WIN32
    chkArts->hide();
    lblPlayer->hide();
    edtPlayer->hide();
#else
#ifdef USE_KDE
    connect(chkArts, SIGNAL(toggled(bool)), this, SLOT(artsToggled(bool)));
    chkArts->setChecked(plugin->getUseArts());
#else
    chkArts->hide();
#endif
    edtPlayer->setText(QString::fromLocal8Bit(plugin->getPlayer()));
#endif
    chkAlert->setChecked(plugin->getDisableAlert());
    string s;
    s = plugin->fullName(plugin->getStartUp());
    edtStartup->setText(QString::fromLocal8Bit(s.c_str()));
    s = plugin->fullName(plugin->getFileDone());
    edtFileDone->setText(QString::fromLocal8Bit(s.c_str()));
    s = plugin->fullName(plugin->getMessageSent());
    edtSent->setText(QString::fromLocal8Bit(s.c_str()));

    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        void *data = getContacts()->getUserData(plugin->user_data_id);
        user_cfg = new SoundUserConfig(tab, data, plugin);
        tab->addTab(user_cfg, i18n("Events"));
        tab->adjustSize();
        break;
    }
}
Пример #7
0
GpgCfg::GpgCfg(QWidget *parent, GpgPlugin *plugin)
        : GpgCfgBase(parent)
{
    m_plugin = plugin;
    m_exec   = NULL;
    m_bNew   = false;
#ifdef WIN32
    edtGPG->setText(QFile::decodeName(m_plugin->getGPG()));
    edtGPG->setFilter(i18n("GPG(gpg.exe)"));
    m_find = NULL;
#else
    lblGPG->hide();
    edtGPG->hide();
#endif
    edtHome->setText(QFile::decodeName(user_file(m_plugin->getHome()).c_str()));
    edtHome->setDirMode(true);
    edtHome->setTitle(i18n("Select home directory"));
    lnkGPG->setUrl("http://www.gnupg.org/(en)/download/index.html");
    lnkGPG->setText(i18n("Download GPG"));
    connect(btnFind, SIGNAL(clicked()), this, SLOT(find()));
    connect(edtGPG, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    textChanged(edtGPG->text());
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_adv = new GpgAdvanced(tab, plugin);
        tab->addTab(m_adv, i18n("&Advanced"));
        tab->adjustSize();
        break;
    }
    connect(btnRefresh, SIGNAL(clicked()), this, SLOT(refresh()));
    connect(cmbKey, SIGNAL(activated(int)), this, SLOT(selectKey(int)));
    fillSecret(NULL);
    refresh();
}
Пример #8
0
IconCfg::IconCfg(QWidget *parent, IconsPlugin *plugin)
        : IconCfgBase(parent)
{
    m_plugin = plugin;
    unsigned i;
    for (i = 1; ; i++){
        const char *n = plugin->getIconDLLs(i);
        if ((n == NULL) || (*n == 0)) break;
        string v = n;
        IconsDef d;
        d.protocol = getToken(v, ',');
        d.icon = v;
        d.index = -1;
        defs.push_back(d);
    }

    list<string> icons;
    Event e(EventGetIcons, &icons);
    e.process();

    list<string> protocols;
    for (list<string>::iterator it = icons.begin(); it != icons.end(); ++it){
        string name = (*it);
        int n = name.find('_');
        char c = name[0];
        if ((c < 'A') || (c > 'Z'))
            continue;
        if (n <= 0)
            continue;
        name = name.substr(0, n);
        list<string>::iterator its;
        for (its = protocols.begin(); its != protocols.end(); ++its)
            if ((*its) == name)
                break;
        if (its != protocols.end())
            continue;
        protocols.push_back(name);
    }
    i = 0;
    for (list<string>::iterator its = protocols.begin(); its != protocols.end(); ++its, i++){
        cmbProtocol->insertItem(i18n((*its).c_str()));
        list<IconsDef>::iterator it;
        for (it = defs.begin(); it != defs.end(); ++it){
            if ((*it).protocol == (*its)){
                (*it).index = i;
                break;
            }
        }
        if (it == defs.end()){
            IconsDef d;
            d.protocol = (*its);
            d.index = i;
            defs.push_back(d);
        }
    }
    connect(cmbProtocol, SIGNAL(activated(int)), this, SLOT(protocolChanged(int)));
    cmbProtocol->setCurrentItem(0);
    protocolChanged(0);
    lblMore->setUrl("http://miranda-im.org/download/index.php?action=display&id=35");
#ifdef WIN32
    edtIcon->setStartDir(QFile::decodeName(app_file("icons/").c_str()));
#else
    edtIcon->setStartDir(QFile::decodeName(user_file("icons/").c_str()));
#endif
    edtIcon->setTitle(i18n("Select icons DLL"));
    edtIcon->setFilePreview(createPreview);
#ifdef USE_KDE
    edtIcon->setFilter(i18n("*.dll|Icons themes"));
#else
    edtIcon->setFilter(i18n("Icons themes (*.dll)"));
#endif
    lblMore->setText(i18n("Get more icons themes"));
    connect(edtIcon, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_smiles = new SmileCfg(tab, plugin);
        tab->addTab(m_smiles, i18n("Smiles"));
        tab->adjustSize();
        break;
    }
}
Пример #9
0
ActionConfig::ActionConfig(QWidget *parent, struct ActionUserData *data, ActionPlugin *plugin)
        : ActionConfigBase(parent)
{
    m_data   = data;
    m_plugin = plugin;
    m_menu   = NULL;
    setButtonsPict(this);

    lstEvent->addColumn(i18n("Event"));
    lstEvent->addColumn(i18n("Program"));
    lstEvent->setExpandingColumn(1);

    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));

    QListViewItem *item = new QListViewItem(lstEvent, i18n("Contact online"));
    item->setText(2, QString::number(CONTACT_ONLINE));
    item->setPixmap(0, makePixmap("ICQ"));
    if (data->OnLine.ptr)
        item->setText(1, QString::fromUtf8(data->OnLine.ptr));

    item = new QListViewItem(lstEvent, i18n("Status changed"));
    item->setText(2, QString::number(CONTACT_STATUS));
    item->setPixmap(0, makePixmap("ICQ"));
    if (data->Status.ptr)
        item->setText(1, QString::fromUtf8(data->Status.ptr));

    CommandDef *cmd;
    CommandsMapIterator it(m_plugin->core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon == NULL) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
            continue;
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
            continue;
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.find("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).upper() + type.mid(1);
        QListViewItem *item = new QListViewItem(lstEvent, type);
        item->setText(2, QString::number(cmd->id));
        item->setPixmap(0, makePixmap(cmd->icon));
        item->setText(1, QString::fromUtf8(get_str(data->Message, cmd->id)));
    }
    m_edit = NULL;
    m_editItem = NULL;
    connect(lstEvent, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)));

    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_menu = new MenuConfig(tab, data);
        tab->addTab(m_menu, i18n("Menu"));
        tab->adjustSize();
        break;
    }
    lstEvent->adjustColumn();
    setMinimumSize(sizeHint());
}