当前位置: 首页>>代码示例>>C++>>正文


C++ TR函数代码示例

本文整理汇总了C++中TR函数的典型用法代码示例。如果您正苦于以下问题:C++ TR函数的具体用法?C++ TR怎么用?C++ TR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OC_DASSERT

	void ArrayEditor<ElementType>::InitWidget()
	{
		static unsigned int editorCounter = 0;
		OC_DASSERT(mEditorWidget == 0);

		CEGUI::String editorName = "Editor/EntityWindow/ValueEditors/ArrayEditor" + string(Reflection::PropertyTypes::GetStringName(Reflection::PropertyTypes::GetTypeID<ElementType>())) +  Utils::StringConverter::ToString(editorCounter++);
		
		// Create main editor widget
		mEditorWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName);
		mMainLayout = new GUISystem::VerticalLayout(mEditorWidget, 0, true);
		
		// Create header widget
		mHeaderWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName + "/Header");
		mHeaderWidget->setHeight(CEGUI::UDim(0, GetEditboxHeight()));
		mMainLayout->AddChildWindow(mHeaderWidget);

		// Create label widget
		CEGUI::Window* labelWidget = this->CreateLabelWidget(editorName + "/Header/Label");
		labelWidget->setArea(CEGUI::URect(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0), CEGUI::UDim(0.5f, -2), CEGUI::UDim(0, GetEditboxHeight())));
		mHeaderWidget->addChildWindow(labelWidget);

		// Create add element button
		mButtonAddElement = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/AddElementButton"));
		mButtonAddElement->setProperty("NormalImage", "set:EditorToolbar image:btnAddNormal");
		mButtonAddElement->setProperty("HoverImage", "set:EditorToolbar image:btnAddHover");
		mButtonAddElement->setProperty("PushedImage", "set:EditorToolbar image:btnAddPushed");
		mButtonAddElement->setProperty("DisabledImage", "set:EditorToolbar image:btnAddDisabled");
		mButtonAddElement->setWantsMultiClickEvents(false);
		mButtonAddElement->setTooltipText(TR("entity_editor_add_hint"));
		mButtonAddElement->setVisible(true);
		mButtonAddElement->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonAddElement->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -80), CEGUI::UDim(0, 0)));
		mButtonAddElement->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonAddPressed, this));
		mHeaderWidget->addChildWindow(mButtonAddElement);

		// Create revert button
		mButtonRevert = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/RevertButton"));
		mButtonRevert->setProperty("NormalImage", "set:EditorToolbar image:btnCancelNormal");
		mButtonRevert->setProperty("HoverImage", "set:EditorToolbar image:btnCancelHover");
		mButtonRevert->setProperty("PushedImage", "set:EditorToolbar image:btnCancelPushed");
		mButtonRevert->setProperty("DisabledImage", "set:EditorToolbar image:btnCancelDisabled");
		mButtonRevert->setWantsMultiClickEvents(false);
		mButtonRevert->setTooltipText(TR("entity_editor_revert_hint"));
		mButtonRevert->setVisible(true);
		mButtonRevert->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonRevert->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -52), CEGUI::UDim(0, 0)));
		mButtonRevert->setEnabled(false);
		mButtonRevert->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonRevertPressed, this));
		mHeaderWidget->addChildWindow(mButtonRevert);

		// Create save button
		mButtonSave = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/SaveButton"));
		mButtonSave->setProperty("NormalImage", "set:EditorToolbar image:btnSaveNormal");
		mButtonSave->setProperty("HoverImage", "set:EditorToolbar image:btnSaveHover");
		mButtonSave->setProperty("PushedImage", "set:EditorToolbar image:btnSavePushed");
		mButtonSave->setProperty("DisabledImage", "set:EditorToolbar image:btnSaveDisabled");
		mButtonSave->setWantsMultiClickEvents(false);
		mButtonSave->setTooltipText(TR("entity_editor_save_hint"));
		mButtonSave->setVisible(true);
		mButtonSave->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonSave->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -24), CEGUI::UDim(0, 0)));
		mButtonSave->setEnabled(false);
		mButtonSave->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonSavePressed, this));
		mHeaderWidget->addChildWindow(mButtonSave);

		// Create is-shared checkbox
		CEGUI::Checkbox* isSharedCheckbox = CreateIsSharedCheckboxWidget(editorName + "/Header/IsSharedCheckbox");
		isSharedCheckbox->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
		isSharedCheckbox->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&ArrayEditor::OnEventIsSharedCheckboxChanged, this));
		mHeaderWidget->addChildWindow(isSharedCheckbox);

		// Create body widget
		CEGUI::Window* bodyWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName + "/Body");
		mBodyLayout = new GUISystem::VerticalLayout(bodyWidget, 0, true);
		mMainLayout->AddChildWindow(bodyWidget);
	}
