MainConfigurationWindow::MainConfigurationWindow() :
    ConfigurationWindow("MainConfiguration", tr("Kadu configuration"), "General", instanceDataManager()), lookChatAdvanced(0)
{
    setWindowRole("kadu-configuration");

    widget()->appendUiFile(dataPath("kadu/configuration/dialog.ui"));

#ifndef DEBUG_ENABLED
    ((QWidget *)(widget()->widgetById("debug")->parent()))->hide();
#endif

#ifndef Q_OS_WIN
    ((QWidget *)(widget()->widgetById("startup")))->hide();
#endif

#ifndef Q_WS_X11
    ((QWidget *)(widget()->widgetById("windowActivationMethodGroup")))->hide();
    ((QWidget *)(widget()->widgetById("notify/fullscreenSilentMode")))->hide();
#endif

    onStartupSetLastDescription = static_cast<QCheckBox *>(widget()->widgetById("onStartupSetLastDescription"));
    QLineEdit *disconnectDescription = static_cast<QLineEdit *>(widget()->widgetById("disconnectDescription"));
    QLineEdit *onStartupSetDescription = static_cast<QLineEdit *>(widget()->widgetById("onStartupSetDescription"));

    Account account = AccountManager::instance()->defaultAccount();
    if (!account.isNull() && account.protocolHandler())
    {
        disconnectDescription->setMaxLength(account.data()->maxDescriptionLength());
        onStartupSetDescription->setMaxLength(account.data()->maxDescriptionLength());
    }
//	connect(widget()->widgetById("advancedMode"), SIGNAL(toggled(bool)), widget()->widgetById("contactsWithIcons"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("showAvatars"), SIGNAL(toggled(bool)), widget()->widgetById("avatarBorder"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("showAvatars"), SIGNAL(toggled(bool)), widget()->widgetById("avatarGreyOut"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("disconnectWithCurrentDescription"), SIGNAL(toggled(bool)), disconnectDescription, SLOT(setDisabled(bool)));
    connect(onStartupSetLastDescription, SIGNAL(toggled(bool)), onStartupSetDescription, SLOT(setDisabled(bool)));
    connect(widget()->widgetById("foldLink"), SIGNAL(toggled(bool)), widget()->widgetById("linkFoldTreshold"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("chatPrune"), SIGNAL(toggled(bool)), widget()->widgetById("chatPruneLen"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("chatCloseTimer"), SIGNAL(toggled(bool)), widget()->widgetById("chatCloseTimerPeriod"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("startupStatus"), SIGNAL(activated(int)), this, SLOT(onChangeStartupStatus(int)));
    connect(widget()->widgetById("infoPanelBgFilled"), SIGNAL(toggled(bool)), widget()->widgetById("infoPanelBgColor"), SLOT(setEnabled(bool)));
    connect(widget()->widgetById("showDescription"), SIGNAL(toggled(bool)), widget()->widgetById("multilineDescription"), SLOT(setEnabled(bool)));
//	connect(widget()->widgetById("useDefaultServers"), SIGNAL(toggled(bool)), widget()->widgetById("serverList"), SLOT(setDisabled(bool)));
    connect(widget()->widgetById("openChatOnMessage"), SIGNAL(toggled(bool)), widget()->widgetById("openChatOnMessageWhenOnline"), SLOT(setEnabled(bool)));

    connect(widget()->widgetById("displayGroupTabs"), SIGNAL(toggled(bool)), widget()->widgetById("showGroupAll"), SLOT(setEnabled(bool)));

    emoticonsStyleComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsStyle"));
    emoticonsThemeComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsTheme"));
    emoticonsScalingComboBox = static_cast<ConfigComboBox *>(widget()->widgetById("emoticonsScaling"));
    connect(emoticonsThemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onChangeEmoticonsTheme(int)));
    connect(widget()->widgetById("emoticonsPaths"), SIGNAL(changed()), this, SLOT(setEmoticonThemes()));

    QWidget *showInformationPanel = widget()->widgetById("showInformationPanel");
    connect(showInformationPanel, SIGNAL(toggled(bool)), widget()->widgetById("showVerticalScrollbar"), SLOT(setEnabled(bool)));
    connect(showInformationPanel, SIGNAL(toggled(bool)), widget()->widgetById("showEmoticonsInPanel"), SLOT(setEnabled(bool)));

    ConfigCheckBox *useDefaultBrowserCheckbox = static_cast<ConfigCheckBox *>(widget()->widgetById("useDefaultBrowser"));
    ConfigLineEdit *browserCommandLineEdit = static_cast<ConfigLineEdit *>(widget()->widgetById("browserPath"));
    connect(useDefaultBrowserCheckbox, SIGNAL(toggled(bool)), browserCommandLineEdit, SLOT(setDisabled(bool)));

    ConfigCheckBox *useDefaultEMailCheckbox = static_cast<ConfigCheckBox *>(widget()->widgetById("useDefaultEMail"));
    ConfigLineEdit *mailCommandLineEdit = static_cast<ConfigLineEdit *>(widget()->widgetById("mailPath"));
    connect(useDefaultEMailCheckbox, SIGNAL(toggled(bool)), mailCommandLineEdit, SLOT(setDisabled(bool)));

    connect(widget()->widgetById("lookChatAdvanced"), SIGNAL(clicked()), this, SLOT(showLookChatAdvanced()));

    Preview *infoPanelSyntaxPreview = static_cast<Preview *>(widget()->widgetById("infoPanelSyntaxPreview"));
    infoPanelSyntaxPreview->setResetBackgroundColor(config_file.readEntry("Look", "InfoPanelBgColor"));
    connect(infoPanelSyntaxPreview, SIGNAL(needFixup(QString &)), Core::instance()->kaduWindow()->infoPanel(), SLOT(styleFixup(QString &)));
    connect(widget()->widgetById("infoPanelSyntax"), SIGNAL(syntaxChanged(const QString &)), infoPanelSyntaxPreview, SLOT(syntaxChanged(const QString &)));
    connect(widget()->widgetById("infoPanelSyntax"), SIGNAL(onSyntaxEditorWindowCreated(SyntaxEditorWindow *)),
            this, SLOT(onInfoPanelSyntaxEditorWindowCreated(SyntaxEditorWindow *)));

    connect(widget()->widgetById("iconPaths"), SIGNAL(changed()), this, SLOT(setIconThemes()));

    connect(widget()->widgetById("ignoreMessagesFromAnonymous"), SIGNAL(toggled(bool)), widget()->widgetById("ignoreMessagesFromAnonymousInConferences"), SLOT(setEnabled(bool)));

    QWidget *useUserboxBackground = widget()->widgetById("useUserboxBackground");
    connect(useUserboxBackground, SIGNAL(toggled(bool)), widget()->widgetById("userboxBackground"), SLOT(setEnabled(bool)));
    connect(useUserboxBackground, SIGNAL(toggled(bool)), widget()->widgetById("userboxBackgroundDisplayStyle"), SLOT(setEnabled(bool)));

    widget()->widgetById("parseStatus")->setToolTip(qApp->translate("@default", SyntaxText));
    (static_cast<ConfigSyntaxEditor *>(widget()->widgetById("infoPanelSyntax")))->setSyntaxHint(qApp->translate("@default", SyntaxText));

    userboxTransparency = static_cast<QCheckBox *>(widget()->widgetById("userboxTransparency"));
    userboxAlpha = static_cast<QSlider *>(widget()->widgetById("userboxAlpha"));
    connect(userboxTransparency, SIGNAL(toggled(bool)), widget()->widgetById("userboxAlpha"), SLOT(setEnabled(bool)));

    buddyColors = new BuddyListBackgroundColorsWidget(this);

    triggerCompositingStateChanged();
}
Esempio n. 2
0
void MainConfigurationWindow::init()
{
    setWindowRole("kadu-configuration");

    widget()->appendUiFile(m_pathsProvider->dataPath() + QStringLiteral("configuration/dialog.ui"));

#ifndef Q_OS_WIN
    widget()->widgetById("startup")->hide();
    widget()->widgetById("hideMainWindowFromTaskbar")->hide();
#endif

#if !defined(Q_OS_UNIX)
    widget()->widgetById("windowActivationMethod")->hide();
#endif

#if defined(Q_OS_UNIX) && !defined(Q_OS_WIN)
    widget()->widgetById("notify/fullscreenSilentMode")->hide();
#endif

#if !defined(Q_OS_UNIX)
    widget()->widgetById("useTransparency")->hide();
    widget()->widgetById("userboxTransparency")->hide();
    widget()->widgetById("userboxAlpha")->hide();
    widget()->widgetById("userboxBlur")->hide();
#endif

    onStartupSetLastDescription = static_cast<QCheckBox *>(widget()->widgetById("onStartupSetLastDescription"));
    disconnectDescription = static_cast<QLineEdit *>(widget()->widgetById("disconnectDescription"));
    onStartupSetDescription = static_cast<QLineEdit *>(widget()->widgetById("onStartupSetDescription"));

    Account account = m_accountManager->defaultAccount();
    if (!account.isNull() && account.protocolHandler())
    {
        disconnectDescription->setMaxLength(account.statusContainer()->maxDescriptionLength());
        onStartupSetDescription->setMaxLength(account.statusContainer()->maxDescriptionLength());
    }

    connect(
        widget()->widgetById("disconnectWithCurrentDescription"), SIGNAL(activated(int)), this,
        SLOT(onChangeShutdownStatus(int)));
    connect(onStartupSetLastDescription, SIGNAL(activated(int)), this, SLOT(onChangeStartupDescription(int)));

    connect(widget()->widgetById("startupStatus"), SIGNAL(activated(int)), this, SLOT(onChangeStartupStatus(int)));
    connect(widget()->widgetById("lookChatAdvanced"), SIGNAL(clicked()), this, SLOT(showLookChatAdvanced()));
    connect(widget()->widgetById("installIconTheme"), SIGNAL(clicked()), this, SLOT(installIconTheme()));

    Preview *infoPanelSyntaxPreview = static_cast<Preview *>(widget()->widgetById("infoPanelSyntaxPreview"));
    connect(
        infoPanelSyntaxPreview, SIGNAL(needFixup(QString &)), m_kaduWindowService->kaduWindow()->infoPanel(),
        SLOT(styleFixup(QString &)));
    connect(
        widget()->widgetById("infoPanelSyntax"), SIGNAL(syntaxChanged(const QString &)), infoPanelSyntaxPreview,
        SLOT(syntaxChanged(const QString &)));

    widget()->widgetById("parseStatus")->setToolTip(QCoreApplication::translate("@default", SyntaxText));
    (static_cast<ConfigSyntaxEditor *>(widget()->widgetById("infoPanelSyntax")))
        ->setSyntaxHint(QCoreApplication::translate("@default", SyntaxText));

    userboxTransparency = static_cast<QCheckBox *>(widget()->widgetById("userboxTransparency"));
    userboxAlpha = static_cast<QSlider *>(widget()->widgetById("userboxAlpha"));
    userboxBlur = static_cast<QCheckBox *>(widget()->widgetById("userboxBlur"));

    buddyColors = new BuddyListBackgroundColorsWidget(this);

    PluginList = injectedFactory()->makeInjected<PluginListWidget>(this);
    PluginList->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);

    connect(this, SIGNAL(configurationWindowApplied()), this, SLOT(applied()));
    connect(
        m_configurationUiHandlerRepository, SIGNAL(configurationUiHandlerAdded(ConfigurationUiHandler *)), this,
        SLOT(configurationUiHandlerAdded(ConfigurationUiHandler *)));
    connect(
        m_configurationUiHandlerRepository, SIGNAL(configurationUiHandlerRemoved(ConfigurationUiHandler *)), this,
        SLOT(configurationUiHandlerRemoved(ConfigurationUiHandler *)));

    triggerCompositingStateChanged();
}