static int pkg_fire(dialogMenuItem *self) { int ret; ListPtrsPtr lists = (ListPtrsPtr)self->aux; PkgNodePtr sp, kp = self->data, plist = lists->plist; if (!plist) ret = DITEM_FAILURE; else if (kp->type == PACKAGE) { IndexEntryPtr ie = kp->data; sp = index_search(plist, kp->name, NULL); /* Not already selected? */ if (!sp) { if (!ie->installed) { PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode)); *np = *kp; np->next = plist->kids; plist->kids = np; index_recorddeps(TRUE, lists->root, ie); msgInfo("Added %s to selection list", kp->name); } else if (ie->depc == 0) { if (!msgNoYes("Do you really want to delete %s from the system?", kp->name)) { if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) { msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name); } else { ie->installed = 0; index_recorddeps(FALSE, lists->root, ie); } } } else msgConfirm("Warning: Package %s is needed by\n %d other installed package%s.", kp->name, ie->depc, (ie->depc != 1) ? "s" : ""); } else { index_recorddeps(FALSE, lists->root, ie); msgInfo("Removed %s from selection list", kp->name); index_delete(sp); } ret = DITEM_SUCCESS; /* Mark menu for redraw if we had dependencies */ if (strlen(ie->deps) > 0) ret |= DITEM_REDRAW; } else { /* Not a package, must be a directory */ int p, s; p = s = 0; index_menu(lists->root, kp, plist, &p, &s); ret = DITEM_SUCCESS | DITEM_CONTINUE; } return ret; }
static void set_lineStyle(GIFmetafile *meta, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.type) return; if (type == GBUNDLED){ attr = meta->ws->lnbundl_table[attr].type; } msgInfo("set_lineStyle: setting style to %d\n", attr); if (attr <= 0 || attr > 4) attr = 1; meta->styleIndex = attr; { int currColor = meta->lineIndex; int i, length; char *cp = LineStyles[attr]; length = strlen(cp); assert(currColor != -1); if (meta->style) free(meta->style); meta->style = (int *)umalloc(sizeof(int) * MaxLineStyleLength); length = strlen(LineStyles[attr]); for (i=0; i < length; ++i){ if (cp[i] == '-'){ meta->style[i] = currColor; } else { meta->style[i] = gdTransparent; } } gdImageSetStyle(meta->image, meta->style, length); } }
static void set_fillColor(GIFmetafile *meta, Gint attr) { GIFcolor *color = &meta->colors[attr]; meta->fillIndex = color->index; msgInfo("set_fillColor: setting color to (%f,%f,%f)\n", color->r, color->g, color->b); }
/* Put up a message in an input box and return the value */ char * msgGetInput(char *buf, const char *fmt, ...) { va_list args; char *errstr; static char input_buffer[256]; int rval; WINDOW *w = savescr(); errstr = (char *)alloca(FILENAME_MAX); va_start(args, fmt); vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); use_helpline(NULL); use_helpfile(NULL); if (buf) SAFE_STRCPY(input_buffer, buf); else input_buffer[0] = '\0'; if (OnVTY) { ioctl(0, VT_ACTIVATE, 1); /* Switch back */ msgInfo(NULL); } rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer); restorescr(w); if (!rval) return input_buffer; else return NULL; }
int GIFsetColRep(Metafile *mf, int num, Gint idx, Gcobundl *rep) { Gint status = 1; int imf; mf_cgmo **cgmo = &mf->cgmo; for (imf = 0; imf < num; ++imf) { float r = rep->red, g = rep->green, b = rep->blue; GIFmetafile *meta = find_meta(cgmo[imf]); int gindex; assert(meta); /* Do the color allocation -- background color */ /* can't be reset */ if (idx > 0 && (gindex = allocate_color(meta, idx, r, g, b)) == -1){ msgWarn("GIFsetColRep : Can't allocate color (%f, %f, %f)\n", r, g, b); } else { msgInfo("GIFsetColRep: assigning color (%f, %f, %f) to GKS %d GIF %d\n", r, g, b, idx, gindex); status = OK; } } return status; }
static void pkg_selected(dialogMenuItem *self, int is_selected) { PkgNodePtr kp = self->data; if (!is_selected || kp->type != PACKAGE) return; msgInfo("%s", kp->desc); }
void GIFresize(WS_STATE_PTR ws, Gpoint size) { mf_cgmo *cgmo = ws->mf.cgmo; GIFmetafile *meta = find_meta(cgmo); assert(meta); #if 0 if (meta->resize == 0){ msgErr("GIFresize: metafile contains primitives -- can't resize\n"); } else { copy_meta(cgmo, find_meta(cgmo), size.x, size.y); msgInfo("GIFresize: Resizing to (%f,%f)\n", size.x, size.y); } #endif if (meta->resize == 0){ msgWarn("GIFresize: metafile contains primitives that will be lost when resizing\n"); } copy_meta(cgmo, find_meta(cgmo), size.x, size.y); msgInfo("GIFresize: Resizing to (%f,%f)\n", size.x, size.y); }
/* * Set the text representation in an output GIF file. */ int GIFsetTextRep(Metafile *mf, int num, Gint idx, Gtxbundl *rep) { if (!rep) return 1; msgInfo("GIFsetTextRep: index %d font prec (%d %d) exp %.6f sp %.6f color %d\n", idx, rep->fp.font, rep->fp.prec, rep->ch_exp, rep->space, rep->colour); return OK; }
static void set_lineColor(mf_cgmo *cgmo, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.colour) return; if (type == GBUNDLED){ attr = cgmo->ws->lnbundl_table[attr].colour; } msgInfo("set_lineColor: setting color index to %d\n", attr); VCS2CAIRO_setrgb(cgmo->ws->cr,attr); /* fprintf(cgmo->fp, "/%s %d def\n", LINECOLOR, attr); */ }
static void set_lineStyle(mf_cgmo *cgmo, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.type) return; if (type == GBUNDLED){ attr = cgmo->ws->lnbundl_table[attr].type; } double dashes[4]; int ndashes,i; msgInfo("set_lineStyle: setting style to %d\n", attr); switch(attr){ case 1: ndashes=0; dashes[0]=1.; dashes[1]=0.; break; case 2: ndashes=2; dashes[0]=8.; dashes[1]=8.; break; case 3: ndashes=2; dashes[0]=4.; dashes[1]=4.; break; case 4: ndashes=4; dashes[0]=8.; dashes[1]=4.; dashes[2]=4.; dashes[3]=4.; break; case -3: ndashes=2; dashes[0]=16.; dashes[1]=16.; break; default: ndashes=1; dashes[0]=1.; break; } extern int YW; for (i=0;i<ndashes;i++) dashes[i]=dashes[i]*(float)YW/792.; cairo_set_dash(cgmo->ws->cr,dashes,ndashes,0.); #ifdef GENCAIRO printf("ndashes=%i;\n",ndashes); for (i=0;i<ndashes;i++) printf("dashes[%i]=%i;\n",i,dashes[i]); printf("cairo_set_dash(cr,dashes,ndashes,0.);\n"); #endif }
static void set_lineWidth(GIFmetafile *meta, double size, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.width) return; if (type == GBUNDLED){ int index = attr; size = meta->ws->lnbundl_table[index].width; } msgInfo("set_lineWidth: setting width to %lf\n", size); if (size < 1.0) size = 1.0; meta->lineWidth = size +.5; }
static void set_lineColor(GIFmetafile *meta, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.colour) return; if (type == GBUNDLED){ attr = meta->ws->lnbundl_table[attr].colour; } { GIFcolor *color = &meta->colors[attr]; msgInfo("set_lineColor: setting color to (%f,%f,%f)\n", color->r, color->g, color->b); meta->lineIndex = color->index; set_lineStyle(meta, meta->styleIndex, type); } }
static void handle_intr(int sig) { WINDOW *save = savescr(); use_helpline(NULL); use_helpfile(NULL); if (OnVTY) { ioctl(0, VT_ACTIVATE, 1); /* Switch back */ msgInfo(NULL); } (void)dialog_menu("Installation interrupt", "Do you want to abort the installation?", -1, -1, 2, -2, intrmenu, NULL, NULL, NULL); restorescr(save); }
/* Put up a message in a popup confirmation box */ void msgConfirm(const char *fmt, ...) { va_list args; char *errstr; WINDOW *w = savescr(); errstr = (char *)alloca(FILENAME_MAX); va_start(args, fmt); vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); use_helpline(NULL); use_helpfile(NULL); if (OnVTY) { ioctl(0, VT_ACTIVATE, 1); msgInfo(NULL); } dialog_notify(errstr); restorescr(w); }
static void set_lineWidth(mf_cgmo *cgmo, double size, Gint attr, Gasf type) { if (type != xgks_state.gks_lnattr.width) return; if (type == GBUNDLED){ size = cgmo->ws->lnbundl_table[attr].width; } msgInfo("set_lineWidth: setting width to %lf\n", size); extern int YW; cairo_set_line_width(cgmo->ws->cr,(int)size*(float)YW/792.*.5); //cairo_set_line_width(cgmo->ws->cr,1.); #ifdef GENCAIRO printf("cairo_set_line_width(cr,%f*(float)%i/792.*.5);\n",size,YW); #endif /* if (size < 1.0) */ /* size = 1.0; */ /* size *= 0.5; */ /* fprintf(cgmo->fp, "/%s %.6lf def\n", LINEWIDTHSCALE, size); */ }
/* Put up a message in a popup no/yes box and return 0 for YES, 1 for NO */ int msgNoYes(const char *fmt, ...) { va_list args; char *errstr; int ret; WINDOW *w = savescr(); errstr = (char *)alloca(FILENAME_MAX); va_start(args, fmt); vsnprintf(errstr, FILENAME_MAX, fmt, args); va_end(args); use_helpline(NULL); use_helpfile(NULL); if (OnVTY) { ioctl(0, VT_ACTIVATE, 1); /* Switch back */ msgInfo(NULL); } if (variable_get(VAR_NONINTERACTIVE)) return 1; /* If non-interactive, return NO all the time */ ret = dialog_noyes("User Confirmation Requested", errstr, -1, -1); restorescr(w); return ret; }
void METHOD_MESSAGE_SEND::execute(xmlrpc_c::paramList const & paramList, xmlrpc_c::value * const retvalPtr) { std::string cookie = paramList.getString(0); std::vector<xmlrpc_c::value> logins(paramList.getArray(1)); std::map<std::string, xmlrpc_c::value> msgInfo(paramList.getStruct(2)); paramList.verifyEnd(3); ADMIN_INFO adminInfo; if (config->GetAdminInfo(cookie, &adminInfo)) { *retvalPtr = xmlrpc_c::value_boolean(false); return; } STG_MSG message; std::map<std::string, xmlrpc_c::value>::iterator it; if ((it = msgInfo.find("version")) == msgInfo.end()) { message.header.ver = 1; // Default value } else { message.header.ver = xmlrpc_c::value_int(it->second); } if ((it = msgInfo.find("type")) == msgInfo.end()) { message.header.type = 1; // default value } else { message.header.type = xmlrpc_c::value_int(it->second); } if ((it = msgInfo.find("repeat")) == msgInfo.end()) { *retvalPtr = xmlrpc_c::value_boolean(false); return; } message.header.repeat = xmlrpc_c::value_int(it->second); if ((it = msgInfo.find("repeat_period")) == msgInfo.end()) { *retvalPtr = xmlrpc_c::value_boolean(false); return; } message.header.repeatPeriod = xmlrpc_c::value_int(it->second); if ((it = msgInfo.find("show_time")) == msgInfo.end()) { *retvalPtr = xmlrpc_c::value_boolean(false); return; } message.header.showTime = xmlrpc_c::value_int(it->second); if ((it = msgInfo.find("text")) == msgInfo.end()) { *retvalPtr = xmlrpc_c::value_boolean(false); return; } message.text = IconvString(xmlrpc_c::value_string(it->second), "UTF-8", "CP1251"); message.header.creationTime = static_cast<int>(stgTime); message.header.lastSendTime = 0; std::vector<xmlrpc_c::value>::iterator lit; for (lit = logins.begin(); lit != logins.end(); ++lit) { USER_PTR ui; if (users->FindByName(xmlrpc_c::value_string(*lit), &ui)) { printfd(__FILE__, "METHOD_MESSAGE_SEND::execute(): 'User '%s' not found'\n", std::string(xmlrpc_c::value_string(*lit)).c_str()); } else { ui->AddMessage(&message); } } *retvalPtr = xmlrpc_c::value_boolean(true); }
void AtlantikNetwork::processNode(QDomNode n) { QDomAttr a; for ( ; !n.isNull() ; n = n.nextSibling() ) { QDomElement e = n.toElement(); if(!e.isNull()) { if (e.tagName() == "server") { a = e.attributeNode( QString("version") ); if ( !a.isNull() ) m_serverVersion = a.value(); emit receivedHandshake(); } else if (e.tagName() == "msg") { a = e.attributeNode(QString("type")); if (!a.isNull()) { if (a.value() == "error") emit msgError(e.attributeNode(QString("value")).value()); else if (a.value() == "info") emit msgInfo(e.attributeNode(QString("value")).value()); else if (a.value() == "chat") emit msgChat(e.attributeNode(QString("author")).value(), e.attributeNode(QString("value")).value()); } } else if (e.tagName() == "display") { int estateId = -1; a = e.attributeNode(QString("estateid")); if (!a.isNull()) { estateId = a.value().toInt(); Estate *estate; estate = m_atlanticCore->findEstate(a.value().toInt()); emit displayDetails(e.attributeNode(QString("text")).value(), e.attributeNode(QString("cleartext")).value().toInt(), e.attributeNode(QString("clearbuttons")).value().toInt(), estate); bool hasButtons = false; for( QDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() ) { QDomElement eButton = nButtons.toElement(); if (!eButton.isNull() && eButton.tagName() == "button") { emit addCommandButton(eButton.attributeNode(QString("command")).value(), eButton.attributeNode(QString("caption")).value(), eButton.attributeNode(QString("enabled")).value().toInt()); hasButtons = true; } } if (!hasButtons) emit addCloseButton(); } } else if (e.tagName() == "client") { a = e.attributeNode(QString("playerid")); if (!a.isNull()) m_playerId = a.value().toInt(); a = e.attributeNode(QString("cookie")); if (!a.isNull()) emit clientCookie(a.value()); } else if (e.tagName() == "configupdate") { int configId = -1; a = e.attributeNode(QString("configid")); if (!a.isNull()) { configId = a.value().toInt(); ConfigOption *configOption; if (!(configOption = m_atlanticCore->findConfigOption(configId))) configOption = m_atlanticCore->newConfigOption( configId ); a = e.attributeNode(QString("name")); if (configOption && !a.isNull()) configOption->setName(a.value()); a = e.attributeNode(QString("description")); if (configOption && !a.isNull()) configOption->setDescription(a.value()); a = e.attributeNode(QString("edit")); if (configOption && !a.isNull()) configOption->setEdit(a.value().toInt()); a = e.attributeNode(QString("value")); if (configOption && !a.isNull()) configOption->setValue(a.value()); if (configOption) configOption->update(); } int gameId = -1; a = e.attributeNode(QString("gameid")); if (!a.isNull()) { gameId = a.value().toInt(); for( QDomNode nOptions = n.firstChild() ; !nOptions.isNull() ; nOptions = nOptions.nextSibling() ) { QDomElement eOption = nOptions.toElement(); if (!eOption.isNull() && eOption.tagName() == "option") emit gameOption(eOption.attributeNode(QString("title")).value(), eOption.attributeNode(QString("type")).value(), eOption.attributeNode(QString("value")).value(), eOption.attributeNode(QString("edit")).value(), eOption.attributeNode(QString("command")).value()); } emit endConfigUpdate(); } } else if (e.tagName() == "deletegame") { a = e.attributeNode(QString("gameid")); if (!a.isNull()) { int gameId = a.value().toInt(); Game *game = m_atlanticCore->findGame(gameId); if (game) m_atlanticCore->removeGame(game); } } else if (e.tagName() == "gameupdate") { int gameId = -1; a = e.attributeNode(QString("gameid")); if (!a.isNull()) { gameId = a.value().toInt(); Player *playerSelf = m_atlanticCore->playerSelf(); if ( playerSelf && playerSelf->game() ) kdDebug() << "gameupdate for " << QString::number(gameId) << " with playerSelf in game " << QString::number(playerSelf->game()->id()) << endl; else kdDebug() << "gameupdate for " << QString::number(gameId) << endl; Game *game = 0; if (gameId == -1) { a = e.attributeNode(QString("gametype")); if ( !a.isNull() && !(game = m_atlanticCore->findGame(a.value())) ) game = m_atlanticCore->newGame(gameId, a.value()); } else if (!(game = m_atlanticCore->findGame(gameId))) game = m_atlanticCore->newGame(gameId); a = e.attributeNode(QString("canbejoined")); if (game && !a.isNull()) game->setCanBeJoined(a.value().toInt()); a = e.attributeNode(QString("description")); if (game && !a.isNull()) game->setDescription(a.value()); a = e.attributeNode(QString("name")); if (game && !a.isNull()) game->setName(a.value()); a = e.attributeNode(QString("players")); if (game && !a.isNull()) game->setPlayers(a.value().toInt()); a = e.attributeNode(QString("master")); if (game && !a.isNull()) { // Ensure setMaster succeeds by creating player if necessary Player *player = m_atlanticCore->findPlayer( a.value().toInt() ); if ( !player ) player = m_atlanticCore->newPlayer( a.value().toInt() ); game->setMaster( player ); } QString status = e.attributeNode(QString("status")).value(); if ( m_serverVersion.left(4) == "0.9." || (playerSelf && playerSelf->game() == game) ) { if (status == "config") emit gameConfig(); else if (status == "init") emit gameInit(); else if (status == "run") emit gameRun(); else if (status == "end") emit gameEnd(); } if (game) game->update(); } } else if (e.tagName() == "deleteplayer") { a = e.attributeNode(QString("playerid")); if (!a.isNull()) { int playerId = a.value().toInt(); Player *player = m_atlanticCore->findPlayer(playerId); if (player) m_atlanticCore->removePlayer(player); } } else if (e.tagName() == "playerupdate") { int playerId = -1; a = e.attributeNode(QString("playerid")); if (!a.isNull()) { playerId = a.value().toInt(); Player *player; if (!(player = m_atlanticCore->findPlayer(playerId))) player = m_atlanticCore->newPlayer( playerId, (m_playerId == playerId) ); // Update player name a = e.attributeNode(QString("name")); if (player && !a.isNull()) player->setName(a.value()); // Update player game a = e.attributeNode(QString("game")); if (player && !a.isNull()) { int gameId = a.value().toInt(); if (gameId == -1) player->setGame( 0 ); else { // Ensure setGame succeeds by creating game if necessary Game *game = m_atlanticCore->findGame(a.value().toInt()); if (!game) game = m_atlanticCore->newGame(a.value().toInt()); // player->setGame( game ); } } // Update player host a = e.attributeNode(QString("host")); if (player && !a.isNull()) player->setHost(a.value()); // Update player image/token a = e.attributeNode(QString("image")); if (player && !a.isNull()) player->setImage(a.value()); // Update player money a = e.attributeNode(QString("money")); if (player && !a.isNull()) player->setMoney(a.value().toInt()); a = e.attributeNode(QString("bankrupt")); if (player && !a.isNull()) player->setBankrupt(a.value().toInt()); a = e.attributeNode(QString("hasdebt")); if (player && !a.isNull()) player->setHasDebt(a.value().toInt()); a = e.attributeNode(QString("hasturn")); if (player && !a.isNull()) player->setHasTurn(a.value().toInt()); // Update whether player can roll a = e.attributeNode(QString("can_roll")); if (player && !a.isNull()) player->setCanRoll(a.value().toInt()); // Update whether player can buy a = e.attributeNode(QString("can_buyestate")); if (player && !a.isNull()) player->setCanBuy(a.value().toInt()); // Update whether player can auction a = e.attributeNode(QString("canauction")); if (player && !a.isNull()) player->setCanAuction(a.value().toInt()); // Update whether player can use a card a = e.attributeNode(QString("canusecard")); if (player && !a.isNull()) player->setCanUseCard(a.value().toInt()); // Update whether player is jailed a = e.attributeNode(QString("jailed")); if (player && !a.isNull()) { player->setInJail(a.value().toInt()); // TODO: emit signal with player ptr so board can setText and display something } // Update player location a = e.attributeNode(QString("location")); if (!a.isNull()) { m_playerLocationMap[player] = a.value().toInt(); bool directMove = false; Estate *estate = m_atlanticCore->findEstate(a.value().toInt()); a = e.attributeNode(QString("directmove")); if (!a.isNull()) directMove = a.value().toInt(); if (player && estate) { if (directMove) player->setLocation(estate); else player->setDestination(estate); } } if (player) player->update(); } } else if (e.tagName() == "estategroupupdate") { a = e.attributeNode(QString("groupid")); if (!a.isNull()) { int groupId = a.value().toInt(); EstateGroup *estateGroup = 0; bool b_newEstateGroup = false; if (!(estateGroup = m_atlanticCore->findEstateGroup(groupId))) { // Create EstateGroup object estateGroup = m_atlanticCore->newEstateGroup(a.value().toInt()); b_newEstateGroup = true; } a = e.attributeNode(QString("name")); if (estateGroup && !a.isNull()) estateGroup->setName(a.value()); // Emit signal so GUI implementations can create view(s) // TODO: port to atlanticcore and create view there if (estateGroup) { if (b_newEstateGroup) emit newEstateGroup(estateGroup); estateGroup->update(); } } } else if (e.tagName() == "estateupdate") { int estateId = -1; a = e.attributeNode(QString("estateid")); if (!a.isNull()) { estateId = a.value().toInt(); Estate *estate = 0; bool b_newEstate = false; // FIXME: allow any estateId, GUI should not use it to determin its geometry if (estateId >= 0 && estateId < 100 && !(estate = m_atlanticCore->findEstate(a.value().toInt()))) { // Create estate object estate = m_atlanticCore->newEstate(estateId); b_newEstate = true; QObject::connect(estate, SIGNAL(estateToggleMortgage(Estate *)), this, SLOT(estateToggleMortgage(Estate *))); QObject::connect(estate, SIGNAL(estateHouseBuy(Estate *)), this, SLOT(estateHouseBuy(Estate *))); QObject::connect(estate, SIGNAL(estateHouseSell(Estate *)), this, SLOT(estateHouseSell(Estate *))); QObject::connect(estate, SIGNAL(newTrade(Player *)), this, SLOT(newTrade(Player *))); // Players without estate should get one Player *player = 0; QPtrList<Player> playerList = m_atlanticCore->players(); for (QPtrListIterator<Player> it(playerList); (player = *it) ; ++it) if (m_playerLocationMap[player] == estate->id()) player->setLocation(estate); } a = e.attributeNode(QString("name")); if (estate && !a.isNull()) estate->setName(a.value()); a = e.attributeNode(QString("color")); if (estate && !a.isNull() && !a.value().isEmpty()) estate->setColor(a.value()); a = e.attributeNode(QString("bgcolor")); if (estate && !a.isNull()) estate->setBgColor(a.value()); a = e.attributeNode(QString("owner")); Player *player = m_atlanticCore->findPlayer(a.value().toInt()); if (estate && !a.isNull()) estate->setOwner(player); a = e.attributeNode(QString("houses")); if (estate && !a.isNull()) estate->setHouses(a.value().toInt()); a = e.attributeNode(QString("mortgaged")); if (estate && !a.isNull()) estate->setIsMortgaged(a.value().toInt()); a = e.attributeNode(QString("group")); if (!a.isNull()) { EstateGroup *estateGroup = m_atlanticCore->findEstateGroup(a.value().toInt()); if (estate) estate->setEstateGroup(estateGroup); } a = e.attributeNode(QString("can_toggle_mortgage")); if (estate && !a.isNull()) estate->setCanToggleMortgage(a.value().toInt()); a = e.attributeNode(QString("can_be_owned")); if (estate && !a.isNull()) estate->setCanBeOwned(a.value().toInt()); a = e.attributeNode(QString("can_buy_houses")); if (estate && !a.isNull()) estate->setCanBuyHouses(a.value().toInt()); a = e.attributeNode(QString("can_sell_houses")); if (estate && !a.isNull()) estate->setCanSellHouses(a.value().toInt()); a = e.attributeNode(QString("price")); if (estate && !a.isNull()) estate->setPrice(a.value().toInt()); a = e.attributeNode(QString("houseprice")); if (estate && !a.isNull()) estate->setHousePrice(a.value().toInt()); a = e.attributeNode(QString("sellhouseprice")); if (estate && !a.isNull()) estate->setHouseSellPrice(a.value().toInt()); a = e.attributeNode(QString("mortgageprice")); if (estate && !a.isNull()) estate->setMortgagePrice(a.value().toInt()); a = e.attributeNode(QString("unmortgageprice")); if (estate && !a.isNull()) estate->setUnmortgagePrice(a.value().toInt()); a = e.attributeNode(QString("money")); if (estate && !a.isNull()) estate->setMoney(a.value().toInt()); // Emit signal so GUI implementations can create view(s) // TODO: port to atlanticcore and create view there if (estate) { if (b_newEstate) emit newEstate(estate); estate->update(); } } }
void AppWin::compareDisp() { QString item,cstr; int i, pos, p1, p2, n, d, comp, idx; bool ok, comparable; Ui::DCompareDisp ui; QDialog *dialog = new QDialog; ui.setupUi(dialog); // set up the data for (i=0; i<tabWidget->count(); i++) { item = plotWidget[i]->FName; // only the file name is printed item = QDir::current().relativeFilePath(item); ui.plot1->addItem(item); ui.plot2->addItem(item); } dialog->exec(); ok = dialog->result()==QDialog::Accepted; if (ok) { p1 = ui.plot1->currentRow(); p2 = ui.plot2->currentRow(); if (p1==p2) { msgInfo(info_CompareSamePlots); return; } comp = EDGE * ui.compEdge->isChecked() + SCREW * ui.compScrew->isChecked(); if (comp==EDGE) cstr = QString(" (edge)"); else cstr = QString(" (screw)"); // create a new widget PltWin *pw = new PltWin(tabWidget); *pw = *plotWidget[p1]; // set the plot-specific parameters if (comp==EDGE) pw->DispComponent = DIFF_EDGE; else if (comp==SCREW) pw->DispComponent = DIFF_SCREW; pw->FName = tabWidget->tabText(p1) + " (-) " + tabWidget->tabText(p2) + cstr.toLatin1().data(); comparable = pw->CompareDisp(plotWidget[p2], comp); if (!comparable) { delete(pw); msgError(err_CannotComparePlots); return; } plotWidget.append(pw); tabWidget->addTab(pw, pw->FName); tabWidget->setCurrentIndex(tabWidget->count()-1); tabWidget->show(); idx = tabWidget->currentIndex(); actFirstPlot->setEnabled(idx > 0); actPrevPlot->setEnabled(idx > 0); actNextPlot->setEnabled(idx < tabWidget->count()-1); actLastPlot->setEnabled(idx < tabWidget->count()-1); repaintStatusBar(); } }