Exemplo n.º 1
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
#if QT_VERSION >= 0x040500
    , m_cacheEnabled(false)
#endif
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));

#if QT_VERSION < 0x040500
    oneCloseButton->setVisible(false); // no other mode than one close button with qt <4.5
    networkCache->setVisible(false);
#else
    // As network cache has too many bugs in 4.5.1, do not allow to enable it.
    if (QLatin1String(qVersion()) == QLatin1String("4.5.1"))
        networkCache->setVisible(false);
#endif
    loadDefaults();
    loadFromSettings();
}
Exemplo n.º 2
0
void VisibleOptioinFont::chooseFontEvent()
{
	if (chooseFont(m_currentFont))
	{
		m_editor->setText(toString(m_currentFont));
		m_editor->setFont(m_currentFont);
	}
}
Exemplo n.º 3
0
PreferenceDialog::PreferenceDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PreferenceDialog)
{
    ui->setupUi(this);
    connect(ui->chooseFontBtn, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(ui->displayIpBox, SIGNAL(toggled(bool)), ui->displayPortBox, SLOT(setEnabled(bool)));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
Exemplo n.º 4
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));

    loadDefaults();
    loadFromSettings();
}
Exemplo n.º 5
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(restoreToDefaultButton, SIGNAL(clicked()), this, SLOT(restoreHomeToDefault()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
	connect(comboBoxStyle, SIGNAL(currentIndexChanged(int)), this,   SLOT(setAppStyle(int)));
    connect(showPasswordsButton, SIGNAL(clicked()), this, SLOT(showPasswords()));
    connect(chkUserAgent, SIGNAL(stateChanged ( int ) ), this, SLOT(useUserAgent(int)));
    connect(buttonSearchProviders, SIGNAL(clicked() ), this, SLOT( showSearchProviders() ) );
    connect(buttonEditShortcuts, SIGNAL(clicked() ), this, SLOT( editShortcuts() ) );
    connect(btnExtView, SIGNAL(clicked() ), this, SLOT( chooseExtViewer() ) );
    connect(btnStylePath, SIGNAL(clicked() ), this, SLOT( chooseStylePath() ) );

    connect(proxyAuto, SIGNAL(stateChanged ( int ) ), this, SLOT(setAutoProxy(int)));
    connect(proxySupport, SIGNAL(toggled( bool ) ), this, SLOT(setProxyEnabled(bool)));

	connect(btnAddAd, SIGNAL(clicked() ), this, SLOT( addBlockAd() ) );
	connect(btnEditAd, SIGNAL(clicked() ), this, SLOT( editBlockAd() ) );
	connect(btnDelAd, SIGNAL(clicked() ), this, SLOT( removeBlockAd() ) );
	connect(btnDelAds, SIGNAL(clicked() ), this, SLOT( removeBlockAds() ) );

	connect(btnBlockMostAds, SIGNAL(clicked() ), this, SLOT( blockMostAds() ) );
	connect(btnBlockMostCnts, SIGNAL(clicked() ), this, SLOT( blockMostCnts() ) );

	connect(btnAddAdEx, SIGNAL(clicked() ), this, SLOT( addBlockAdEx() ) );
	connect(btnEditAdEx, SIGNAL(clicked() ), this, SLOT( editBlockAdEx() ) );
	connect(btnDelAdEx, SIGNAL(clicked() ), this, SLOT( removeBlockAdEx() ) );

    loadDefaults();
    loadFromSettings();
	
	fontChanged = false;
	connect(tbGoBack, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbGoForward, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbAddBook, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbHome, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbRefresh, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbAppStyle, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbPrivMode, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbPrefs, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbImages, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbProxy, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbCompatibility, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbReset, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbInspect, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbBookmarks, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbTextSize, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
	connect(tbVirtKeyb, SIGNAL(clicked()), this, SLOT( checkAddressBarButtons() ));
}
Exemplo n.º 6
0
FontEdit::FontEdit(QWidget *parent, const char *name) : QFrame(parent, name)
{
    QHBoxLayout *lay = new QHBoxLayout(this);
    lblFont = new QLabel("...", this);
    lblFont->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    lay->addWidget(lblFont);
    lay->addSpacing(2);
    QPushButton *btnFont = new QPushButton(this);
    btnFont->setPixmap(Pict("text"));
    lay->addWidget(btnFont);
    lblFont->setFrameShape(QFrame::Box);
    lblFont->setLineWidth(1);
    lblFont->setMargin(3);
    connect(btnFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
}
Exemplo n.º 7
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));

#if QT_VERSION < 0x040500
    oneCloseButton->setVisible(false); // no other mode than one close button with qt <4.5
#endif
    loadDefaults();
    loadFromSettings();
}
Exemplo n.º 8
0
SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
    , m_cacheEnabled(false)
{
    setupUi(this);
    connect(exceptionsButton, SIGNAL(clicked()), this, SLOT(showExceptions()));
    connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
    connect(cookiesButton, SIGNAL(clicked()), this, SLOT(showCookies()));
    connect(standardFontButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(fixedFontButton, SIGNAL(clicked()), this, SLOT(chooseFixedFont()));
    connect(languageButton, SIGNAL(clicked()), this, SLOT(chooseAcceptLanguage()));
    connect(downloadDirectoryButton, SIGNAL(clicked()), this, SLOT(chooseDownloadDirectory()));

    // As network cache has too many bugs in 4.5.1, do not allow to enable it.
    if (QLatin1String(qVersion()) == QLatin1String("4.5.1"))
        networkCache->setVisible(false);

    loadDefaults();
    loadFromSettings();
}
Exemplo n.º 9
0
PreferenceDialog::PreferenceDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PreferenceDialog),
    m_model(),
    m_colorMap()
{
    m_model.setColorMap(&m_colorMap);

    ui->setupUi(this);
    ui->tabWidget->setCurrentIndex(0);
    // アドレスボックスの外観サンプル
    ui->sampleEdit->setText(QDir::homePath());
    // ファイルビューの外観サンプル
    ui->sampleTable->setModel(&m_model);

    QHeaderView *header;
    header = ui->sampleTable->horizontalHeader();
    header->setSectionResizeMode(0, QHeaderView::Stretch);
    header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
    header->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    header = ui->sampleTable->verticalHeader();
    header->setDefaultSectionSize(header->defaultSectionSize() * 0.75);

    // シグナル&スロット
    connect(ui->bootSize, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->sizeAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->sizeRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->bootPos, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->posAbsolute, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->posRelative, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));

    connect(ui->boxClrBg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
    connect(ui->boxClrFg, SIGNAL(clicked()), this, SLOT(selectBoxColor()));
    connect(ui->chooseBoxFont, SIGNAL(clicked()), this, SLOT(chooseFont()));

    connect(ui->clrBgMark, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrBgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrFgHidden, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrFgMark, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrFgNormal, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrFgReadonly, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->clrFgSystem, SIGNAL(clicked()), this, SLOT(selectViewColor()));
    connect(ui->chooseViewFont, SIGNAL(clicked()), this, SLOT(chooseFont()));

    connect(ui->importAppearance, SIGNAL(clicked()), this, SLOT(importAppearance()));
    connect(ui->exportAppearance, SIGNAL(clicked()), this, SLOT(exportAppearance()));

    connect(ui->browseArchiver, SIGNAL(clicked()), this, SLOT(browseApp()));
    connect(ui->browseEditor, SIGNAL(clicked()), this, SLOT(browseApp()));
    connect(ui->browseTerminal, SIGNAL(clicked()), this, SLOT(browseApp()));

    connect(ui->chooseViewerFont, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(ui->viewerClrBg, SIGNAL(clicked()), this, SLOT(selectViewerColor()));
    connect(ui->viewerClrFg, SIGNAL(clicked()), this, SLOT(selectViewerColor()));
    connect(ui->viewerInherit, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->enableViewerIgnoreExt, SIGNAL(toggled(bool)), this, SLOT(setControlsEnabled(bool)));
    connect(ui->defaultIgnoreExt, SIGNAL(clicked()), this, SLOT(setIgnoreExtDefault()));

    // 現在の設定で各コントロールを初期化する
    QSettings settings;
    QString strValue;
    QSize size;
    QPoint point;
    QRadioButton *radioBtn;

    //>>>>> 起動と終了
    // 起動時のサイズ
    ui->bootSize->setChecked(true);
    strValue = settings.value(IniKey_BootSizeSpec).toString();
    radioBtn = findChild<QRadioButton*>(strValue);
    if (radioBtn == NULL) {
        radioBtn = ui->sizeRelative;
    }
    radioBtn->setChecked(true);
    if (strValue.isEmpty()) {
        ui->bootSize->setChecked(false);
    }
    size = settings.value(IniKey_BootSizeAbs).toSize();
    ui->absoluteWidth->setValue(size.width());
    ui->absoluteHeight->setValue(size.height());
    size = settings.value(IniKey_BootSizeRel).toSize();
    ui->relativeWidth->setValue(size.width());
    ui->relativeHeight->setValue(size.height());
    // 起動時の位置
    ui->bootPos->setChecked(true);
    strValue = settings.value(IniKey_BootPosSpec).toString();
    radioBtn = findChild<QRadioButton*>(strValue);
    if (radioBtn == NULL) {
        radioBtn = ui->posCenter;
    }
    radioBtn->setChecked(true);
    if (strValue.isEmpty()) {
        ui->bootPos->setChecked(false);
    }
    point = settings.value(IniKey_BootPosAbs).toPoint();
    ui->absoluteLeft->setValue(point.x());
    ui->absoluteTop->setValue(point.y());
    point = settings.value(IniKey_BootPosRel).toPoint();
    ui->relativeLeft->setValue(point.x());
    ui->relativeTop->setValue(point.y());
    // 起動時の設定削除
    ui->resetOnBoot->setChecked(settings.value(IniKey_ResetOnBoot).toBool());
    // アップデートの確認
    ui->checkUpdates->setChecked(settings.value(IniKey_CheckUpdates).toBool());
    // 終了時の確認ダイアログ
    ui->confirmExit->setChecked(settings.value(IniKey_ConfirmExit).toBool());

    //>>>>> 色とフォント、テキストビューア
    loadAppearance(settings, false);
    ui->dark->setValue(settings.value(IniKey_Darkness).toInt());

    //>>>>> ファイル操作
    // 確認ダイアログの表示
    ui->confirmCopy->setChecked(settings.value(IniKey_ConfirmCopy).toBool());
    ui->confirmDelete->setChecked(settings.value(IniKey_ConfirmDelete).toBool());
    ui->confirmMove->setChecked(settings.value(IniKey_ConfirmMove).toBool());
    ui->confirmRename->setChecked(settings.value(IniKey_ConfirmRename).toBool());
    // 完了ダイアログの自動クローズ
    ui->autoCloseCopy->setChecked(settings.value(IniKey_AutoCloseCopy).toBool());
    ui->autoCloseDelete->setChecked(settings.value(IniKey_AutoCloseDelete).toBool());
    ui->autoCloseMove->setChecked(settings.value(IniKey_AutoCloseMove).toBool());
    ui->autoCloseRename->setChecked(settings.value(IniKey_AutoCloseRename).toBool());
    // 上書き時の既定動作
    strValue = settings.value(IniKey_DefaultOnCopy).toString();
    if (strValue.isEmpty()) {
        strValue = "owDefIfNew";
    }
    radioBtn = findChild<QRadioButton*>(strValue);
    if (radioBtn == NULL) {
        radioBtn = ui->rbOverWriteIfNew;
    }
    radioBtn->setChecked(true);
    ui->moveAfterCreate->setChecked(settings.value(IniKey_MoveAfterCreateFolder).toBool());
    ui->openAfterCreate->setChecked(settings.value(IniKey_OpenAfterCreateFile).toBool());

    //>>>>> パス設定
    // エディタ
    ui->editorPath->setText(settings.value(IniKey_PathEditor).toString());
    // ターミナル
    ui->terminalPath->setText(settings.value(IniKey_PathTerminal).toString());
    // アーカイバ
    ui->archiverPath->setText(settings.value(IniKey_PathArchiver).toString());

    //>>>>> テキストビューア
    ui->enableViewerIgnoreExt->setChecked(true);
    ui->enableViewerIgnoreExt->setChecked(!settings.value(IniKey_ViewerForceOpen).toBool());
    ui->viewerIgnoreExt->setPlainText(settings.value(IniKey_ViewerIgnoreExt).toString());
}
Exemplo n.º 10
0
void VCWidget::slotMenuCallback(int item)
{
	switch (item)
	{
	case KVCMenuEditCut:
		break;
	case KVCMenuEditCopy:
		break;
	case KVCMenuEditPaste:
		break;
	case KVCMenuEditDelete:
		scram();
		break;

	case KVCMenuEditRename:
		rename();
		break;

	case KVCMenuEditProperties:
		editProperties();
		break;

	case KVCMenuForegroundColor:
		chooseForegroundColor();
		break;

	case KVCMenuForegroundDefault:
		resetForegroundColor();
		break;

	case KVCMenuBackgroundColor:
		chooseBackgroundColor();
		break;
	
	case KVCMenuBackgroundImage:
		chooseBackgroundImage();
		break;
	
	case KVCMenuBackgroundDefault:
		resetBackgroundColor();
		break;

	case KVCMenuFont:
		chooseFont();
		break;

	case KVCMenuFontDefault:
		resetFont();
		break;

	case KVCMenuFrameSunken:
		setFrameStyle(KVCWidgetFrameStyleSunken);
		break;

	case KVCMenuFrameRaised:
		setFrameStyle(KVCWidgetFrameStyleRaised);
		break;

	case KVCMenuFrameNone:
		setFrameStyle(KVCWidgetFrameStyleNone);
		break;

	case KVCMenuStackingRaise:
		raise();
		break;

	case KVCMenuStackingLower:
		lower();
		break;

	default:
		break;
	}
}
Exemplo n.º 11
0
ChatWidget::ChatWidget(QWidget *parent) :
	QWidget(parent), ui(new Ui::ChatWidget)
{
	ui->setupUi(this);

	newMessages = false;
	typing = false;
	peerStatus = 0;
	isChatLobby = false;
	firstShow = true;
	inChatCharFormatChanged = false;

	lastStatusSendTime = 0 ;

	connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat()));
	connect(ui->addFileButton, SIGNAL(clicked()), this , SLOT(addExtraFile()));

	connect(ui->textboldButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(ui->textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(ui->textitalicButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture()));
	connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(chooseColor()));
	connect(ui->emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
	connect(ui->actionSaveChatHistory, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
	connect(ui->actionClearChatHistory, SIGNAL(triggered()), this, SLOT(clearChatHistory()));
	connect(ui->actionDeleteChatHistory, SIGNAL(triggered()), this, SLOT(deleteChatHistory()));
	connect(ui->actionMessageHistory, SIGNAL(triggered()), this, SLOT(messageHistory()));
	connect(ui->actionChooseFont, SIGNAL(triggered()), this, SLOT(chooseFont()));
	connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont()));

	connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));

	connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
	connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));

	connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));

	connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
	// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
	connect(ui->chatTextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));

	ui->infoFrame->setVisible(false);
	ui->statusMessageLabel->hide();

	setAcceptDrops(true);
	ui->chatTextEdit->setAcceptDrops(false);
	ui->hashBox->setDropWidget(this);
	ui->hashBox->setAutoHide(true);

	QMenu *menu = new QMenu();
	menu->addAction(ui->actionChooseFont);
	menu->addAction(ui->actionResetFont);
	ui->fontButton->setMenu(menu);

	menu = new QMenu();
	menu->addAction(ui->actionClearChatHistory);
	menu->addAction(ui->actionDeleteChatHistory);
	menu->addAction(ui->actionSaveChatHistory);
	menu->addAction(ui->actionMessageHistory);
	ui->pushtoolsButton->setMenu(menu);

	ui->chatTextEdit->installEventFilter(this);

