示例#1
0
void GolangEdit::editorCreated(LiteApi::IEditor *editor)
{
    if (!editor || editor->mimeType() != "text/x-gosrc") {
        return;
    }
    //editor->widget()->addAction(m_commentAct);
    QMenu *menu = LiteApi::getEditMenu(editor);
    if (menu) {
        menu->addSeparator();
        menu->addAction(m_findInfoAct);
        menu->addAction(m_jumpDeclAct);
        menu->addAction(m_findUseAct);
        menu->addSeparator();
        menu->addAction(m_renameSymbolAct);
        menu->addSeparator();
        menu->addAction(m_commentAct);
    }
    menu = LiteApi::getContextMenu(editor);
    if (menu) {
        menu->addSeparator();
        menu->addAction(m_findInfoAct);
        menu->addAction(m_jumpDeclAct);
        menu->addAction(m_findUseAct);
        menu->addSeparator();
        QMenu *sub = menu->addMenu(tr("Refactor"));
        sub->addAction(m_renameSymbolAct);
        menu->addSeparator();
        menu->addAction(m_commentAct);
    }
    m_editor = LiteApi::getLiteEditor(editor);
    if (m_editor) {
        m_editor->setTextLexer(new GolangTextLexer(m_liteApp,m_editor));
        connect(m_editor,SIGNAL(updateLink(QTextCursor)),this,SLOT(updateLink(QTextCursor)));
    }
}
示例#2
0
void PictoAction::updateDimension()
{/*{{{*/
     qreal posAncre;
     pos_ = labels_.at( 1 )->width() + 30;

     if( detail() ) {
          posAncre = ( labels_.at( 1 )->width() / 2 ) + 15;

          if( emptyDetail_ || ( !emptyDetail_ && !labels_.at( 0 )->isEmpty() ) ) {
               pos_ += labels_.at( 0 )->width() + 35;
               posAncre =  labels_.at( 0 )->width() + 50
                           + ( labels_.at( 1 )->width() / 2 );
          }

          if( emptyDetail_ || ( !emptyDetail_ && !labels_.at( 2 )->isEmpty() ) ) {
               pos_ += labels_.at( 2 )->width() + 35;
          }

     } else {
          posAncre = ( labels_.at( 1 )->width() / 2 ) + 15;
     }

     posBottomAnchor_.setX( posAncre );
     posUpAnchor_.setX( posAncre );
     updateLink();
}/*}}}*/
示例#3
0
void
CScreensLinks::changeDstScreen(HWND hwnd)
{
	HWND child = getItem(hwnd, IDC_SCREENS_DST_SCREEN);
	m_editedLink.m_dstName = getWindowText(child);
	updateLink(hwnd);
}
示例#4
0
void
CScreensLinks::changeSrcScreen(HWND hwnd)
{
	HWND child = getItem(hwnd, IDC_SCREENS_SRC_SCREEN);
	m_editedLink.m_srcName = getWindowText(child);
	updateLink(hwnd);
}
示例#5
0
void
CScreensLinks::changeSrcSide(HWND hwnd)
{
	HWND child = getItem(hwnd, IDC_SCREENS_SRC_SIDE);
	m_editedLink.m_srcSide = (EDirection)SendMessage(child, CB_GETCURSEL, 0, 0);
	updateLink(hwnd);
}
示例#6
0
void LinkProperties::accept()
{
	linkText = ui.ELinkText -> text();
	linkLocation = ui.ELinkLocation -> text();
	validProperties = true;
	if ( ui.ELinkLocation -> text().isEmpty() )
		emit removeLink();
	else
		emit updateLink(linkText, linkLocation);	
	QWidget::hide();  //close dialog		
}
示例#7
0
void DBWorker::updateTab(int tabId, QString url, QString title, QString path)
{
    Link currentLink = getCurrentLink(tabId);
    if (!currentLink.isValid()) {
        qWarning() << "attempt to update url that is not stored in db." << tabId << title << url << path << currentLink.linkId() << currentLink.url();
        return;
    }
#if DEBUG_LOGS
    qDebug() << tabId << title << url << path;
#endif
    updateLink(currentLink.linkId(), url, title, path);
}
示例#8
0
 ChannelListWidgetItem(QTreeWidget *parent, Channel *channel, int type = Type)
     : QTreeWidgetItem(parent, type), m_channel(channel)
 {
     for (int i = 0; i < ChannelListWidget::LabelCount; ++i)
         m_link[i] = false;
     setTextAlignment(ChannelListWidget::Listeners, Qt::AlignRight | Qt::AlignVCenter);
     setTextAlignment(ChannelListWidget::Relays, Qt::AlignRight | Qt::AlignVCenter);
     setTextAlignment(ChannelListWidget::Score, Qt::AlignRight | Qt::AlignVCenter);
     setTextAlignment(ChannelListWidget::Bitrate, Qt::AlignRight | Qt::AlignVCenter);
     setTextAlignment(ChannelListWidget::Uptime, Qt::AlignRight | Qt::AlignVCenter);
     updateText();
     updateLink();
 }
