Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
//! 
//-----------------------------------------------------------------------------
QVariant tAlarmEventListModel::data( const QModelIndex& index, int role ) const
{
    if( !index.isValid() || (index.row() >= m_LogList.size()) )
    {
        return QVariant();
    }

    const tAlarmEvent& alarmEvent = m_LogList.at( index.row() );

    if( role == Qt::DisplayRole )
    {
        switch (index.column())
        {
        case eCol_Name:    return alarmEvent.name;
        case eCol_Action:  return ActionName( alarmEvent.action );
        //case eCol_Desc:  return alarmEvent.description;
        case eCol_Time:
            {
                tSystemSettings* pSystemSettings = tSystemSettings::Instance();
                QString dateFormat = pSystemSettings->DateFormatString();
                if (m_SmallScreen)
                    dateFormat.replace( "yyyy", ("yy") );

                const QString timeString = alarmEvent.timestamp.toString( pSystemSettings->TimeFormatString() );
                const QString dateString = alarmEvent.timestamp.toString( dateFormat ); 
                return QString( m_TimeFormat ).arg( timeString ).arg( dateString );
            }
        default:
            break;
        }
    }
    return QVariant();
}
Ejemplo n.º 2
0
ButtonSelectionDialog::ButtonSelectionDialog(int actionNumber_){
	actionNumber = actionNumber_;
	buttonReader = JoystickSingleton::Instance().CreateReader();
	buttonReader->callback(OnButtonSelected, this);

	win = new Fl_Window(550, 130, "Press Joystick Button");
	sprintf(labelText, "Press button for \"%s\" on joystick \"%s\"", ActionName(actionNumber), JoystickSingleton::Instance().Name());
	Fl_Group* label = new Fl_Group(10, 35, 530, 5, labelText);
	label->end();
	errorLabel = new Fl_Group(15, 70, 530, 5);
	errorLabel->labelcolor((Fl_Color)1);
	errorLabel->hide();
	errorLabel->end();
	Fl_Button* btn = new Fl_Button(435, 90, 100, 25, "Cancel");
	btn->callback(OnClose, this);
	win->callback(OnClose, this);
	win->end();
	win->set_modal();
	win->show();
}
Ejemplo n.º 3
0
  bool Record()
  {
    bool Result = (FState != Opened);
    if (Result)
    {
      if (FLog->FLogging && (FState != Cancelled))
      {
        const wchar_t * Name = ActionName();
        UnicodeString Attrs;
        if (FRecursive)
        {
          Attrs = L" recursive=\"true\"";
        }
        FLog->AddIndented(FORMAT(L"<%s%s>", Name,  Attrs.c_str()));
        for (intptr_t Index = 0; Index < FNames->GetCount(); ++Index)
        {
          UnicodeString Value = FValues->GetString(Index);
          if (Value.IsEmpty())
          {
            FLog->AddIndented(FORMAT(L"  <%s />", FNames->GetString(Index).c_str()));
          }
          else
          {
            FLog->AddIndented(FORMAT(L"  <%s value=\"%s\" />",
              FNames->GetString(Index).c_str(), XmlAttributeEscape(Value).c_str()));
          }
        }
        if (FFileList != nullptr)
        {
          FLog->AddIndented(L"  <files>");
          for (intptr_t Index = 0; Index < FFileList->GetCount(); ++Index)
          {
            TRemoteFile * File = FFileList->GetFile(Index);

            FLog->AddIndented(L"    <file>");
            FLog->AddIndented(FORMAT(L"      <filename value=\"%s\" />", XmlAttributeEscape(File->GetFileName()).c_str()));
            FLog->AddIndented(FORMAT(L"      <type value=\"%s\" />", XmlAttributeEscape(File->GetType()).c_str()));
            if (!File->GetIsDirectory())
            {
              FLog->AddIndented(FORMAT(L"      <size value=\"%s\" />", Int64ToStr(File->GetSize()).c_str()));
            }
            FLog->AddIndented(FORMAT(L"      <modification value=\"%s\" />", StandardTimestamp(File->GetModification()).c_str()));
            FLog->AddIndented(FORMAT(L"      <permissions value=\"%s\" />", XmlAttributeEscape(File->GetRights()->GetText()).c_str()));
            FLog->AddIndented(L"    </file>");
          }
          FLog->AddIndented(L"  </files>");
        }
        if (FFile != nullptr)
        {
          FLog->AddIndented(L"  <file>");
          FLog->AddIndented(FORMAT(L"    <type value=\"%s\" />", XmlAttributeEscape(FFile->GetType()).c_str()));
          if (!FFile->GetIsDirectory())
          {
            FLog->AddIndented(FORMAT(L"    <size value=\"%s\" />", Int64ToStr(FFile->GetSize()).c_str()));
          }
          FLog->AddIndented(FORMAT(L"    <modification value=\"%s\" />", StandardTimestamp(FFile->GetModification()).c_str()));
          FLog->AddIndented(FORMAT(L"    <permissions value=\"%s\" />", XmlAttributeEscape(FFile->GetRights()->GetText()).c_str()));
          FLog->AddIndented(L"  </file>");
        }
        if (FState == RolledBack)
        {
          if (FErrorMessages != nullptr)
          {
            FLog->AddIndented(L"  <result success=\"false\">");
            FLog->AddMessages(L"    ", FErrorMessages);
            FLog->AddIndented(L"  </result>");
          }
          else
          {
            FLog->AddIndented(L"  <result success=\"false\" />");
          }
        }
        else
        {
          FLog->AddIndented(L"  <result success=\"true\" />");
        }
        FLog->AddIndented(FORMAT(L"</%s>", Name));
      }
      delete this;
    }
    return Result;
  }