开发者ID:Ocerus,项目名称:Ocerus,代码行数:76,代码来源:ArrayEditor.cpp

示例2: TR

int LoadAppScript::writeToDB(const QByteArray &pdata, const QString pkgname, QString &errMsg)
{
  if (_name.isEmpty())
  {
    errMsg = TR("<font color=orange>The script does not have"
                         " a name.</font>");
    return -1;
  }

  if (pdata.isEmpty())
  {
    errMsg = TR("<font color=orange>The script %1 is empty.</font>")
                         .arg(_filename);
    return -2;
  }

  if (_grade == INT_MIN)
  {
    QSqlQuery minOrder;
    minOrder.prepare("SELECT MIN(script_order) AS min "
                     "FROM script "
                     "WHERE (script_name=:name);");
    minOrder.bindValue(":name", _name);
    minOrder.exec();
    if (minOrder.first())
      _grade = minOrder.value(0).toInt();
    else if (minOrder.lastError().type() != QSqlError::NoError)
    {
      QSqlError err = minOrder.lastError();
      errMsg = _sqlerrtxt.arg(_filename).arg(err.driverText()).arg(err.databaseText());
      return -3;
    }
    else
      _grade = 0;
  }
  else if (_grade == INT_MAX)
  {
    QSqlQuery maxOrder;
    maxOrder.prepare("SELECT MAX(script_order) AS max "
                     "FROM script "
                     "WHERE (script_name=:name);");
    maxOrder.bindValue(":name", _name);
    maxOrder.exec();
    if (maxOrder.first())
      _grade = maxOrder.value(0).toInt();
    else if (maxOrder.lastError().type() != QSqlError::NoError)
    {
      QSqlError err = maxOrder.lastError();
      errMsg = _sqlerrtxt.arg(_filename).arg(err.driverText()).arg(err.databaseText());
      return -4;
    }
    else
      _grade = 0;
  }

  QSqlQuery select;
  QSqlQuery upsert;

  int scriptid  = -1;
  int pkgheadid = -1;
  int pkgitemid = -1;
  if (pkgname.isEmpty())
    select.prepare(QString("SELECT script_id, -1, -1"
                         "  FROM %1script "
                         " WHERE ((script_name=:name)"
                         "   AND  (script_order=:grade));")
                       .arg(_system ? "" : "pkg"));
  else
    select.prepare(_pkgitemQueryStr);
  select.bindValue(":name",    _name);
  select.bindValue(":pkgname", pkgname);
  select.bindValue(":grade",   _grade);
  select.bindValue(":type",    _pkgitemtype);
  select.exec();
  if(select.first())
  {
    scriptid  = select.value(0).toInt();
    pkgheadid = select.value(1).toInt();
    pkgitemid = select.value(2).toInt();
  }
  else if (select.lastError().type() != QSqlError::NoError)
  {
    QSqlError err = select.lastError();
    errMsg = _sqlerrtxt.arg(_filename).arg(err.driverText()).arg(err.databaseText());
    return -5;
  }

  if (scriptid >= 0)
  upsert.prepare(QString("UPDATE %1script "
                         "   SET script_order=:grade, "
                         "       script_enabled=:enabled,"
                         "       script_source=:source,"
                         "       script_notes=:notes "
                         " WHERE (script_id=:id); ")
                       .arg(_system ? "" : "pkg"));
  else
  {
    upsert.prepare("SELECT NEXTVAL('script_script_id_seq');");
    upsert.exec();
    if (upsert.first())
//.........这里部分代码省略.........
开发者ID:gpazo,项目名称:xtuple-svn,代码行数:101,代码来源:loadappscript.cpp

示例3: TR

#include "[Name].h"
#include "SA[Name]Factory.h"
#include <QApplication>
#include <QMessageBox>
#include <QFileDialog>
#include "SAUIReflection.h"

#define TR(str)\
    QApplication::translate("[Name]",str,0)
static const QString s_pluginName = TR("");
static const QString s_pluginDescription =  TR("");
static const QString s_pluginVersion = TR("");
static const SAAbstractPlugin::PluginType s_pluginType = SAAbstractPlugin::DataImport;

SA_PLUGIN_EXPORT SAAbstractPlugin *createPlugin()
{
    return new [Name]();
}
SA_PLUGIN_EXPORT void deletePlugin(SAAbstractPlugin *obj)
{
    if(obj != nullptr)
    {
        delete obj;
    }
}
SA_PLUGIN_EXPORT QString pluginName()
{
    return s_pluginName;
}
SA_PLUGIN_EXPORT QString pluginVersion()
{
开发者ID:czyt1988,项目名称:sa,代码行数:31,代码来源:[Name].cpp

示例4: wresize

wresize(WINDOW *win, int ToLines, int ToCols)
{
    int col, row, size_x, size_y;
    struct ldat *pline;
    struct ldat *new_lines = 0;

#ifdef TRACE
    T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols));
    if (win) {
	TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)",
			  (long) win->_begy, (long) win->_begx,
			  (long) win->_maxy, (long) win->_maxx,
			  (long) win->_regtop, (long) win->_regbottom));
	if (USE_TRACEF(TRACE_UPDATE)) {
	    _tracedump("...before", win);
	    _nc_unlock_global(tracef);
	}
    }