//#if QT_VERSION < 0x040700
	// embedded images are not supported before QT 4.7.0
	ui->attachPictureButton->setVisible(false);
//#endif

	resetStatusBar();
}
Exemplo n.º 12
0
/** Constructor */
FriendsDialog::FriendsDialog(QWidget *parent)
            : RsAutoUpdatePage(1500,parent)
{
    /* Invoke the Qt Designer generated object setup routine */
    ui.setupUi(this);

    if (instance == NULL) {
        instance = this;
    }

    last_status_send_time = 0 ;
    inChatCharFormatChanged = false;

    connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage()));
    connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
    connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage()));
    connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
    connect( ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend()));
	 connect( ui.actionFriendRecommendations, SIGNAL(triggered()), this, SLOT(recommendFriends()));
    connect( ui.actionServicePermission, SIGNAL(triggered()), this, SLOT(servicePermission()));
    connect( ui.filter_lineEdit, SIGNAL(textChanged(QString)), ui.friendList, SLOT(filterItems(QString)));

    ui.filter_lineEdit->setPlaceholderText(tr("Search")) ;
    ui.filter_lineEdit->showFilterIcon();

    ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME);
    ui.avatar->setOwnId();

    ui.tabWidget->setTabPosition(QTabWidget::North);
    ui.tabWidget->addTab(networkView = new NetworkView(),QIcon(IMAGE_NETWORK2), tr("Local network"));
    ui.tabWidget->addTab(networkDialog = new NetworkDialog(),QIcon(IMAGE_PEERS), tr("Known people"));

    //ui.tabWidget->addTab(new ProfileWidget(), tr("Profile"));
    //newsFeed = new NewsFeed();
    //int newsFeedTabIndex = ui.tabWidget->insertTab(0, newsFeed, tr("News Feed"));
    //ui.tabWidget->setCurrentIndex(newsFeedTabIndex);

    ui.tabWidget->hideCloseButton(0);
    ui.tabWidget->hideCloseButton(1);
    ui.tabWidget->hideCloseButton(2);
    ui.tabWidget->hideCloseButton(3);

    /* get the current text and text color of the tab bar */
    //newsFeedTabColor = ui.tabWidget->tabBar()->tabTextColor(newsFeedTabIndex);
    //newsFeedText = ui.tabWidget->tabBar()->tabText(newsFeedTabIndex);

    //connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int)));

    connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
    connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));

    connect(ui.msgText,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenuMsgText(QPoint)));

    connect(ui.lineEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
    // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
    connect(ui.lineEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));

    connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(ui.textitalicChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(ui.fontsButton, SIGNAL(clicked()), this, SLOT(chooseFont()));
    connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(chooseColor()));
    connect(ui.actionSave_History, SIGNAL(triggered()), this, SLOT(fileSaveAs()));

    connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));

    ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));

    mCurrentColor = Qt::black;
    mCurrentFont.fromString(Settings->getChatScreenFont());

    colorChanged();
    fontChanged();
    setColorAndFont();

    style.setStyleFromSettings(ChatStyle::TYPE_PUBLIC);

    setChatInfo(tr("Welcome to RetroShare's group chat."), QString::fromUtf8("blue"));

    if (rsHistory->getEnable(true)) {
        int messageCount = Settings->getPublicChatHistoryCount();
        if (messageCount > 0) {
            std::list<HistoryMsg> historyMsgs;
            rsHistory->getMessages("", historyMsgs, messageCount);

            std::list<HistoryMsg>::iterator it;
            for (it = historyMsgs.begin(); it != historyMsgs.end(); it++) {
                addChatMsg(it->incoming, true, QString::fromUtf8(it->peerName.c_str()), QDateTime::fromTime_t(it->sendTime), QDateTime::fromTime_t(it->recvTime), QString::fromUtf8(it->message.c_str()));
            }
        }
    }

    QMenu *menu = new QMenu();
    menu->addAction(ui.actionClear_Chat_History);
    menu->addAction(ui.actionDelete_Chat_History);
    menu->addAction(ui.actionSave_History);
    menu->addAction(ui.actionMessageHistory);
    ui.menuButton->setMenu(menu);

    menu = new QMenu();
    menu->addAction(ui.actionAdd_Friend);
    menu->addAction(ui.actionAdd_Group);
    menu->addAction(ui.actionCreate_new_Chat_lobby);
    menu->addAction(ui.actionFriendRecommendations);
    menu->addAction(ui.actionServicePermission);

    menu->addSeparator();
    menu->addAction(ui.actionSet_your_Avatar);
    menu->addAction(ui.actionSet_your_Personal_Message);

    ui.menutoolButton->setMenu(menu);

    setAcceptDrops(true);
    ui.lineEdit->setAcceptDrops(false);
    ui.hashBox->setDropWidget(this);
    ui.hashBox->setAutoHide(true);

    /* Set initial size the splitter */
    QList<int> sizes;
    sizes << height() << 100; // Qt calculates the right sizes
    ui.splitter_2->setSizes(sizes);

    loadmypersonalstatus();
    ui.displayButton->setMenu(ui.friendList->createDisplayMenu());

    // load settings
    RsAutoUpdatePage::lockAllEvents();
    ui.friendList->setShowStatusColumn(true);
    ui.friendList->setShowLastContactColumn(false);
    ui.friendList->setShowAvatarColumn(false);
    ui.friendList->setRootIsDecorated(true);
    ui.friendList->setShowGroups(true);
    processSettings(true);
    RsAutoUpdatePage::unlockAllEvents();

    ui.lineEdit->installEventFilter(this);

    // add self nick and Avatar to Friends.
    RsPeerDetails pd ;
    if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
        ui.nicknameLabel->setText(PeerDefs::nameWithLocation(pd));
    }

    /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
