Ejemplo n.º 1
0
ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
    : QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), evenNumber(true), showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing)
{
    document()->setDefaultStyleSheet("a { text-decoration: none; color: blue; }");
    userContextMenu = new UserContextMenu(tabSupervisor, this, game);
    connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
    
    if(tabSupervisor->getUserInfo())
    {
        userName = QString::fromStdString(tabSupervisor->getUserInfo()->name());
        mention = "@" + userName;
    }

    mentionFormat.setFontWeight(QFont::Bold);

    mentionFormatOtherUser.setFontWeight(QFont::Bold);
    mentionFormatOtherUser.setForeground(Qt::blue);
    mentionFormatOtherUser.setAnchor(true);

    viewport()->setCursor(Qt::IBeamCursor);
    setReadOnly(true);
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setOpenLinks(false);
    connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl &)));
}
Ejemplo n.º 2
0
ChatBrowser::ChatBrowser(QWidget *parent) :
    QTextBrowser(parent),m_bgColor(MAX_COLOR_CHANNEL,MAX_COLOR_CHANNEL,MAX_COLOR_CHANNEL),m_parent(parent)
{
    //setOpenLinks(true);
    m_bgColorAct= new QAction(tr("Background Color"),this); //toolBar->addWidget(m_bgColorSelector);
    m_bgColorAct->setToolTip(tr("Background Color"));
    connect(m_bgColorAct,SIGNAL(triggered()),this, SLOT(backGroundChanged()));


    m_detachedDialog = new QAction(tr("Detach the view"),this);
    m_detachedDialog->setCheckable(true);
    m_wordWarp = new QAction(tr("Word Wrap"),this);
    m_wordWarp->setCheckable(true);
    m_wordWarp->setChecked(true);

    connect(m_detachedDialog,SIGNAL(triggered()),this, SLOT(detachedView()));
    //connect(m_anyWhereWarp,SIGNAL(triggered()),this, SLOT(setWrapAnyWhere()));
    connect(m_wordWarp,SIGNAL(triggered()),this, SLOT(setWordWrap()));

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showContextMenu(QPoint)));

    setAcceptRichText(false);
    //setContextMenuPolicy(Qt::NoContextMenu);
    setOpenLinks(true);
    setReadOnly(true);
    setUndoRedoEnabled(false);
    setWordWrapMode(QTextOption::WordWrap);
    document()->setDefaultStyleSheet(QString(".dice {color:%1;font-weight: bold;}").arg(PreferencesManager::getInstance()->value("DiceHighlightColor",QColor(Qt::red)).value<QColor>().name()));
}
Ejemplo n.º 3
0
ChatView::ChatView(const QString &_ownName, bool _showTimestamps, QWidget *parent)
    : QTextBrowser(parent), evenNumber(true), ownName(_ownName), showTimestamps(_showTimestamps)
{
    setReadOnly(true);
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setOpenLinks(false);
    connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl &)));
}
Ejemplo n.º 4
0
HelpBrowser::HelpBrowser(QWidget *parent) :
    QTextBrowser(parent)
{
    setOpenLinks(true);
    setOpenExternalLinks(true);
    loadResource(QTextDocument::StyleSheetResource, QUrl(":/help/about.css"));
    connect(this, SIGNAL(sourceChanged(QUrl)), SLOT(slotSourceChanged(QUrl)));
}
Ejemplo n.º 5
0
ChatMessageArea::ChatMessageArea(bool useFixedHeight) : QTextBrowser(), _useFixedHeight(useFixedHeight) {
    setOpenLinks(false);

    connect(document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged,
            this, &ChatMessageArea::updateLayout);
    connect(this, &QTextBrowser::anchorClicked,
            Menu::getInstance(), &Menu::openUrl);
}
Ejemplo n.º 6
0
RSTextBrowser::RSTextBrowser(QWidget *parent) :
    QTextBrowser(parent)
{
    setOpenExternalLinks(true);
    setOpenLinks(false);

    mShowImages = true;
    mImageBlockWidget = NULL;

    connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
Ejemplo n.º 7
0
TextBrowser::TextBrowser(QWidget *parent) :
    QTextBrowser(parent)
{
    setOpenLinks(false);
    setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    setFrameStyle(QTextEdit::NoFrame);
    setStyleSheet(QString("color: %1; font-size: 13pt; background: transparent")
                         .arg(palette().color(QPalette::Text).name()));
    
    connect(this, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
}
MAutocompleteWidget::MAutocompleteWidget(QWidget *parent, Qt::WindowFlags f): QTextBrowser(parent)
{
    setOpenLinks(false);
    setReadOnly(true);
    //setMinimumSize(100, 5);
    setWindowFlags(f);
    setMaximumHeight(150);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    setAcceptRichText(true);
    MainWindow *main = MainWindow::getInstance();
    connect(this, SIGNAL(anchorClicked(const QUrl&)), main, SLOT(openUrl(const QUrl&)));
}
Ejemplo n.º 9
0
Tutorial::Tutorial(QWidget* parent)
        :QTextBrowser(parent)
{
    setOpenLinks(false);
#include "Tutorial.xxd"
    // created using 'xxd -i Tutorial.html > Tutorial.xxd' then changing the
    // main bit to 'static const char' and the _len to
    // 'static const unsigned int'
    std::string tutorial_string;
    tutorial_string.assign(Tutorial_html, Tutorial_html_len);
    setHtml(tutorial_string.c_str());
}
Ejemplo n.º 10
0
MessageWidget::MessageWidget(QWidget * parent)
    :	QTextBrowser(parent)
    , m_detectLinks(true)
    , m_detectControlCharacters(false)
{
    setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::TextSelectableByKeyboard);

    // since the textbrowser opens local files directly, open links is overriden in anchorClicked...
    setOpenLinks(false);
    connect(this, &QTextBrowser::anchorClicked, this, &MessageWidget::onAnchorClicked);

    setFont(QFont("Consolas, Courier New"));

    m_colors[QtMsgType::QtDebugMsg]    = "#2b91af";
    m_colors[QtMsgType::QtWarningMsg]  = "#2f4f4f";
    m_colors[QtMsgType::QtCriticalMsg] = "#a31515";
    m_colors[QtMsgType::QtFatalMsg]    = "#a31515";
}
Ejemplo n.º 11
0
LogOutputWidget::LogOutputWidget(QWidget* parent)
:   LogOutput()
,   QTextBrowser(parent)
{
    setTextInteractionFlags(Qt::TextBrowserInteraction);
    setReadOnly(true);
    setOpenLinks(false);
    setOpenExternalLinks(false);

    m_cursor = new QTextCursor(this->textCursor());
    m_swap = new QTextEdit();

    update();
    clear();

    setCursor(Qt::IBeamCursor);

    setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
}
Ejemplo n.º 12
0
ChatOutput::ChatOutput(QWidget *parent)
  : QTextBrowser(parent), autolinkRegexp(AUTOLINK_REGEXP)
{
  setReadOnly(true);
  setOpenLinks(false);
  setUndoRedoEnabled(false);

  normalFormat.setFontWeight(QFont::Normal);

  boldFormat.setFontWeight(QFont::Bold);

  linkFormat.setAnchor(true);
  linkFormat.setAnchorHref("");
  linkFormat.setFontWeight(QFont::Bold);
  linkFormat.setForeground(palette().link());
  linkFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);

  cursor = textCursor();

  Q_ASSERT(autolinkRegexp.isValid());
}
Ejemplo n.º 13
0
WChatLog::WChatLog(QWidget * pwParent, ITreeItemChatLogEvents * pContactOrGroup) : WTextBrowser(pwParent)
	{
	Assert(pContactOrGroup != NULL);
	m_pContactOrGroup = pContactOrGroup;
	m_fDisplayAllMessages = FALSE;
	m_tsMidnightNext = d_ts_zNA;
	setMinimumSize(10, 50);
	setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
	setTextInteractionFlags((textInteractionFlags() & ~Qt::TextEditable) | Qt::LinksAccessibleByMouse);
	setUndoRedoEnabled(false);		// setMaximumBlockCount
	setCursorWidth(0);
	//document()->setDefaultStyleSheet("p {text-indent:-10px; margin-left:10px; margin-top:5; margin-bottom:0; white-space:pre-wrap;}");
	document()->setDefaultStyleSheet(
		"a."d_szClassForChatLog_ButtonHtml " { color: black; background-color: silver; text-decoration: none; font-weight: bold } "
		"a."d_szClassForChatLog_HyperlinkDisabled " { color: gray; text-decoration: none; } "

		"a.ha { color: navy; text-decoration: none; } "	// Active Hyperlink (displayed in the normal blue color)
		".d { color: green } "
		//"a.hb { padding: 6px; margin-left:10px; background-color: silver; border-style: outset; border-width: 2px; border-radius: 10px; border-color: black; } "
		//"a.hb:hover { background-color: rgb(224, 0, 0); border-style: inset; }");
		);

	/*
	QTextCursor oTextCursor = textCursor();
	//oTextCursor.select(QTextCursor::Document);
	//oTextCursor.setBlockFormat(QTextBlockFormat());
	oTextCursor.insertBlock();
	m_oTextBlockComposing = oTextCursor.block();

	CArrayPtrEvents arraypEvents;
	pContactOrGroup->Vault_GetEventsForChatLog(OUT &arraypEvents);
	ChatLog_EventsDisplay(IN arraypEvents);
	*/
	ChatLog_EventsRepopulate();

	setOpenLinks(false);	// Prevent the chat history to automatically open the hyperlinks
	connect(this, SIGNAL(highlighted(QUrl)), this, SLOT(SL_HyperlinkMouseHovering(QUrl)));
	connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(SL_HyperlinkClicked(QUrl)));
	}