Ejemplo n.º 4
0
const char*
Instruction::GetDescription() const
{
    static char desc[1024];

    switch (action) {
    case VECTOR:
        if (farcast)
        sprintf_s(desc, Game::GetText("instr.long.farcast").data(), rgn_name.data());
        else
        sprintf_s(desc, Game::GetText("instr.long.vector").data(), rgn_name.data());
        break;

    case LAUNCH:
        sprintf_s(desc, Game::GetText("instr.long.launch").data(), tgt_name.data());
        break;

    case DOCK:
        sprintf_s(desc, Game::GetText("instr.long.dock").data(), tgt_name.data());
        break;

    case RTB:
        sprintf_s(desc, Game::GetText("instr.long.return-to-base").data());
        break;

    case DEFEND:
        if (priority == PRIMARY) {
            sprintf_s(desc, Game::GetText("instr.long.defend").data(), ActionName(action), tgt_desc.data());
        }
        else {
            sprintf_s(desc, Game::GetText("instr.long.protect").data(), tgt_desc.data());
        }
        break;

    case ESCORT:
        if (priority == PRIMARY) {
            sprintf_s(desc, Game::GetText("instr.long.escort").data(), ActionName(action), tgt_desc.data());
        }
        else {
            sprintf_s(desc, Game::GetText("instr.long.protect").data(), tgt_desc.data());
        }
        break;

    case PATROL:
        sprintf_s(desc, Game::GetText("instr.long.patrol").data(),
        tgt_desc.data(),
        rgn_name.data());
        break;

    case SWEEP:
        sprintf_s(desc, Game::GetText("instr.long.sweep").data(),
        tgt_desc.data(),
        rgn_name.data());
        break;

    case INTERCEPT:
        sprintf_s(desc, Game::GetText("instr.long.intercept").data(), tgt_desc.data());
        break;

    case STRIKE:
        sprintf_s(desc, Game::GetText("instr.long.strike").data(), tgt_desc.data());
        break;

    case ASSAULT:
        sprintf_s(desc, Game::GetText("instr.long.assault").data(), tgt_desc.data());
        break;

    case RECON:
        sprintf_s(desc, Game::GetText("instr.long.recon").data(), tgt_desc.data());
        break;

    default:
        sprintf_s(desc, "%s", ActionName(action));
        break;
    }

    if (status != PENDING) {
        strcat_s(desc, " - ");
        strcat_s(desc, Game::GetText(StatusName(status)));
    }

    return desc;
}
Ejemplo n.º 5
0
  bool __fastcall Record()
  {
    bool Result = (FState != Opened);
    if (Result)
    {
      if (FLog->FLogging && (FState != Cancelled))
      {
        const wchar_t * Name = ActionName();
        UnicodeString Attrs;
        if (FRecursive)
        {
          Attrs = L" recursive=\"true\"";
        }
        FLog->AddIndented(FORMAT(L"<%s%s>", (Name,  Attrs)));
        for (int Index = 0; Index < FNames->Count; Index++)
        {
          UnicodeString Value = FValues->Strings[Index];
          if (Value.IsEmpty())
          {
            FLog->AddIndented(FORMAT(L"  <%s />", (FNames->Strings[Index])));
          }
          else
          {
            FLog->AddIndented(FORMAT(L"  <%s value=\"%s\" />",
              (FNames->Strings[Index], XmlAttributeEscape(Value))));
          }
        }
        if (FFileList != NULL)
        {
          FLog->AddIndented(L"  <files>");
          for (int Index = 0; Index < FFileList->Count; Index++)
          {
            TRemoteFile * File = FFileList->Files[Index];

            FLog->AddIndented(L"    <file>");
            FLog->AddIndented(FORMAT(L"      <filename value=\"%s\" />", (XmlAttributeEscape(File->FileName))));
            FLog->AddIndented(FORMAT(L"      <type value=\"%s\" />", (XmlAttributeEscape(File->Type))));
            if (!File->IsDirectory)
            {
              FLog->AddIndented(FORMAT(L"      <size value=\"%s\" />", (IntToStr(File->Size))));
            }
            FLog->AddIndented(FORMAT(L"      <modification value=\"%s\" />", (StandardTimestamp(File->Modification))));
            FLog->AddIndented(FORMAT(L"      <permissions value=\"%s\" />", (XmlAttributeEscape(File->Rights->Text))));
            FLog->AddIndented(L"    </file>");
          }
          FLog->AddIndented(L"  </files>");
        }
        if (FFile != NULL)
        {
          FLog->AddIndented(L"  <file>");
          FLog->AddIndented(FORMAT(L"    <type value=\"%s\" />", (XmlAttributeEscape(FFile->Type))));
          if (!FFile->IsDirectory)
          {
            FLog->AddIndented(FORMAT(L"    <size value=\"%s\" />", (IntToStr(FFile->Size))));
          }
          FLog->AddIndented(FORMAT(L"    <modification value=\"%s\" />", (StandardTimestamp(FFile->Modification))));
          FLog->AddIndented(FORMAT(L"    <permissions value=\"%s\" />", (XmlAttributeEscape(FFile->Rights->Text))));
          FLog->AddIndented(L"  </file>");
        }
        if (FState == RolledBack)
        {
          if (FErrorMessages != NULL)
          {
            FLog->AddIndented(L"  <result success=\"false\">");
            FLog->AddMessages(L"    ", FErrorMessages);
            FLog->AddIndented(L"  </result>");
          }
          else
          {
            FLog->AddIndented(L"  <result success=\"false\" />");
          }
        }
        else
        {
          FLog->AddIndented(L"  <result success=\"true\" />");
        }
        FLog->AddIndented(FORMAT(L"</%s>", (Name)));
      }
      delete this;
    }
    return Result;
  }