Exemplo n.º 13
0
CQFontChooser::
CQFontChooser(QWidget *parent) :
 QWidget(parent), style_(FontButton), fixedWidth_(false), exampleText_("Abc")
{
  setObjectName("fontChooser");

  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

  font_     = font();
  fontName_ = font_.toString();

  //-----

  QHBoxLayout *layout = new QHBoxLayout(this);
  layout->setMargin(0); layout->setSpacing(0);

  cedit_   = new QLineEdit  (this); cedit_  ->setObjectName("cedit");
  cbutton_ = new QToolButton(this); cbutton_->setObjectName("cbutton");
  clabel_  = new QLabel     (this); clabel_ ->setObjectName("clabel");
  button_  = new QToolButton(this); button_ ->setObjectName("button");

  ncombo_ = new QFontComboBox(this); ncombo_->setObjectName("ncombo");
  scombo_ = new QComboBox    (this); scombo_->setObjectName("scombo");
  zcombo_ = new QComboBox    (this); zcombo_->setObjectName("zcombo");

  button_->setIcon(CQPixmapCacheInst->getIcon("FONT_DIALOG"));

  ncombo_->setWritingSystem(QFontDatabase::Latin);

//cbutton_->setFixedSize(QSize(24,24));
//clabel_ ->setFixedSize(QSize(24,24));
//button_ ->setFixedSize(QSize(24,24));

  cbutton_->setText(exampleText_);
  clabel_ ->setText(exampleText_);

  layout->addWidget(cedit_  );
  layout->addWidget(cbutton_);
  layout->addWidget(clabel_ );
  layout->addWidget(button_ );
  layout->addWidget(ncombo_ );
  layout->addWidget(scombo_ );
  layout->addWidget(zcombo_ );

// TODO: add strecth widget and hide if any of the stretchable widgets are visible
//layout->addStretch();

  cedit_  ->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  cbutton_->setSizePolicy(QSizePolicy::Fixed    , QSizePolicy::Fixed);
  clabel_ ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  button_ ->setSizePolicy(QSizePolicy::Fixed    , QSizePolicy::Fixed);

  ncombo_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  scombo_->setSizePolicy(QSizePolicy::Fixed    , QSizePolicy::Fixed);
  zcombo_->setSizePolicy(QSizePolicy::Fixed    , QSizePolicy::Fixed);

  connect(cedit_  , SIGNAL(editingFinished()), this, SLOT(editFont  ()));
  connect(cbutton_, SIGNAL(clicked()        ), this, SLOT(applyFont ()));
  connect(button_ , SIGNAL(clicked()        ), this, SLOT(chooseFont()));

  connect(ncombo_ , SIGNAL(activated(int)), this, SLOT(nameChanged ()));
  connect(scombo_ , SIGNAL(activated(int)), this, SLOT(styleChanged()));
  connect(zcombo_ , SIGNAL(activated(int)), this, SLOT(sizeChanged ()));

  setStyle(FontEdit);

  setFixedWidth(false);

  //-----

  updateWidgets();

  setFocusProxy(cedit_);
}