コード例 #1
0
MsgEdit::MsgEdit(QWidget *parent, UserWnd *userWnd)
        : QMainWindow(parent, NULL, 0)
{
    m_userWnd	= userWnd;
    m_msg		= NULL;
    m_bTyping	= false;
    m_type		= NO_TYPE;
    m_flags		= 0;
    m_retry.msg = NULL;
    m_bReceived = false;
    m_processor = NULL;
    m_recvProcessor = NULL;
    m_cmd.param = NULL;

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    m_frame = new QFrame(this);
    setCentralWidget(m_frame);
    m_layout = new QVBoxLayout(m_frame);

    m_edit = new MsgTextEdit(this, m_frame);
    m_edit->setBackground(QColor(CorePlugin::m_plugin->getEditBackground() & 0xFFFFFF));
    m_edit->setForeground(QColor(CorePlugin::m_plugin->getEditForeground() & 0xFFFFFF), true);
    m_edit->setFont(CorePlugin::m_plugin->editFont);
    m_edit->setCtrlMode(!CorePlugin::m_plugin->getSendOnEnter());
	setFocusProxy(m_edit);

    QStyleSheet *style = new QStyleSheet(m_edit);
    QStyleSheetItem *style_p = style->item("p");
    // Disable top and bottom margins for P tags. This will make sure
    // paragraphs have no more spacing than regular lines, thus matching
    // RTFs defaut look for paragraphs.
    style_p->setMargin(QStyleSheetItem::MarginTop, 0);
    style_p->setMargin(QStyleSheetItem::MarginBottom, 0);
    m_edit->setStyleSheet(style);

    connect(m_edit, SIGNAL(lostFocus()), this, SLOT(editLostFocus()));
    connect(m_edit, SIGNAL(textChanged()), this, SLOT(editTextChanged()));
    connect(m_edit, SIGNAL(ctrlEnterPressed()), this, SLOT(editEnterPressed()));
    connect(m_edit, SIGNAL(colorsChanged()), this, SLOT(colorsChanged()));
    connect(m_edit, SIGNAL(finished()), this, SLOT(editFinished()));
    connect(m_edit, SIGNAL(fontSelected(const QFont&)), this, SLOT(editFontChanged(const QFont&)));

    QFontMetrics fm(m_edit->font());
    m_edit->setMinimumSize(QSize(fm.maxWidth(), fm.height() + 10));
    m_layout->addWidget(m_edit);

    BarShow b;
    b.bar_id = ToolBarMsgEdit;
    b.parent = this;
    Event e(EventShowBar, &b);
    m_bar = (CToolBar*)(e.process());
    m_bar->setParam(this);

    if (CorePlugin::m_plugin->getContainerMode() == 0)
        showCloseSend(false);

    setDockEnabled(m_bar, Left, false);
    setDockEnabled(m_bar, Right, false);
}
コード例 #2
0
MsgView::MsgView(QWidget *p)
        : TextShow(p)
{
    bBack = false;
    connect(pClient, SIGNAL(messageRead(ICQMessage*)), this, SLOT(messageRead(ICQMessage*)));
    connect(pMain, SIGNAL(colorsChanged()), this, SLOT(colorsChanged()));
    oldSendColor = pMain->ColorSend();
    oldReceiveColor = pMain->ColorReceive();
}
コード例 #3
0
ファイル: decorationoptions.cpp プロジェクト: KDE/kwin
void DecorationOptions::setDecoration(KDecoration2::Decoration *decoration)
{
    if (m_decoration == decoration) {
        return;
    }
    if (m_decoration) {
        // disconnect from existing decoration
        disconnect(m_decoration->client().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
        auto s = m_decoration->settings();
        disconnect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &DecorationOptions::fontChanged);
        disconnect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &DecorationOptions::titleButtonsChanged);
        disconnect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &DecorationOptions::titleButtonsChanged);
        disconnect(m_paletteConnection);
    }
    m_decoration = decoration;
    connect(m_decoration->client().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
    m_paletteConnection = connect(m_decoration->client().data(), &KDecoration2::DecoratedClient::paletteChanged, this,
        [this] (const QPalette &pal) {
            m_colors.update(pal);
            emit colorsChanged();
        }
    );
    auto s = m_decoration->settings();
    connect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &DecorationOptions::fontChanged);
    connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &DecorationOptions::titleButtonsChanged);
    connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &DecorationOptions::titleButtonsChanged);
    emit decorationChanged();
}
コード例 #4
0
ファイル: ZoomWidget.cpp プロジェクト: 4321ip/pixelreiter
void ZoomWidget::grabPixmap()
{
    if(!selWin->isVisible()) return;
    int grabWidth = (width()-rulerWidth)/m_zoomFactor +1;
    int grabHeight = (height()-rulerWidth)/m_zoomFactor +1;
    
    m_pixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), selWin->getSelection().x(), selWin->getSelection().y(), grabWidth, grabHeight);

	QHash<QRgb, int> pixels;
    QImage image = m_pixmap.toImage();
    for(int x=0;x<grabWidth;x++) {
        for(int y=0;y<grabHeight;y++) {
            QRgb pixel = image.pixel(x, y);
            pixels[pixel]++;
            
        }
    }

    QList<ColorCount> colors;
    QHashIterator<QRgb, int> i(pixels);
    while (i.hasNext()) {
        i.next();
        colors.append(ColorCount(i.key(), i.value()));
    }
    qSort(colors);

    emit colorsChanged(colors);

    update();
}
コード例 #5
0
ファイル: Theme.cpp プロジェクト: KDE/calligra
void Theme::setColors(const QVariantMap& newValue)
{
    if(newValue != d->colors) {
        d->colors = newValue;
        emit colorsChanged();
    }
}
コード例 #6
0
void Color_List_Widget::setColors(const QList<QColor> &colors)
{
    clear();
    p->colors = colors;
    for(int i = 0;i < colors.size();i++ )
        append_widget(i);
    emit colorsChanged(colors);
}
コード例 #7
0
void ColorPalette::emitUpdate()
{
    colorsChanged(p->colors);
    columnsChanged(p->columns);
    nameChanged(p->name);
    fileNameChanged(p->fileName);
    dirtyChanged(p->dirty);
}
コード例 #8
0
ファイル: palette.cpp プロジェクト: tokyogeometry/Drawpile
/**
 * Size of the palette is decreased by one.
 * @param index color index
 * @pre 0 <= index < count()
*/
void Palette::removeColor(int index)
{
	if(_readonly)
		return;

	_colors.removeAt(index);
	_modified = true;
	emit colorsChanged();
}
コード例 #9
0
void ColorListWidget::color_changed(int row)
{
    ColorSelector *cs = widget_cast<ColorSelector>(row);
    if ( cs )
    {
        p->colors[row] = cs->color();
        emit colorsChanged(p->colors);
    }
}
コード例 #10
0
ファイル: palette.cpp プロジェクト: tokyogeometry/Drawpile
void Palette::appendColor(const QColor &color, const QString &name)
{
	if(_readonly)
		return;

	_colors.append(PaletteColor(color, name));
	_modified = true;
	emit colorsChanged();
}
コード例 #11
0
ファイル: palette.cpp プロジェクト: tokyogeometry/Drawpile
/**
 * Size of the palette is increased by one. The new color is
 * inserted before the index. If index == count(), the color is
 * added to the end of the palette.
 * @param index color index
 * @param color color
 * @pre 0 <= index <= count()
*/
void Palette::setColor(int index, const PaletteColor& color)
{
	if(_readonly)
		return;

	_colors[index] = color;
	_modified = true;
	emit colorsChanged();
}
コード例 #12
0
ファイル: palette.cpp プロジェクト: tokyogeometry/Drawpile
void Palette::insertColor(int index, const QColor& color, const QString &name)
{
	if(_readonly)
		return;

	_colors.insert(index, PaletteColor(color, name));
	_modified = true;
	emit colorsChanged();
}
コード例 #13
0
ファイル: colorscope.cpp プロジェクト: KDE/plasma-framework
void ColorScope::setColorGroup(Plasma::Theme::ColorGroup group)
{
    if (m_group == group) {
        return;
    }

    m_group = group;

    emit colorGroupChanged();
    emit colorsChanged();
}
コード例 #14
0
ファイル: colorscope.cpp プロジェクト: KDE/plasma-framework
void ColorScope::itemChange(ItemChange change, const ItemChangeData &value)
{
    if (change == QQuickItem::ItemSceneChange) {
        //we have a window: create the representations if needed
        if (value.window) {
            emit colorGroupChanged();
            emit colorsChanged();
        }
    }

    QQuickItem::itemChange(change, value);
}
コード例 #15
0
void ColorListWidget::swap(int a, int b)
{
    ColorSelector* sa = widget_cast<ColorSelector>(a);
    ColorSelector* sb = widget_cast<ColorSelector>(b);
    if ( sa && sb )
    {
        QColor ca = sa->color();
        sa->setColor(sb->color());
        sb->setColor(ca);
        emit colorsChanged(p->colors);
    }
}
コード例 #16
0
ファイル: decorationoptions.cpp プロジェクト: KDE/kwin
void DecorationOptions::slotActiveChanged()
{
    if (!m_decoration) {
        return;
    }
    if (m_active == m_decoration->client().data()->isActive()) {
        return;
    }
    m_active = m_decoration->client().data()->isActive();
    emit colorsChanged();
    emit fontChanged();
}
コード例 #17
0
void ColorPalette::loadColorTable(const QVector<QRgb>& color_table)
{
    p->colors.clear();
    p->colors.reserve(color_table.size());
    for ( QRgb c : color_table )
    {
        QColor color ( c );
        color.setAlpha(255);
        p->colors.push_back(qMakePair(color,QString()));
    }
    colorsChanged(p->colors);
    setDirty(true);
}
コード例 #18
0
ファイル: gradients.cpp プロジェクト: BGmot/Qt
GradientEditor::GradientEditor(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *vbox = new QVBoxLayout(this);
    vbox->setSpacing(1);
    vbox->setMargin(1);

    m_red_shade = new ShadeWidget(ShadeWidget::RedShade, this);
    m_green_shade = new ShadeWidget(ShadeWidget::GreenShade, this);
    m_blue_shade = new ShadeWidget(ShadeWidget::BlueShade, this);
    m_alpha_shade = new ShadeWidget(ShadeWidget::ARGBShade, this);

    vbox->addWidget(m_red_shade);
    vbox->addWidget(m_green_shade);
    vbox->addWidget(m_blue_shade);
    vbox->addWidget(m_alpha_shade);

    connect(m_red_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated()));
    connect(m_green_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated()));
    connect(m_blue_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated()));
    connect(m_alpha_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated()));
}
コード例 #19
0
ファイル: TransferFunctionEditor.cpp プロジェクト: VMML/Livre
TransferFunctionEditor::TransferFunctionEditor( livre::Controller& controller, QWidget* tfParentWidget )
    : QWidget( tfParentWidget )
    , _controller( controller )
    , ui( new Ui::TransferFunctionEditor )
    , _isConnected( false )
    , _redWidget( new ColorMapWidget( ColorMapWidget::RED_SHADE, this ))
    , _greenWidget( new ColorMapWidget( ColorMapWidget::GREEN_SHADE, this ))
    , _blueWidget( new ColorMapWidget( ColorMapWidget::BLUE_SHADE, this ))
    , _alphaWidget( new ColorMapWidget( ColorMapWidget::ARGB_SHADE, this ))
    , _gradientRenderer( new GradientRenderer( this ))
{
    ui->setupUi( this );

    // Add the widgets to the layouts to match the exact positions on the TransferFunctionEditor.
    ui->redLayout->addWidget( _redWidget );
    ui->greenLayout->addWidget( _greenWidget );
    ui->blueLayout->addWidget( _blueWidget );
    ui->rgbaLayout->addWidget( _alphaWidget );
    ui->rgbGradientLayout->addWidget( _gradientRenderer );

    connect( _redWidget, SIGNAL( colorsChanged()),
            this, SLOT( _pointsUpdated()));
    connect( _greenWidget, SIGNAL( colorsChanged()),
            this, SLOT( _pointsUpdated()));
    connect( _blueWidget, SIGNAL( colorsChanged()),
            this, SLOT( _pointsUpdated()));
    connect( _alphaWidget, SIGNAL( colorsChanged()),
            this, SLOT( _pointsUpdated()));

    connect( ui->resetButton, SIGNAL( clicked()), this, SLOT( _setDefault()));
    connect( ui->clearButton, SIGNAL( clicked()), this, SLOT( _clear()));
    connect( ui->btnConnect, SIGNAL( pressed()), this, SLOT( _connect( )));
    connect( ui->btnDisconnect, SIGNAL( pressed()), this, SLOT( _disconnect()));

    QTimer::singleShot( 50, this, SLOT( _setDefault()));
}
コード例 #20
0
ファイル: MainUI.cpp プロジェクト: yamajun/lumina
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
  ui->setupUi(this);
  settings = new QSettings("lumina-desktop","lumina-textedit");
  Custom_Syntax::SetupDefaultColors(settings); //pre-load any color settings as needed
  colorDLG = new ColorDialog(settings, this);
  this->setWindowTitle(tr("Text Editor"));
  ui->tabWidget->clear();
  closeFindS = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    connect(closeFindS, SIGNAL(activated()), this, SLOT(closeFindReplace()) );
  ui->groupReplace->setVisible(false);
  //Update the menu of available syntax highlighting modes
  QStringList smodes = Custom_Syntax::availableRules();
  for(int i=0; i<smodes.length(); i++){
    ui->menuSyntax_Highlighting->addAction(smodes[i]);
  }
  ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() );
  ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() );
  //Setup any connections
  connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) );
  connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) );
  connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(OpenFile()) );
  connect(ui->actionClose_File, SIGNAL(triggered()), this, SLOT(CloseFile()) );
  connect(ui->actionSave_File, SIGNAL(triggered()), this, SLOT(SaveFile()) );
  connect(ui->actionSave_File_As, SIGNAL(triggered()), this, SLOT(SaveFileAs()) );
  connect(ui->menuSyntax_Highlighting, SIGNAL(triggered(QAction*)), this, SLOT(UpdateHighlighting(QAction*)) );
  connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()) );
  connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
  connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) );
  connect(ui->actionWrap_Lines, SIGNAL(toggled(bool)), this, SLOT(wrapLines(bool)) );
  connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) );
  connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(openFind()) );
  connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(openReplace()) );
  connect(ui->tool_find_next, SIGNAL(clicked()), this, SLOT(findNext()) );
  connect(ui->tool_find_prev, SIGNAL(clicked()), this, SLOT(findPrev()) );
  connect(ui->tool_replace, SIGNAL(clicked()), this, SLOT(replaceOne()) );
  connect(ui->tool_replace_all, SIGNAL(clicked()), this, SLOT(replaceAll()) );
  connect(ui->line_find, SIGNAL(returnPressed()), this, SLOT(findNext()) );
  connect(ui->line_replace, SIGNAL(returnPressed()), this, SLOT(replaceOne()) );
  connect(colorDLG, SIGNAL(colorsChanged()), this, SLOT(UpdateHighlighting()) );
  updateIcons();
  //Now load the initial size of the window
  QSize lastSize = settings->value("lastSize",QSize()).toSize();
  if(lastSize.width() > this->sizeHint().width() && lastSize.height() > this->sizeHint().height() ){
    this->resize(lastSize);
  }
}
コード例 #21
0
bool ColorPalette::loadImage(const QImage& image)
{
    if ( image.isNull() )
        return false;
    setColumns(image.width());

    p->colors.clear();
    p->colors.reserve(image.width()*image.height());
    for ( int y = 0; y < image.height(); y++ )
    {
        for ( int x = 0; x < image.width(); x++ )
        {
            QColor color ( image.pixel(x, y) );
            color.setAlpha(255);
            p->colors.push_back(qMakePair(color,QString()));
        }
    }
    colorsChanged(p->colors);
    setDirty(true);
    return true;
}
コード例 #22
0
ファイル: gradients.cpp プロジェクト: BGmot/Qt
ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
    : QWidget(parent), m_shade_type(type), m_alpha_gradient(QLinearGradient(0, 0, 0, 0))
{

    // Checkers background
    if (m_shade_type == ARGBShade) {
        QPixmap pm(20, 20);
        QPainter pmp(&pm);
        pmp.fillRect(0, 0, 10, 10, Qt::lightGray);
        pmp.fillRect(10, 10, 10, 10, Qt::lightGray);
        pmp.fillRect(0, 10, 10, 10, Qt::darkGray);
        pmp.fillRect(10, 0, 10, 10, Qt::darkGray);
        pmp.end();
        QPalette pal = palette();
        pal.setBrush(backgroundRole(), QBrush(pm));
        setAutoFillBackground(true);
        setPalette(pal);

    } else {
        setAttribute(Qt::WA_NoBackground);

    }

    QPolygonF points;
    points << QPointF(0, sizeHint().height())
           << QPointF(sizeHint().width(), 0);

    m_hoverPoints = new HoverPoints(this, HoverPoints::CircleShape);
//     m_hoverPoints->setConnectionType(HoverPoints::LineConnection);
    m_hoverPoints->setPoints(points);
    m_hoverPoints->setPointLock(0, HoverPoints::LockToLeft);
    m_hoverPoints->setPointLock(1, HoverPoints::LockToRight);
    m_hoverPoints->setSortType(HoverPoints::XSort);

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

    connect(m_hoverPoints, SIGNAL(pointsChanged(QPolygonF)), this, SIGNAL(colorsChanged()));
}
コード例 #23
0
ファイル: ColorMapWidget.cpp プロジェクト: bilgili/Livre
ColorMapWidget::ColorMapWidget( QWidget* parent_,
                                lexis::render::ColorMap& colorMap,
                                const lexis::render::ColorMap::Channel channel )
    : QWidget( parent_ )
    , _colorMap( colorMap )
    , _channel( channel )
    , _isLogScale( false )
    , _gradient( QLinearGradient( 0, 0, 0, 0 ))
{
    setMouseTracking( true );

    if( _channel == lexis::render::ColorMap::Channel::alpha )
        _createCheckersBackground();
    else
        setAttribute( Qt::WA_NoBackground );

    QPolygonF points;
    points << QPointF( 0, sizeHint().height())
           << QPointF( sizeHint().width(), 0 );

    _hoverPoints = new HoverPoints( this, colorMap, channel );
    connect( _hoverPoints, SIGNAL( pointsChanged( )), this, SIGNAL( colorsChanged()));
}
コード例 #24
0
void ColorListWidget::handle_removed(int i)
{
    p->colors.removeAt(i);
    emit colorsChanged(p->colors);
}
コード例 #25
0
void ColorPalette::setColors(const QVector<QPair<QColor,QString> >& colors)
{
    p->colors = colors;
    setDirty(true);
    colorsChanged(p->colors);
}
コード例 #26
0
void ColorListWidget::emit_changed()
{
    emit colorsChanged(p->colors);
}
コード例 #27
0
void ColorListWidget::append()
{
    p->colors.push_back(Qt::black);
    append_widget(p->colors.size()-1);
    emit colorsChanged(p->colors);
}
コード例 #28
0
bool ColorPalette::load(const QString& name)
{
    p->fileName = name;
    p->colors.clear();
    p->columns = 0;
    p->dirty = false;
    p->name = QFileInfo(name).baseName();

    QFile file(name);

    if ( !file.open(QFile::ReadOnly|QFile::Text) )
    {
        emitUpdate();
        return false;
    }

    QTextStream stream( &file );

    if ( stream.readLine() != "GIMP Palette" )
    {
        emitUpdate();
        return false;
    }

    QString line;

    // parse properties
    QHash<QString,QString> properties;
    while( !stream.atEnd() )
    {
        line = stream.readLine();
        if ( line.isEmpty() )
            continue;
        if ( line[0] == '#' )
            break;
        int colon = line.indexOf(':');
        if ( colon == -1 )
            break;
        properties[line.left(colon).toLower()] =
            line.right(line.size() - colon - 1).trimmed();
    }
    /// \todo Store extra properties in the palette object
    setName(properties["name"]);
    setColumns(properties["columns"].toInt());

    // Skip comments
    if ( !stream.atEnd() && line[0] == '#' )
        while( !stream.atEnd() )
        {
            qint64 pos = stream.pos();
            line = stream.readLine();
            if ( !line.isEmpty() && line[0] != '#' )
            {
                stream.seek(pos);
                break;
            }
        }

    while( !stream.atEnd() )
    {
        int r = 0, g = 0, b = 0;
        stream >> r >> g >> b;
        line = stream.readLine().trimmed();
        p->colors.push_back(qMakePair(QColor(r, g, b), line));
    }

    colorsChanged(p->colors);
    setDirty(false);

    return true;
}
コード例 #29
0
void TextEdit::fgColorChanged(QColor c)
{
    setForeground(c, true);
    curFG = c;
    emit colorsChanged();
}
コード例 #30
0
void TextEdit::bgColorChanged(QColor c)
{
    setBackground(c);
    emit colorsChanged();
}