Exemple #1
0
void MainWidget::okData()
{
  if(RDModulesActive()) {
    QMessageBox::information(this,tr("RDSelect"),
			tr("One or more Rivendell modules are still open."));
    return;
  }

  if(!VerifyShutdown()) {
    return;
  }
  if(!Shutdown(select_current_id)) {
    SetSystem(-1);
    QMessageBox::warning(this,tr("RDSelect"),
			 tr("Unable to shutdown current configuration")+
			 "\n["+strerror(errno)+"].");
    return;
  }
  if(!Startup(select_box->currentItem())) {
    SetSystem(-1);
    QMessageBox::warning(this,tr("RDSelect"),
			 tr("Unable to start up new configuration"));
  }
  SetSystem(select_box->currentItem());
  exit(0);
}
/// Primary Constructor
/// @param system Zero-based index of the system where the alternate ending is anchored
/// @param position Zero-based index of the position within the system where the alternate ending is anchored
/// @param numbers Bits indicating which numbers are to be set (1st bit = 1., 2nd bit = 2., etc.)
AlternateEnding::AlternateEnding(wxUint32 system, wxUint32 position, wxWord numbers)
{
    //------Last Checked------//
    // - Dec 4, 2004
    SetSystem(system);
    SetPosition(position);
    SetNumbers(numbers);
}
bool ff::EntityDomain::AddSystem(std::shared_ptr<EntitySystemBase> system)
{
	assertRetVal(system != nullptr && system->GetDomain() == this, false);

	SystemEntry &systemEntry = _systems.Insert();
	SetSystem(systemEntry, system);

	return true;
}
Exemple #4
0
/// Primary Constructor
/// @param system Zero-based index of the system where the system symbol is
/// anchored
/// @param position Zero-based index of the position within the system where the
/// system symbol is anchored
/// @param data Data used by the symbol (the data format is dependant upon the
/// derived class)
SystemSymbol::SystemSymbol(wxUint32 system, wxUint32 position, wxUint32 data) :
    m_system(DEFAULT_SYSTEM), m_position(DEFAULT_POSITION), m_data(data)
{
    //------Last Checked------//
    // - Jan 13, 2005
    wxASSERT(IsValidSystem(system));
    wxASSERT(IsValidPosition(position));
    SetSystem(system);
    SetPosition(position);    
}
bool ChShaftsMotor::Initialize(std::shared_ptr<ChShaft> mshaft1, std::shared_ptr<ChShaft> mshaft2) {
    // Parent class initialize
    if (!ChShaftsMotorBase::Initialize(mshaft1, mshaft2))
        return false;

    ChShaft* mm1 = mshaft1.get();
    ChShaft* mm2 = mshaft2.get();

    constraint.SetVariables(&mm1->Variables(), &mm2->Variables());

    SetSystem(shaft1->GetSystem());

    return true;
}
Exemple #6
0
/// Primary Constructor
/// @param system Zero-based index of the system where the guitar in is anchored
/// @param staff Zero-based inded of the staff within the system where the
/// guitar in is anchored
/// @param position Zero-based index of the position within the system where the
/// guitar in is anchored
/// @param staffGuitars A bit map representing the guitars to set on the staff
/// (bit 1 = guitar 0, bit 2 = guitar 1, etc.)
/// @param rhythmSlashGuitars A bit map representing the guitars to set for the
/// rhythm slashes (bit 1 = guitar 0, bit 2 = guitar 1, etc.)
GuitarIn::GuitarIn(wxUint32 system, wxUint32 staff, wxUint32 position,
    wxByte staffGuitars, wxByte rhythmSlashGuitars) :
    m_system(DEFAULT_SYSTEM), m_staff(DEFAULT_STAFF),
    m_position(DEFAULT_POSITION), m_data(DEFAULT_DATA)
{
    //------Last Checked------//
    // - Jan 25, 2005
    wxASSERT(IsValidSystem(system));
    wxASSERT(IsValidStaff(staff));
    wxASSERT(IsValidPosition(position));
    SetSystem(system);
    SetStaff(staff);
    SetPosition(position);
    SetStaffGuitars(staffGuitars);
    SetRhythmSlashGuitars(rhythmSlashGuitars);
}
Exemple #7
0
System::System(StarType star, const std::map<int, bool>& lanes_and_holes,
               const std::string& name, double x, double y) :
    UniverseObject(name, x, y),
    m_star(star),
    m_starlanes_wormholes(lanes_and_holes),
    m_last_turn_battle_here(INVALID_GAME_TURN),
    m_overlay_texture(),
    m_overlay_size(1.0)
{
    m_orbits.assign(SYSTEM_ORBITS, INVALID_OBJECT_ID);

    //Logger().debugStream() << "System::System(" << star << ", " << orbits << ", (StarlaneMap), " << name << ", " << x << ", " << y << ")";
    if (m_star < INVALID_STAR_TYPE || NUM_STAR_TYPES < m_star)
        throw std::invalid_argument("System::System : Attempted to create a system \"" +
                                    Name() + "\" with an invalid star type.");

    m_orbits.assign(SYSTEM_ORBITS, INVALID_OBJECT_ID);

    SetSystem(ID());

    UniverseObject::Init();
}
void
MsnEditNavDlg::ScrapeForm()
{
	if (mission) {
		if (txt_name) {
			mission->SetName(txt_name->GetText());
		}

		if (cmb_type) {
			mission->SetType(cmb_type->GetSelectedIndex());

			if (mission_info)
			mission_info->type = cmb_type->GetSelectedIndex();
		}

		Galaxy*     galaxy = Galaxy::GetInstance();
		StarSystem* system = 0;

		if (galaxy)
		system = galaxy->GetSystem(cmb_system->GetSelectedItem());

		if (cmb_system && system) {
			mission->ClearSystemList();
			mission->SetStarSystem(system);

			if (mission_info)
			mission_info->system = system->Name();
		}

		if (cmb_region) {
			mission->SetRegion(cmb_region->GetSelectedItem());

			if (mission_info)
			mission_info->region = cmb_region->GetSelectedItem();
		}

		SetSystem(system);
	}
}
void CParticleSystemInstanceHandle::SetSystem(const tstring& sSystem, Vector vecOrigin)
{
	SetSystem(CParticleSystemLibrary::Get()->FindParticleSystem(sSystem), vecOrigin);
}
Exemple #10
0
MainWidget::MainWidget(QWidget *parent,const char *name)
  :QWidget(parent,name)
{
  //
  // Read Command Options
  //
  RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdselect","\n");
  delete cmd;

  //
  // Read Configuration
  //
  monitor_config=new RDMonitorConfig();
  monitor_config->load();
  QDesktopWidget *dw=qApp->desktop();
  int width=sizeHint().width();
  int height=sizeHint().height();
  switch(monitor_config->position()) {
  case RDMonitorConfig::UpperLeft:
    setGeometry(0,RDMONITOR_HEIGHT,width,sizeHint().height());
    break;

  case RDMonitorConfig::UpperCenter:
    setGeometry((dw->size().width()-width)/2,RDMONITOR_HEIGHT,width,height);
    break;

  case RDMonitorConfig::UpperRight:
    setGeometry(dw->size().width()-width,RDMONITOR_HEIGHT,width,height);
    break;

  case RDMonitorConfig::LowerLeft:
    setGeometry(0,dw->size().height()-height+RDMONITOR_HEIGHT,width,height);
    break;

  case RDMonitorConfig::LowerCenter:
    setGeometry((dw->size().width()-width)/2,
		dw->size().height()-height+RDMONITOR_HEIGHT,width,height);
    break;

  case RDMonitorConfig::LowerRight:
    setGeometry(dw->size().width()-width,
		dw->size().height()-height+RDMONITOR_HEIGHT,width,height);
    break;

  case RDMonitorConfig::LastPosition:
    break;
  }

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont default_font("Helvetica",12,QFont::Normal);
  default_font.setPixelSize(12);
  qApp->setFont(default_font);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",16,QFont::Bold);
  label_font.setPixelSize(16);

  //
  // Create And Set Icons
  //
  login_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*login_rivendell_map);
  setCaption(tr("RDSelect")+" v"+VERSION);
  greencheckmark_map=new QPixmap(greencheckmark_xpm);
  redx_map=new QPixmap(redx_xpm);

  //
  // Load Configs
  //
  select_current_id=-1;
  char target[1500];
  ssize_t n;
  if((n=readlink(RD_CONF_FILE,target,1500))>0) {
    target[n]=0;
  }
  else {
    target[0]=0;
  }
  QDir config_dir(RD_DEFAULT_RDSELECT_DIR);
  config_dir.setFilter(QDir::Files|QDir::Readable);
  config_dir.setNameFilter("*.conf");
  select_filenames=config_dir.entryList();
  for(unsigned i=0;i<select_filenames.size();i++) {
    select_filenames[i]=
      QString(RD_DEFAULT_RDSELECT_DIR)+"/"+select_filenames[i];
    if(select_filenames[i]==target) {
      select_current_id=i;
    }
    select_configs.push_back(new RDConfig());
    select_configs.back()->setFilename(select_filenames[i]);
    select_configs.back()->load();
  }

  //
  // Current System Label
  //
  select_current_label=new QLabel(this);
  select_current_label->setFont(label_font);
  select_current_label->setAlignment(AlignCenter);

  //
  // Selector Box
  //
  select_box=new QListBox(this);
  select_box->setFont(default_font);
  connect(select_box,SIGNAL(doubleClicked(QListBoxItem *)),
	  this,SLOT(doubleClickedData(QListBoxItem *)));
  for(unsigned i=0;i<select_configs.size();i++) {
    select_box->insertItem(select_configs[i]->label());
  }
  select_label=new QLabel(select_box,tr("Available Systems"),this);
  select_label->setFont(button_font);

  //
  // Ok Button
  //
  ok_button=new QPushButton(this);
  ok_button->setFont(button_font);
  ok_button->setText(tr("Select"));
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  // Cancel Button
  //
  cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setFont(button_font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  SetSystem(select_current_id);
  SetCurrentItem(select_current_id);
  select_box->clearSelection();

  //
  // Check for Root User 
  //

  setuid(geteuid());  // So the SETUID bit works as expected
  if(getuid()!=0) {
    QMessageBox::information(this,tr("RDSelect"),
			     tr("Only root can run this utility!"));
    exit(256);
  }
}