#endif

    if (!win || --ToLines < 0 || --ToCols < 0)
	returnCode(ERR);

    size_x = win->_maxx;
    size_y = win->_maxy;

    if (ToLines == size_y
	&& ToCols == size_x)
	returnCode(OK);

    if ((win->_flags & _SUBWIN)) {
	/*
	 * Check if the new limits will fit into the parent window's size.  If
	 * not, do not resize.  We could adjust the location of the subwindow,
	 * but the application may not like that.
	 */
	if (win->_pary + ToLines > win->_parent->_maxy
	    || win->_parx + ToCols > win->_parent->_maxx) {
	    returnCode(ERR);
	}
	pline = win->_parent->_line;
    } else {
	pline = 0;
    }

    /*
     * Allocate new memory as needed.  Do the allocations without modifying
     * the original window, in case an allocation fails.  Always allocate
     * (at least temporarily) the array pointing to the individual lines.
     */
    new_lines = typeCalloc(struct ldat, (unsigned) (ToLines + 1));
    if (new_lines == 0)
	returnCode(ERR);

    /*
     * For each line in the target, allocate or adjust pointers for the
     * corresponding text, depending on whether this is a window or a
     * subwindow.
     */
    for (row = 0; row <= ToLines; ++row) {
	int begin = (row > size_y) ? 0 : (size_x + 1);
	int end = ToCols;
	NCURSES_CH_T *s;

	if (!(win->_flags & _SUBWIN)) {
	    if (row <= size_y) {
		if (ToCols != size_x) {
		    if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
			returnCode(cleanup_lines(new_lines, row));
		    for (col = 0; col <= ToCols; ++col) {
			s[col] = (col <= size_x
				  ? win->_line[row].text[col]
				  : win->_nc_bkgd);
		    }
		} else {
		    s = win->_line[row].text;
		}
	    } else {
		if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
		    returnCode(cleanup_lines(new_lines, row));
		for (col = 0; col <= ToCols; ++col)
		    s[col] = win->_nc_bkgd;
	    }
	} else {
	    s = &pline[win->_pary + row].text[win->_parx];
	}

	if_USE_SCROLL_HINTS(new_lines[row].oldindex = row);
	if (row <= size_y) {
	    new_lines[row].firstchar = win->_line[row].firstchar;
	    new_lines[row].lastchar = win->_line[row].lastchar;
	}
	if ((ToCols != size_x) || (row > size_y)) {
	    if (end >= begin) {	/* growing */
		if (new_lines[row].firstchar < begin)
		    new_lines[row].firstchar = begin;
	    } else {		/* shrinking */
		new_lines[row].firstchar = 0;
	    }
	    new_lines[row].lastchar = ToCols;
//.........这里部分代码省略.........
开发者ID:SylvestreG,项目名称:bitrig,代码行数:101,代码来源:wresize.c

示例5: _nc_wgetch

_nc_wgetch(WINDOW *win,
	   unsigned long *result,
	   int use_meta
	   EVENTLIST_2nd(_nc_eventlist * evl))
{
    int ch;
#ifdef NCURSES_WGETCH_EVENTS
    long event_delay = -1;
#endif

    T((T_CALLED("_nc_wgetch(%p)"), win));

    *result = 0;
    if (win == 0 || SP == 0)
	returnCode(ERR);

    if (cooked_key_in_fifo()) {
	if (wgetch_should_refresh(win))
	    wrefresh(win);

	*result = fifo_pull();
	returnCode(OK);
    }
#ifdef NCURSES_WGETCH_EVENTS
    if (evl && (evl->count == 0))
	evl = NULL;
    event_delay = _nc_eventlist_timeout(evl);
#endif

    /*
     * Handle cooked mode.  Grab a string from the screen,
     * stuff its contents in the FIFO queue, and pop off
     * the first character to return it.
     */
    if (head == -1 &&
	!SP->_notty &&
	!SP->_raw &&
	!SP->_cbreak &&
	!SP->_called_wgetch) {
	char buf[MAXCOLUMNS], *sp;
	int rc;

	TR(TRACE_IEVENT, ("filling queue in cooked mode"));

	SP->_called_wgetch = TRUE;
	rc = wgetnstr(win, buf, MAXCOLUMNS);
	SP->_called_wgetch = FALSE;

	/* ungetch in reverse order */
#ifdef NCURSES_WGETCH_EVENTS
	if (rc != KEY_EVENT)
#endif
	    ungetch('\n');
	for (sp = buf + strlen(buf); sp > buf; sp--)
	    ungetch(sp[-1]);

#ifdef NCURSES_WGETCH_EVENTS
	/* Return it first */
	if (rc == KEY_EVENT) {
	    *result = rc;
	    returnCode(OK);
	}
#endif

	*result = fifo_pull();
	returnCode(OK);
    }

    if (win->_use_keypad != SP->_keypad_on)
	_nc_keypad(win->_use_keypad);

    if (wgetch_should_refresh(win))
	wrefresh(win);

    if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
	int delay;

	TR(TRACE_IEVENT, ("timed delay in wgetch()"));
	if (SP->_cbreak > 1)
	    delay = (SP->_cbreak - 1) * 100;
	else
	    delay = win->_delay;

#ifdef NCURSES_WGETCH_EVENTS
	if (event_delay >= 0 && delay > event_delay)
	    delay = event_delay;
#endif

	TR(TRACE_IEVENT, ("delay is %d milliseconds", delay));

	if (head == -1) {	/* fifo is empty */
	    int rc = check_mouse_activity(delay EVENTLIST_2nd(evl));

#ifdef NCURSES_WGETCH_EVENTS
	    if (rc & 4) {
		*result = KEY_EVENT;
		returnCode(OK);
	    }
#endif
	    if (!rc)
//.........这里部分代码省略.........
开发者ID:enthought,项目名称:ncurses-5.5,代码行数:101,代码来源:lib_getch.c

示例6: _nc_hash_map

void _nc_hash_map(void)
{
    sym *sp;
    register int i;
    int start, shift, size;


    if (screen_lines > lines_alloc)
    {
	if (hashtab)
	    free (hashtab);
	hashtab = typeMalloc(sym, (screen_lines+1)*2);
	if (!hashtab)
	{
	    if (oldhash)
	    {
		FreeAndNull(oldhash);
	    }
	    lines_alloc = 0;
	    return;
	}
	lines_alloc = screen_lines;
    }

    if (oldhash && newhash)
    {
	/* re-hash only changed lines */
	for (i = 0; i < screen_lines; i++)
	{
	    if (PENDING(i))
		newhash[i] = hash(NEWTEXT(i));
	}
    }
    else
    {
	/* re-hash all */
	if (oldhash == 0)
	    oldhash = typeCalloc (unsigned long, screen_lines);
	if (newhash == 0)
	    newhash = typeCalloc (unsigned long, screen_lines);
	if (!oldhash || !newhash)
	    return; /* malloc failure */
	for (i = 0; i < screen_lines; i++)
	{
	    newhash[i] = hash(NEWTEXT(i));
	    oldhash[i] = hash(OLDTEXT(i));
	}
    }

#ifdef HASH_VERIFY
    for (i = 0; i < screen_lines; i++)
    {
	if(newhash[i] != hash(NEWTEXT(i)))
	    fprintf(stderr,"error in newhash[%d]\n",i);
	if(oldhash[i] != hash(OLDTEXT(i)))
	    fprintf(stderr,"error in oldhash[%d]\n",i);
    }
#endif

    /*
     * Set up and count line-hash values.
     */
    memset(hashtab, '\0', sizeof(*hashtab)*(screen_lines+1)*2);
    for (i = 0; i < screen_lines; i++)
    {
	unsigned long hashval = oldhash[i];

	for (sp = hashtab; sp->hashval; sp++)
	    if (sp->hashval == hashval)
		break;
	sp->hashval = hashval;	/* in case this is a new entry */
	sp->oldcount++;
	sp->oldindex = i;
    }
    for (i = 0; i < screen_lines; i++)
    {
	unsigned long hashval = newhash[i];

	for (sp = hashtab; sp->hashval; sp++)
	    if (sp->hashval == hashval)
		break;
	sp->hashval = hashval;	/* in case this is a new entry */
	sp->newcount++;
	sp->newindex = i;

	OLDNUM(i) = _NEWINDEX;	/* initialize old indices array */
    }

    /*
     * Mark line pairs corresponding to unique hash pairs.
     *
     * We don't mark lines with offset 0, because it can make fail
     * extending hunks by cost_effective. Otherwise, it does not
     * have any side effects.
     */
    for (sp = hashtab; sp->hashval; sp++)
	if (sp->oldcount == 1 && sp->newcount == 1
	    && sp->oldindex != sp->newindex)
	{
	    TR(TRACE_UPDATE | TRACE_MOVE,
//.........这里部分代码省略.........
开发者ID:christianrober,项目名称:R05R4-RC2,代码行数:101,代码来源:hashmap.c

示例7: group_fitrep

bool group_fitrep(WGroup *ws, WWindow *par, const WFitParams *fp)
{
    WGroupIterTmp tmp;
    WStacking *unweaved=NULL;
    int xdiff=0, ydiff=0;
    WStacking *st;
    WWindow *oldpar;
    WRectangle g;
    
    oldpar=REGION_PARENT(ws);
    
    if(par==NULL){
        if(fp->mode&REGION_FIT_WHATEVER)
            return TRUE;
        REGION_GEOM(ws)=fp->g;
    }else{
        if(!region_same_rootwin((WRegion*)ws, (WRegion*)par))
            return FALSE;
        
        if(ws->managed_stdisp!=NULL && ws->managed_stdisp->reg!=NULL)
            region_detach_manager(ws->managed_stdisp->reg);
        
        assert(ws->managed_stdisp==NULL);
        
        xdiff=fp->g.x-REGION_GEOM(ws).x;
        ydiff=fp->g.y-REGION_GEOM(ws).y;
    
        region_unset_parent((WRegion*)ws);
        XReparentWindow(ioncore_g.dpy, ws->dummywin, par->win, -1, -1);
        region_set_parent((WRegion*)ws, par);

        REGION_GEOM(ws).x=fp->g.x;
        REGION_GEOM(ws).y=fp->g.y;
        if(!(fp->mode&REGION_FIT_WHATEVER)){
            REGION_GEOM(ws).w=fp->g.w;
            REGION_GEOM(ws).h=fp->g.h;
        }
        
        if(oldpar!=NULL)
            unweaved=stacking_unweave(&oldpar->stacking, wsfilt, (void*)ws);
    }

    FOR_ALL_NODES_IN_GROUP(ws, st, tmp){
        WFitParams fp2=*fp;
        
        if(st->reg==NULL)
            continue;
        
        g=REGION_GEOM(st->reg);
        g.x+=xdiff;
        g.y+=ydiff;

        if(fp->mode&REGION_FIT_WHATEVER){
            fp2.g=g;
        }else{
            fp2.g=REGION_GEOM(ws);
            sizepolicy(&st->szplcy, st->reg, &g, REGION_RQGEOM_WEAK_ALL, &fp2);
        }
        
        if(!region_fitrep(st->reg, par, &fp2)){
            warn(TR("Error reparenting %s."), region_name(st->reg));
            region_detach_manager(st->reg);
        }
    }
开发者ID:gwash,项目名称:ion-3plus,代码行数:64,代码来源:group.c

示例8: addsubjectText

QString addsubjectText() { return TR("Click this button to add a <i>subject</i>."); }
开发者ID:SciBoy,项目名称:douml,代码行数:1,代码来源:UseCaseDiagramWindow.cpp

示例9: associationText

QString associationText() { return TR("Click this button to create an <i>association</i>"); }
开发者ID:SciBoy,项目名称:douml,代码行数:1,代码来源:UseCaseDiagramWindow.cpp

示例10: addusecaseText

QString addusecaseText() { return TR("Click this button to add an <i>use case</i> in the diagram. <br><br>"
				     "You can also drop the use case from the <b>browser</b>."); }
开发者ID:SciBoy,项目名称:douml,代码行数:2,代码来源:UseCaseDiagramWindow.cpp

示例11: addfragmentText

QString addfragmentText() { return TR("Click this button to add a <i>fragment</i>."); }
开发者ID:SciBoy,项目名称:douml,代码行数:1,代码来源:UseCaseDiagramWindow.cpp

示例12: addactorText

QString addactorText() { return TR("Click this button to add an <i>actor</i> in the diagram. <br><br>"
				   "You can also drop the class from the <b>browser</b>."); }
开发者ID:SciBoy,项目名称:douml,代码行数:2,代码来源:UseCaseDiagramWindow.cpp

示例13: fallback_warn

static void fallback_warn()
{
    put_prog_name();
    fprintf(stderr, TR("Oops. Error string compilation failed: %s"),
            strerror(errno));
}
开发者ID:JoeNotCharles,项目名称:notion,代码行数:6,代码来源:output.c

示例14: m

void UcClassCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  
  m.insertItem(new MenuTitle(browser_node->get_data()->definition(FALSE, TRUE), m.font()), -1);
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 8);
  m.insertItem(TR("Go down"), 9);
  m.insertSeparator();
  m.insertItem(TR("Add related elements"), 10);
  m.insertSeparator();
  m.insertItem(TR("Edit drawing settings"), 4);
  m.insertSeparator();
  if (browser_node->is_writable()) {
    m.insertItem(TR("Edit"), 7);
    m.insertSeparator();
  }
  m.insertItem(TR("Select in browser"),2);
  if (linked())
    m.insertItem(TR("Select linked items"), 3);
  m.insertSeparator();
  m.insertItem(TR("Remove from diagram"),5);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 6);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, UmlClass, 20))
    m.insertItem(TR("Tool"), &toolm);

  int rank = m.exec(QCursor::pos());
  
  switch (rank) {
  case 0:
    upper();
    hide();
    show();
    break;
  case 1:
    lower();
    hide();
    show();
    break;
  case 2:
    browser_node->select_in_browser();
    return;
  case 3:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 4:
    edit_drawing_settings();
    return;
  case 5:
    // remove from diagram
    delete_it();
    break;
  case 6:
    // delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  case 7:
    browser_node->open(TRUE);
    break;
  case 8:
    z_up();
    hide();
    show();
    break;
  case 9:
    z_down();
    hide();
    show();
    break;
  case 10:
    ((UmlCanvas *) canvas())->get_view()
      ->add_related_elements(this, TR("class/actor"), TRUE, FALSE);
    return;
  default:
    if (rank >= 20)
      ToolCom::run(Tool::command(rank - 20), browser_node);
    return;
  }
  
  package_modified();
}
开发者ID:kralf,项目名称:bouml,代码行数:86,代码来源:UcClassCanvas.cpp

示例15: Q3TabDialog

ActivityPartitionDialog::ActivityPartitionDialog(ActivityPartitionData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Activity Partition dialog"));

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = data->get_browser_node();
    Q3Grid * grid = new Q3Grid(2, this);

    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);

    new QLabel(TR("stereotype : "), grid);
    edstereotype = new Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserActivityPartition::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivityPartition));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    connect(new SmallPushButton(TR("represents :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_represents()));
    edrepresents = new Q3ComboBox(FALSE, grid);

    if ((data->represents != 0) && !data->represents->deletedp()) {
        represented = data->represents;
        edrepresents->insertItem(*(data->represents->pixmap(0)),
                                 data->represents->full_name(TRUE));
    }
    else {
        represented = 0;
        edrepresents->insertItem("");
    }

    if (! visit)
        edrepresents->insertItem("");

    edrepresents->setCurrentItem(0);
    edrepresents->setSizePolicy(sp);

    Q3HBox * htab;

    new QLabel(grid);
    htab = new Q3HBox(grid);
    new QLabel("  ", htab);
    dimension_cb = new QCheckBox(TR("is dimension"), htab);

    if (data->is_dimension)
        dimension_cb->setChecked(TRUE);

    dimension_cb->setDisabled(visit);
    new QLabel("", htab);
    external_cb = new QCheckBox(TR("is external"), htab);

    if (data->is_external)
        external_cb->setChecked(TRUE);

    external_cb->setDisabled(visit);
    new QLabel("", htab);

    Q3VBox * vtab = new Q3VBox(grid);
    new QLabel(TR("description :"), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_description()));

    comment = new MultiLineEdit(grid);
    comment->setReadOnly(visit);
    comment->setText(bn->get_comment());
    QFont font = comment->font();

    if (! hasCodec())
        font.setFamily("Courier");
//.........这里部分代码省略.........
开发者ID:harmegnies,项目名称:douml,代码行数:101,代码来源:ActivityPartitionDialog.cpp


注:本文中的TR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。