示例#9
0
void
CScreensLinks::changeIntervalEnd(HWND hwnd, int id, CConfig::CInterval& i)
{
	int x = (int)GetDlgItemInt(hwnd, id, NULL, FALSE);
	if (x < 1) {
		x = 1;
	}
	else if (x > 100) {
		x = 100;
	}

	i.second = 0.01f * (float)x;
	if (i.first >= i.second) {
		i.first = 0.01f * (float)(x - 1);
	}

	updateLinkIntervalControls(hwnd, m_editedLink);
	updateLink(hwnd);
}
示例#10
0
void DBWorker::navigateTo(int tabId, QString url, QString title, QString path) {
    // TODO: rollback in case of failure
    if (url.isEmpty()) {
        return;
    }

    int linkId = 0;
    Link tmp = getLink(url);
    if (tmp.isValid()) {
        linkId = tmp.linkId();
    }

    // Return if the current url of the tab is the same as the parameter url
    Link currentLink = getCurrentLink(tabId);
    if (currentLink.isValid() && currentLink.url() == url) {
        return;
    }

    clearDeprecatedTabHistory(tabId, currentLink.linkId());

    if (linkId == 0) {
        linkId = createLink(url, title, path);
    } else {
        updateLink(linkId, url, title, path);
    }

    if (!addToHistory(linkId)) {
        qWarning() << Q_FUNC_INFO << "failed to add url to history" << url;
    }

    int historyId = addToTabHistory(tabId, linkId);
    if (historyId > 0) {
        updateTab(tabId, historyId);
    } else {
        qWarning() << Q_FUNC_INFO << "failed to add url to tab history" << url;
    }

#ifdef DEBUG_LOGS
    qDebug() << "emit tab changed:" << tabId << historyId << title << url;
#endif
    emit navigated(getTabData(tabId, historyId));
}
示例#11
0
GraphModifyWidget::GraphModifyWidget(Structure::Graph * graph, QWidget *parent) : QDialog(parent), ui(new Ui::GraphModifyWidget)
{
    this->g = graph;

    ui->setupUi(this);

    this->connect( ui->linkButton, SIGNAL(clicked()), SLOT(link()) );
    this->connect( ui->unlinkButton, SIGNAL(clicked()), SLOT(unlink()) );
    this->connect( ui->removeButton, SIGNAL(clicked()), SLOT(remove()) );
	this->connect( ui->unlinkAllButton, SIGNAL(clicked()), SLOT(removeAll()) );

	this->connect(ui->list1, SIGNAL(itemSelectionChanged()), SLOT(visualizeSelections()));
	this->connect(ui->list2, SIGNAL(itemSelectionChanged()), SLOT(visualizeSelections()));

	this->connect(ui->updateLinkButton, SIGNAL(clicked()), SLOT(updateLink()) );

	this->connect(ui->renameButton, SIGNAL(clicked()), SLOT(renameNodes()) );

	updateLists();

	setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
	show();
}
示例#12
0
LiteEditor::LiteEditor(LiteApi::IApplication *app)
    : m_liteApp(app),
      m_extension(new Extension),
      m_completer(0),
      m_funcTip(0),
      m_bReadOnly(false)
{
    m_widget = new QWidget;
    m_editorWidget = new LiteEditorWidget(app,m_widget);
    m_editorWidget->setCursorWidth(2);
    //m_editorWidget->setAcceptDrops(false);
    m_defEditorPalette = m_editorWidget->palette();

    createActions();
    createToolBars();
    createMenu();

    m_editorWidget->setContextMenu(m_contextMenu);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);