Ejemplo n.º 14
0
ChatAreaWidget::ChatAreaWidget(QWidget *parent)
    : QTextBrowser(parent)
    , tableFrmt(nullptr)
    , nameWidth(75)
{
    setReadOnly(true);
    viewport()->setCursor(Qt::ArrowCursor);
    setContextMenuPolicy(Qt::CustomContextMenu);
    setUndoRedoEnabled(false);

    setOpenExternalLinks(false);
    setOpenLinks(false);
    setAcceptRichText(false);
    setFrameStyle(QFrame::NoFrame);

    nameFormat.setAlignment(Qt::AlignRight);
    nameFormat.setNonBreakableLines(true);
    dateFormat.setAlignment(Qt::AlignLeft);
    dateFormat.setNonBreakableLines(true);

    connect(this, &ChatAreaWidget::anchorClicked, this, &ChatAreaWidget::onAnchorClicked);
    connect(verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
}
Ejemplo n.º 15
0
TextBrowser::TextBrowser(QWidget *parent) : QTextBrowser(parent)
{
    this->viewport()->setCursor(Qt::IBeamCursor);
    setOpenLinks(false); // also disables external links
    connect(this,SIGNAL(anchorClicked(QUrl)),this,SLOT(openLinkInBrowser(QUrl))); // because all links should be opened in the web browser
}