Ejemplo n.º 6
0
int main(int argc, char* argv[]){
	Fl_Window *mainw = new Fl_Window(400, 380, "DoConfigure - Doukutsu Monotagari Settings");
	
	Fl_Group *movegroup = new Fl_Group(10, 10, 185, 50);
		movegroup->box(FL_THIN_DOWN_BOX);
		movear = new Fl_Radio_Round_Button(10, 10, 185, 20, "Arrows for Movement");
		movear->setonly();
		movegt = new Fl_Radio_Round_Button(10, 40, 185, 20, "<>? for Movement");
	movegroup->end();
	
	Fl_Group *buttongroup = new Fl_Group(10, 70, 185, 50);
		buttongroup->box(FL_THIN_DOWN_BOX);
		buttonxz = new Fl_Radio_Round_Button(10, 70, 185, 20, "Z=Jump; X=Attack");
		buttonxz->setonly();
		buttonzx = new Fl_Radio_Round_Button(10, 100, 185, 20, "X=Jump; Z=Attack");
	buttongroup->end();
	
	Fl_Group *okaygroup = new Fl_Group(205, 10, 185, 50);
		okaygroup->box(FL_THIN_DOWN_BOX);
		okayjump = new Fl_Radio_Round_Button(205, 10, 185, 20, "Jump=Okay");
		okayjump->setonly();
		okayattack = new Fl_Radio_Round_Button(205, 40, 185, 20, "Attack=Okay");
	okaygroup->end();
	
	displaychoice = new Fl_Choice(205, 70, 185, 20);
	Fl_Menu_Item screens[] = {
		{"Fullscreen 16-bit"},
		{"Windowed 320x240"},
 		{"Windowed 640x480"},
		{"Fullscreen 24-bit"},
		{"Fullscreen 32-bit"},
		{0}};
	displaychoice->menu(screens);
	joychoice = new Fl_Check_Button(205, 100, 185, 20, "Use Joypad");
	joychoice->callback(&activatejoy);
		
	joystuffcontainer = new Fl_Group(10, 130, 380, 200);
		joystuffcontainer->box(FL_THIN_DOWN_BOX);
		for(char i=0;i<8;i++){
			joyRows[i] = new RadioRow(i);
		}
		//There's no Label class alright? I'll switch it as soon as one is introduced.
		for (char i=0;i<6;i++) {
			Fl_Group *labeljump = new Fl_Group(10, 150+i*30, 10, 20);
			char* label=new char[strlen(ActionName(i+1))+2];
			sprintf(label, "%s:", ActionName(i+1));
			labeljump->label(label);
			labeljump->align(FL_ALIGN_RIGHT);
			labeljump->end();
		}
		
#ifdef HAVE_SDL
		if (JoystickSingleton::Instance().NumJoysticks() > 0){
			for (char i=0;i<6;i++){
				Fl_Button* btn = new Fl_Button(345, 150+30*i, 35, 20, "pick");
				btn->callback(&pickJsButton, (void*)(long)(i+1));
			}
		}
#endif

	joystuffcontainer->end();
	
	Fl_Button *okaybutton = new Fl_Button(10, 340, 185, 30, "Okay");
	okaybutton->callback(&write_Config);
	Fl_Button *cancelbutton = new Fl_Button(205, 340, 185, 30, "Cancel");
	cancelbutton->callback(&quit);
	
	mainw->end();
	mainw->show(argc, argv);
	
#ifdef HAVE_SDL
	char joystickLabel[100];
	sprintf(joystickLabel, "%s (%d found)", joychoice->label(), JoystickSingleton::Instance().NumJoysticks());
	joychoice->label(joystickLabel);
#endif

	read_Config();
	Fl::option(Fl::OPTION_VISIBLE_FOCUS, false);
	return Fl::run();
}