/*
    m_toolBar->setStyleSheet("QToolBar {border: 1px ; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #eeeeee, stop: 1 #ababab); }"\
                             "QToolBar QToolButton { border:1px ; border-radius: 1px; }"\
                             "QToolBar QToolButton::hover { background-color: #ababab;}"\
                             "QToolBar::separator {width:2px; margin-left:2px; margin-right:2px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dedede, stop: 1 #a0a0a0);}");
*/
    QHBoxLayout *toolLayout = new QHBoxLayout;
    toolLayout->setMargin(0);
    toolLayout->setSpacing(0);
    toolLayout->addWidget(m_toolBar);
    toolLayout->addWidget(m_infoToolBar);

    layout->addLayout(toolLayout);
//    QHBoxLayout *hlayout = new QHBoxLayout;
//    hlayout->addWidget(m_editorWidget);
//    hlayout->addWidget(m_editorWidget->navigateArea());
    //layout->addLayout(hlayout);
    layout->addWidget(m_editorWidget);
    m_widget->setLayout(layout);
    m_file = new LiteEditorFile(m_liteApp,this);
    m_file->setDocument(m_editorWidget->document());

//    QTextOption option =  m_editorWidget->document()->defaultTextOption();
//    option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
//    option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
//    option.setTabs(tabs);

//    m_editorWidget->document()->setDefaultTextOption(option);

    setEditToolbarVisible(true);

    connect(m_file->document(),SIGNAL(modificationChanged(bool)),this,SIGNAL(modificationChanged(bool)));
    connect(m_file->document(),SIGNAL(contentsChanged()),this,SIGNAL(contentsChanged()));
    connect(m_liteApp->optionManager(),SIGNAL(applyOption(QString)),this,SLOT(applyOption(QString)));
    connect(m_liteApp->editorManager(),SIGNAL(colorStyleSchemeChanged()),this,SLOT(loadColorStyleScheme()));
    connect(m_liteApp->editorManager(),SIGNAL(editToolbarVisibleChanged(bool)),this,SLOT(setEditToolbarVisible(bool)));

    //applyOption("option/liteeditor");

    m_extension->addObject("LiteApi.ITextEditor",this);
    m_extension->addObject("LiteApi.ILiteEditor",this);
    m_extension->addObject("LiteApi.QToolBar",m_toolBar);
    m_extension->addObject("LiteApi.QPlainTextEdit",m_editorWidget);
    m_extension->addObject("LiteApi.ContextMenu",m_contextMenu);
    m_extension->addObject("LiteApi.Menu.Edit",m_editMenu);

    m_editorWidget->installEventFilter(m_liteApp->editorManager());
    connect(m_editorWidget,SIGNAL(cursorPositionChanged()),this,SLOT(editPositionChanged()));
    connect(m_editorWidget,SIGNAL(navigationStateChanged(QByteArray)),this,SLOT(navigationStateChanged(QByteArray)));
    connect(m_editorWidget,SIGNAL(overwriteModeChanged(bool)),m_overInfoAct,SLOT(setVisible(bool)));
    connect(m_editorWidget,SIGNAL(requestFontZoom(int)),this,SLOT(requestFontZoom(int)));
    connect(m_editorWidget,SIGNAL(updateLink(QTextCursor)),this,SIGNAL(updateLink(QTextCursor)));
    connect(m_lineInfo,SIGNAL(doubleClickEvent()),this,SLOT(gotoLine()));
    connect(m_closeEditorAct,SIGNAL(triggered()),m_liteApp->editorManager(),SLOT(closeEditor()));
}