MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service,
                                                 QWidget* parent)
    : QDialog(parent),
      ui_(new Ui_MagnatuneDownloadDialog),
      service_(service),
      network_(new NetworkAccessManager(this)),
      current_reply_(nullptr),
      next_row_(0) {
  ui_->setupUi(this);

  setWindowIcon(IconLoader::Load("magnatune", IconLoader::Provider));

  ui_->albums->header()->setResizeMode(QHeaderView::ResizeToContents);
  ui_->albums->header()->setResizeMode(1, QHeaderView::Fixed);
  ui_->albums->header()->resizeSection(1, 150);
  ui_->albums->setItemDelegateForColumn(1, new ProgressItemDelegate(this));

  ui_->button_box->button(QDialogButtonBox::Cancel)->hide();

  connect(ui_->browse, SIGNAL(clicked()), SLOT(Browse()));

  QSettings s;
  s.beginGroup(MagnatuneService::kSettingsGroup);
  ui_->directory->setText(s.value("download_dir", QDir::homePath()).toString());
}
Ejemplo n.º 2
0
BOOL _PLMTPC_Seek(PlayListManager manager, int trackNumber)
{
	PlayListManager_PC state = (PlayListManager_PC)manager->InternalState;
	BOOL result = FALSE;

	if(trackNumber >= state->StartingTrackNumber && trackNumber <= (state->StartingTrackNumber + state->Count - 1))
	{
		int index = trackNumber - state->StartingTrackNumber;
		if(manager->TrackMetaData != NULL)
		{
			CDS_ObjRef_Release(manager->TrackMetaData);
			manager->TrackMetaData = NULL;
		}
		String_Destroy(manager->TrackURI);
		manager->TrackURI = NULL;
		manager->TrackMetaData = state->Objects[index];
		CDS_ObjRef_Add(manager->TrackMetaData);
		manager->TrackNumber = trackNumber;
		manager->TrackURI = String_Create(manager->TrackMetaData->Res->Value);

		result = TRUE;
	}
	else
	{
		if(Browse(state, trackNumber) == TRUE)
		{
			if(manager->TrackMetaData != NULL)
			{
				CDS_ObjRef_Release(manager->TrackMetaData);
				manager->TrackMetaData = NULL;
			}
			String_Destroy(manager->TrackURI);
			manager->TrackURI = NULL;
			manager->TrackMetaData = state->Objects[0];
			CDS_ObjRef_Add(manager->TrackMetaData);
			manager->TrackNumber = trackNumber;
			manager->TrackURI = String_Create(manager->TrackMetaData->Res->Value);

			result = TRUE;
		}
		else
		{
			if(manager->TrackMetaData != NULL)
			{
				CDS_ObjRef_Release(manager->TrackMetaData);
				manager->TrackMetaData = NULL;
			}
			String_Destroy(manager->TrackURI);
			manager->TrackURI = NULL;

			result = FALSE;
		}
	}

	return result;
}
Ejemplo n.º 3
0
NPT_Result 
GPAC_MediaController::Browse(GPAC_MediaServerItem *server, const char *object_id, const char *filter)
{
    NPT_Result res = NPT_FAILURE;
    NPT_Int32  index = 0;

    // reset output params
	server->m_BrowseResults = NULL;


	do {	
        PLT_BrowseDataReference browse_data(new PLT_BrowseData());

        // send off the browse packet.  Note that this will
        // not block.  There is a call to WaitForResponse in order
        // to block until the response comes back.
        res = Browse(browse_data,
			server->m_device,
            (const char*)object_id,
            index,
            1024,
            false,
            filter,
            "");		
        NPT_CHECK_LABEL_WARNING(res, done);
        
        if (NPT_FAILED(browse_data->res)) {
            res = browse_data->res;
            NPT_CHECK_LABEL_WARNING(res, done);
        }

        if (browse_data->info.items->GetItemCount() == 0)
            break;

        if (server->m_BrowseResults.IsNull()) {
            server->m_BrowseResults = browse_data->info.items;
        } else {
            server->m_BrowseResults->Add(*browse_data->info.items);
            // clear the list items so that the data inside is not
            // cleaned up by PLT_MediaItemList dtor since we copied
            // each pointer into the new list.
            browse_data->info.items->Clear();
        }

        // stop now if our list contains exactly what the server said it had
        if (browse_data->info.tm && browse_data->info.tm == server->m_BrowseResults->GetItemCount())
            break;

        // ask for the next chunk of entries
        index = server->m_BrowseResults->GetItemCount();
    } while(1);

done:
    return res;
}
Ejemplo n.º 4
0
/* Constructor */
int PlayListManager_PC_Create(PlayListManager manager, char* uri)
{
	int i;
	int result = 0;
	PlayListManager_PC state = NULL;

	state = (PlayListManager_PC)malloc(sizeof(struct _PlayListManager_PC));
	if(state == NULL)
	{
		return result;

	}
	memset(state, 0, sizeof(struct _PlayListManager_PC));
	state->Parent = manager;
	state->UDN = NULL;
	state->ServiceID = NULL;
	state->ContainerID = NULL;
	state->FirstItemID = NULL;
	state->FirstItemIndex = -1;
	state->SortArgs = String_Create("");
	state->MaxDepth = 0;
	state->Count = 0;
	state->StartingTrackNumber = 0;
	for(i = 0; i < MAX_OBJECTS_IN_MEMORY; i++)
	{
		state->Objects[i] = NULL;
	}

	manager->InternalState = (void*)state;
	manager->Destroy = &_PLMTPC_Destroy;
	manager->Seek = &_PLMTPC_Seek;

	if(ParsePlayContainerUri(state, uri) == FALSE)
	{
		result = 0;
		return result;
	}

	sem_init(&state->LockObject, 0, 1);

	if(Browse(state, 1) == FALSE)
	{
		result = 0;
		return result;
	}

	result = 1;
	return result;
}
Ejemplo n.º 5
0
ApplicationDialog::ApplicationDialog(const QString &name,
                                     const QString &path,
                                     const QString &title,
                                     QWidget *parent) :
    QDialog(parent)
{
    mUI.setupUi(this);

    connect(mUI.mButtonBrowse, SIGNAL(clicked()), this, SLOT(Browse()));
    connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
    connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
    mUI.mPath->setText(path);
    mUI.mName->setText(name);
    setWindowTitle(title);
}
Ejemplo n.º 6
0
ApplicationDialog::ApplicationDialog(const QString &title,
                                     const Application &app,
                                     QWidget *parent) :
    QDialog(parent)
{
    mUI.setupUi(this);

    connect(mUI.mButtonBrowse, SIGNAL(clicked()), this, SLOT(Browse()));
    connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
    connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
    mUI.mPath->setText(app.getPath());
    mUI.mName->setText(app.getName());
    mUI.mParameters->setText(app.getParameters());
    setWindowTitle(title);
    adjustSize();
}
Ejemplo n.º 7
0
void runlogic()
{
    NSDL2_RUNLOGIC(NULL, NULL, "Executing init_script()");

    init_script();

    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Start");
    {
        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Home");
        Home();

        NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - ProductAdddedBlock");
        {
            int ProductAdddedBlockpercent = ns_get_random_number_int(1, 100);

            NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - ProductAdddedBlock = %d", ProductAdddedBlockpercent);

            if(ProductAdddedBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing dowhile block - BrowseLoop. NS Variable = BrowseLoop (pct value = 100%)");
                {

                    NSDL2_RUNLOGIC(NULL, NULL, "NS Variable value for block - BrowseLoop = %d", ns_get_int_val("BrowseLoop"));
                    do
                    {

                        NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - BrowseBlock (pct value = 100%)");
                        {
                            NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Browse");
                            Browse();

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - ProductSel (pct value = 100%)");
                            {
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ProductSelectionStart");
                                ProductSelectionStart();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - RefineSearch");
                                RefineSearch();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - PerformPagination");
                                PerformPagination();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - SortProducts");
                                SortProducts();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ChangeView");
                                ChangeView();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ProductSelectionEnd");
                                ProductSelectionEnd();
                            }
                            NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ViewProductDetail");
                            ViewProductDetail();

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Block1 (pct value = 100%)");
                            {
                                int Block1percent = ns_get_random_number_int(1, 100);

                                NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Block1 = %d", Block1percent);

                                if(Block1percent <= 100)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 100%)");
                                    Abandonment();
                                }
                                else if(Block1percent <= 100)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - AddToBag (pct value = 0%)");
                                    AddToBag();
                                }
                            }
                        }
                    } while(ns_get_int_val("BrowseLoop"));
                }
            }
            else if(ProductAdddedBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing dowhile block - SearchLoop. NS Variable = SearchLoop (pct value = 0%)");
                {

                    NSDL2_RUNLOGIC(NULL, NULL, "NS Variable value for block - SearchLoop = %d", ns_get_int_val("SearchLoop"));
                    do
                    {

                        NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - SearchKeywordBlock (pct value = 0%)");
                        {
                            NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - SearchKeyword");
                            SearchKeyword();

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - ProductSelection (pct value = 0%)");
                            {
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ProductSelectionStart");
                                ProductSelectionStart();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - RefineSearch");
                                RefineSearch();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - PerformPagination");
                                PerformPagination();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - SortProducts");
                                SortProducts();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ChangeView");
                                ChangeView();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ProductSelectionEnd");
                                ProductSelectionEnd();
                            }

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Block2 (pct value = 0%)");
                            {
                                int Block2percent = ns_get_random_number_int(1, 100);

                                NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Block2 = %d", Block2percent);

                                if(Block2percent <= 25)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 25%)");
                                    Abandonment();
                                }
                                else if(Block2percent <= 100)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ViewProductDetail (pct value = 75%)");
                                    ViewProductDetail();
                                }
                            }

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Block2A (pct value = 0%)");
                            {
                                int Block2Apercent = ns_get_random_number_int(1, 100);

                                NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Block2A = %d", Block2Apercent);

                                if(Block2Apercent <= 100)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 100%)");
                                    Abandonment();
                                }
                                else if(Block2Apercent <= 100)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - AddToBag (pct value = 0%)");
                                    AddToBag();
                                }
                            }
                        }
                    } while(ns_get_int_val("SearchLoop"));
                }
            }
            else if(ProductAdddedBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - SearchPIDBlock (pct value = 0%)");
                {
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - SearchProductId");
                    SearchProductId();

                    NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Block3 (pct value = 0%)");
                    {
                        int Block3percent = ns_get_random_number_int(1, 100);

                        NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Block3 = %d", Block3percent);

                        if(Block3percent <= 100)
                        {
                            NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 100%)");
                            Abandonment();
                        }
                        else if(Block3percent <= 100)
                        {
                            NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - AddToBag (pct value = 0%)");
                            AddToBag();
                        }
                        else if(Block3percent <= 100)
                        {

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Block3A (pct value = 0%)");
                            {
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Browse");
                                Browse();
                                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - ViewProductDetail");
                                ViewProductDetail();

                                NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Block3B (pct value = 0%)");
                                {
                                    int Block3Bpercent = ns_get_random_number_int(1, 100);

                                    NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Block3B = %d", Block3Bpercent);

                                    if(Block3Bpercent <= 25)
                                    {
                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 25%)");
                                        Abandonment();
                                    }
                                    else if(Block3Bpercent <= 100)
                                    {
                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - AddToBag (pct value = 75%)");
                                        AddToBag();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - CheckOutBlock");
        {
            int CheckOutBlockpercent = ns_get_random_number_int(1, 100);

            NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - CheckOutBlock = %d", CheckOutBlockpercent);

            if(CheckOutBlockpercent <= 0)
            {
                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - CheckOut (pct value = 0%)");
                CheckOut();
            }
            else if(CheckOutBlockpercent <= 100)
            {
                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 100%)");
                Abandonment();
            }
            else if(CheckOutBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - EditandCheckOutBlock (pct value = 0%)");
                {
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - UpdateItem");
                    UpdateItem();
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - CheckOut");
                    CheckOut();
                }
            }
        }

        NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - PlaceOrderBlock");
        {
            int PlaceOrderBlockpercent = ns_get_random_number_int(1, 100);

            NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - PlaceOrderBlock = %d", PlaceOrderBlockpercent);

            if(PlaceOrderBlockpercent <= 100)
            {
                NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Abandonment (pct value = 100%)");
                Abandonment();
            }
            else if(PlaceOrderBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - RegBlock (pct value = 0%)");
                {
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - RegCheckOut");
                    RegCheckOut();
                }
            }
            else if(PlaceOrderBlockpercent <= 100)
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - UnRegBlock (pct value = 0%)");
                {
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - UnRegCheckOut");
                    UnRegCheckOut();
                }
            }
        }
    }

    NSDL2_RUNLOGIC(NULL, NULL, "Executing ns_exit_session()");
    ns_exit_session();
}
Ejemplo n.º 8
0
static void
PlayerCtrlTask(void *pvParameters){
  //portTickType ulLastTime;
  
  //char itemCount = 0;
  unsigned char soundCtrl = 0;
  //Start Player Ctrl
  usStopPlayerCtrl = 0;
  
  //List files in root
  ListFiles();
  sFilePath=getCurrentFile();
  //DisplayMenu(0x03);
    //
    // Loop forever.
    //
  vTaskSuspendScheduler();
  ShowStartup();
  xTaskResumeScheduler();
  xTaskDelay(5000);
  
  while(1){
    //get event from button
    if( xQueueReceive(xPlayerCtrlQueue, (unsigned char*)&usEventCode,100)==pdPASS)
    {
      //Events from USB
      if(usEventCode == STOP_PLAYER)
      {
        PlayState=PAUSE_STATE;
        usStopPlayerCtrl = 1;//*Stop Player Ctrl
        soundCtrl = STOP;//*Stop Sound Player
        giveSoundCtrlEvent((unsigned char*)&soundCtrl,portMAX_DELAY);
      }
      else if (usEventCode == START_PLAYER)
      {
        usStopPlayerCtrl = 0;//*Start Player Ctrl
        Root = MENU;
        ChooseItem = NOWPLAY;
        DisplayMenu(0x03);
      }
      
      //USB not pluged in
      if(usStopPlayerCtrl == 0)
      {
        //Play sound Button when button pressed
        if(usEventCode < 10 && SoundButton)
        {
          soundCtrl = PLAY_BTN_SND;
          giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
        }
        //Events from Sound Player
        if(usEventCode==PLAY_DONE)
        {
          /**Play Mode: Normal*/
          //TODO Play next song
          
          if(PlayMode == 0){//normal
            sFilePath = nextFile();
            if(ucFileIndex!=0)
            {
             soundCtrl = START;
             giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
            }
          }else if(PlayMode == 1)//Single
          {
            ;
          }else if(PlayMode ==2)//repeate
          {
            soundCtrl = START;
            giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
          }else if(PlayMode==3)//loop
          {
            sFilePath = nextFile();
            soundCtrl = START;
            giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
          }
          //
          if(ChooseItem == NOWPLAY)
          {
            NowPlay(STATE_UPDATE);
            NowPlay(SELECTED_UPDATE);
          }
        }
        
        //Events form user buttons
        if(Root == ITEM)
        {
          if(ChooseItem == NOWPLAY){
            if(usEventCode == L_CENTER)
            {
              Root = MENU;//*back ROOT
              DisplayMenu(0x03);
            }else if(usEventCode == S_CENTER)
            {
              soundCtrl=PAUSE_PLAY;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(STATE_UPDATE);
              
            }else if(usEventCode == S_RIGHT)
            {     
              soundCtrl = VLM_UP;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(VOLUME_UPDATE);
            }
            else if(usEventCode == S_LEFT)
            {
              soundCtrl = VLM_DOWN;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(VOLUME_UPDATE);
            }
            else if(usEventCode == S_UP)
            {
              //Play next song
              sFilePath = preFile();
              NowPlay(SELECTED_UPDATE);
              
              soundCtrl = START;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
            }
            else if(usEventCode == S_DOWN)
            {
              //Play previous song
              sFilePath = nextFile();
              NowPlay(SELECTED_UPDATE);
              
              soundCtrl = START;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
            }
          }
          else if(ChooseItem == BROWSE)
          {
            if(usEventCode == L_CENTER)
            {
                //back ROOT/parent's Dir
              vTaskSuspendScheduler();
              if(BackParentDir())
              {
                Root = MENU;
                DisplayMenu(0x03);
              }
              else
                Browse(BROWSE_UPDATE);
              xTaskResumeScheduler();
            }
            else if(usEventCode == S_CENTER)
            {
               //open dir if it's dir, else file and play;
              vTaskSuspendScheduler();
              ListFiles();
              xTaskResumeScheduler();
              ChooseItem = NOWPLAY;
              NowPlay(0x1f);
            }
            else if(usEventCode == S_UP){
              PreItem();
              Browse(BROWSE_UPDATE);
            }else if(usEventCode == S_DOWN){
              NextItem();
              Browse(BROWSE_UPDATE);
            }else if(usEventCode == L_DOWN || usEventCode == L_UP){
              vTaskSuspendScheduler();
              OpenChooseDir();
              xTaskResumeScheduler();
              Browse(BROWSE_UPDATE);
            }
          }else if(ChooseItem == SETTINGS){
            if(usEventCode == L_CENTER){
                Root = MENU;//*back MENU
                DisplayMenu(0x03);
            }else if(usEventCode == S_CENTER)
            {
              if(Selected == PLAY_MODE)
              {
                PlayMode++;
                if(PlayMode >3)
                  PlayMode =0;
              }else if(Selected == BUTTON_SOUND)
              {
                SoundButton++;
                if(SoundButton>1)
                  SoundButton =0;
              }
              Settings(SETTING_MODE);
            }
            else if(usEventCode == S_UP)
            {
              Selected++;
              if(Selected > 1)
                Selected=0;
              Settings(SETTING_MODE);
            }else if(usEventCode == S_DOWN)
            {
              Selected--;
              if(Selected > 1)
                Selected=1;
              Settings(SETTING_MODE);
            }
          }else if(ChooseItem == INFO){
            if(usEventCode == L_CENTER){
                Root = MENU;//*back MENU
                DisplayMenu(0x03);
            }
          }
        }
        else if(Root == MENU){
          if(usEventCode == S_CENTER){
            Root = ITEM;//enter choose item;
            if(ChooseItem==NOWPLAY)
            {
              NowPlay(0x1f);
            }
            else if(ChooseItem==BROWSE)
            {
              vTaskSuspendScheduler();
              ListDirItems();
              xTaskResumeScheduler();
              Browse(0x3);
            }
            else if(ChooseItem==SETTINGS)
            {
              Settings(0x03);
            }
            else if(ChooseItem==INFO)
            {
              Info(0x03);
            }
          }else if(usEventCode == S_UP){
            ChooseItem--;//previous item
            if(ChooseItem > INFO)
              ChooseItem = INFO;
            DisplayMenu(MENU_SELECT_UPDATE);
          }else if(usEventCode == S_DOWN){
            ChooseItem++;//next item
            if(ChooseItem > INFO)
              ChooseItem = NOWPLAY;
            DisplayMenu(MENU_SELECT_UPDATE);
          } 
        }
      }else{
        //USB mass storage
        USBTransfer();
      }
        
    }
    if(Root == ITEM)
    {
        if(ChooseItem == NOWPLAY){
            //Update time playing
            if(clock)
            {
              NowPlay(TIME_UPDATE);
              clock=0;
            }
        }
     }
  }
}
	bool DoModal(HWND hWndParent)
	{
		// If there's more than one already, select them from a list
		if(Installations.Num() > 0)
		{
			return DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SELECTBUILD), hWndParent, &DialogProc, (LPARAM)this) != FALSE;
		}
		else if(FPlatformMisc::MessageBoxExt(EAppMsgType::YesNo, TEXT("No Unreal Engine installations found. Would you like to locate one manually?"), TEXT("Installation Not Found")) == EAppReturnType::Yes && Browse(hWndParent))
		{
			return true;
		}
		return false;
	}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE2
//----------------------------------
void SetTool::EvClickBrowse2(void)
{
    Browse(ID_TOOL2PATH,ID_TOOL2NAME,"2");
}
Ejemplo n.º 11
0
void UGameEngine::Init(IEngineLoop* InEngineLoop)
{
	DECLARE_SCOPE_CYCLE_COUNTER(TEXT("UGameEngine Init"), STAT_GameEngineStartup, STATGROUP_LoadTime);

	// Call base.
	UEngine::Init(InEngineLoop);

#if USE_NETWORK_PROFILER
	FString NetworkProfilerTag;
	if( FParse::Value(FCommandLine::Get(), TEXT("NETWORKPROFILER="), NetworkProfilerTag ) )
	{
		GNetworkProfiler.EnableTracking(true);
	}
#endif

	// Load and apply user game settings
	GetGameUserSettings()->LoadSettings();
	GetGameUserSettings()->ApplySettings();

	// Creates the initial world context. For GameEngine, this should be the only WorldContext that ever gets created.
	FWorldContext &InitialWorldContext = CreateNewWorldContext(EWorldType::Game);

	// Initialize the viewport client.
	UGameViewportClient* ViewportClient = NULL;
	if(GIsClient)
	{
		ViewportClient = ConstructObject<UGameViewportClient>(GameViewportClientClass,this);
		ViewportClient->SetReferenceToWorldContext(InitialWorldContext);
		GameViewport = ViewportClient;
		InitialWorldContext.GameViewport = ViewportClient;
	}

	bCheckForMovieCapture = true;

	// Attach the viewport client to a new viewport.
	if(ViewportClient)
	{
		// This must be created before any gameplay code adds widgets
		bool bWindowAlreadyExists = GameViewportWindow.IsValid();
		if (!bWindowAlreadyExists)
		{
			GameViewportWindow = CreateGameWindow();
		}

		CreateGameViewport( ViewportClient );

		if( !bWindowAlreadyExists )
		{
			SwitchGameWindowToUseGameViewport();
		}
		FString Error;
		if(!ViewportClient->Init(Error))
		{
			UE_LOG(LogEngine, Fatal,TEXT("%s"),*Error);
		}
	}

	// Create default URL.
	// @note:  if we change how we determine the valid start up map update LaunchEngineLoop's GetStartupMap()
	FURL DefaultURL;
	DefaultURL.LoadURLConfig( TEXT("DefaultPlayer"), GGameIni );

	// Enter initial world.
	EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;
	FString Error;
	TCHAR Parm[4096]=TEXT("");
	const TCHAR* Tmp = FCommandLine::Get();

#if UE_BUILD_SHIPPING
	// In shipping don't allow an override
	Tmp = TEXT("");
#endif // UE_BUILD_SHIPPING

	const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
	const FString& DefaultMap = GameMapsSettings->GetGameDefaultMap();
	if (!FParse::Token(Tmp, Parm, ARRAY_COUNT(Parm), 0) || Parm[0] == '-')
	{
		FCString::Strcpy(Parm, *(DefaultMap + GameMapsSettings->LocalMapOptions));
	}
	FURL URL( &DefaultURL, Parm, TRAVEL_Partial );
	if( URL.Valid )
	{
		BrowseRet = Browse(InitialWorldContext, URL, Error );
	}

	// If waiting for a network connection, go into the starting level.
	if (BrowseRet != EBrowseReturnVal::Success && FCString::Stricmp(Parm, *DefaultMap) != 0)
	{
		const FText Message = FText::Format( NSLOCTEXT("Engine", "MapNotFound", "The map specified on the commandline '{0}' could not be found. Would you like to load the default map instead?"), FText::FromString( URL.Map ) );

		// the map specified on the command-line couldn't be loaded.  ask the user if we should load the default map instead
		if ( FCString::Stricmp(*URL.Map, *DefaultMap) != 0 &&
			FMessageDialog::Open( EAppMsgType::OkCancel, Message ) != EAppReturnType::Ok)
		{
			// user canceled (maybe a typo while attempting to run a commandlet)
			FPlatformMisc::RequestExit( false );
			return;
		}
		else
		{
			BrowseRet = Browse(InitialWorldContext, FURL(&DefaultURL, *(DefaultMap + GameMapsSettings->LocalMapOptions), TRAVEL_Partial), Error);
		}
	}

	// Handle failure.
	if( BrowseRet != EBrowseReturnVal::Success )
	{
		UE_LOG(LogLoad, Fatal, TEXT("%s"), *FString::Printf( TEXT("Failed to enter %s: %s. Please check the log for errors."), Parm, *Error) );
	}
	UE_LOG(LogInit, Display, TEXT("Game Engine Initialized.") );

	// for IsInitialized()
	bIsInitialized = true;
}
Ejemplo n.º 12
0
void SelectDirDlg::InitConnections()
{
	connect(ui.btnBrowse, SIGNAL(clicked()), this, SLOT(Browse()));
	connect(ui.lstDevices, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(SelectForensicsType()));
	connect(ui.lstForensicsType, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(SelectForensicsTypeFinished()));
}
Ejemplo n.º 13
0
/*----------------------------------------------------------------------
|   CMediaCrawler::OnBrowseDevice
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::OnBrowseDevice(PLT_ActionReference& action, 
                              const char*          server_uuid, 
                              const char*          server_object_id, 
                              NPT_SocketInfo*      info /* = NULL */)
{
    NPT_Result res;
    PLT_DeviceDataReference device;

    {
        // look for device first
        const NPT_Lock<PLT_DeviceDataReferenceList>& devices = GetMediaServers();
        //NPT_AutoLock lock(devices);

        if (NPT_FAILED(NPT_ContainerFind(devices, PLT_DeviceDataFinder(server_uuid), device))) {
            /* error */
            NPT_LOG_WARNING("CMediaCrawler::OnBrowseDevice - device not found.");
            action->SetError(701, "No Such Object.");
            return NPT_FAILURE;
        } 
    }

    // look for args and convert them
    NPT_String browseFlagValue;
    NPT_String startingInd;
    NPT_String reqCount;
    NPT_String filter;
    NPT_String sort;

    NPT_CHECK_SEVERE(action->GetArgumentValue("BrowseFlag", browseFlagValue));
    NPT_CHECK_SEVERE(action->GetArgumentValue("StartingIndex", startingInd));
    NPT_CHECK_SEVERE(action->GetArgumentValue("RequestedCount", reqCount));   
    NPT_CHECK_SEVERE(action->GetArgumentValue("Filter", filter));
    NPT_CHECK_SEVERE(action->GetArgumentValue("SortCriteria", sort));

    unsigned long start_index, req_count;
    if (NPT_FAILED(startingInd.ToInteger(start_index)) ||
        NPT_FAILED(reqCount.ToInteger(req_count))) {
        return NPT_FAILURE;
    } 

    // create a container for our result
    // this will be filled in by OnBrowseResponse
    CMediaCrawlerBrowseInfoReference browse_info(new CMediaCrawlerBrowseInfo());
    browse_info->shared_var.SetValue(0);

    // send off the browse packet.  Note that this will
    // not block.  The shared variable is used to block
    // until the response has been received.
    res = Browse(device,
        server_object_id,
        start_index,
        req_count,
        (browseFlagValue == "BrowseMetadata")?1:0,
        filter,
        sort,
        new CMediaCrawlerBrowseInfoReference(browse_info));		
    NPT_CHECK_SEVERE(res);

    // wait 30 secs for response
    res = browse_info->shared_var.WaitUntilEquals(1, 30000);
    NPT_CHECK_SEVERE(res);

    // did the browse fail?
    if (NPT_FAILED(browse_info->res)) {
        action->SetError(browse_info->code, "");
        return NPT_FAILURE;
    }    
   
    action->SetArgumentValue("Result", UpdateDidl(server_uuid, browse_info->didl, info));
    action->SetArgumentValue("NumberReturned", browse_info->nr);
    action->SetArgumentValue("TotalMatches", browse_info->tm);
    action->SetArgumentValue("UpdateId", browse_info->uid);
    action->SetArgumentValue("ObjectID", FormatObjectId(server_uuid, browse_info->object_id));
    
    return NPT_SUCCESS;
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE6
//----------------------------------
void SetTool::EvClickBrowse6(void)
{
    Browse(ID_TOOL6PATH,ID_TOOL6NAME,"6");
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE7
//----------------------------------
void SetTool::EvClickBrowse7(void)
{
    Browse(ID_TOOL7PATH,ID_TOOL7NAME,"7");
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE5
//----------------------------------
void SetTool::EvClickBrowse5(void)
{
    Browse(ID_TOOL4PATH,ID_TOOL5NAME,"5");
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE4
//----------------------------------
void SetTool::EvClickBrowse4(void)
{
    Browse(ID_TOOL4PATH,ID_TOOL4NAME,"4");
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE3
//----------------------------------
void SetTool::EvClickBrowse3(void)
{
    Browse(ID_TOOL3PATH,ID_TOOL3NAME,"3");
}
Ejemplo n.º 19
0
bool GPrinter::Print(GPrintEvents *Events, const char *PrintJobName, int Pages, GView *Parent)
{
	if (!Events)
		return false;
		
	if
	(
		Parent
		&&
		(
			!d->Info.hDevMode
			||
			!d->Info.hDevNames
		)
	)
	{
		d->NeedsDC = true;
		bool r = Browse(Parent);
		d->NeedsDC = false;
		if (!r)
			return false;
	}
	else
	{
		d->Info.hwndOwner = (Parent) ? Parent->Handle() : 0;
		d->Info.Flags = PD_RETURNDC;
		d->Info.hDC = 0;
		/*
		if (Pages >= 0)
		{
			d->Info.nMinPage = 1;
			d->Info.nMaxPage = Pages;
		}
		*/
		if (!PrintDlg(&d->Info))
		{
			return false;
		}
	}

	if (!d->Info.hDC)
	{
		return false;
	}
	
	GString PrinterName;
	if (d->Info.hDevNames)
	{
		DEVNAMES *Name = (DEVNAMES*)GlobalLock(d->Info.hDevNames);
		if (Name)
		{
			// const char *Driver = (const char *)Name + Name->wDriverOffset;
			const char *Device = (const char *)Name + Name->wDeviceOffset;
			// const char *Output = (const char *)Name + Name->wOutputOffset;
			// const char *Default = (const char *)Name + Name->wDefault;			
			PrinterName = Device;			
			GlobalUnlock(Name);
		}
	}

	GPrintDC dc(d->Info.hDC, PrintJobName, PrinterName);
	if (!dc.Handle())
	{
		d->Err.Printf("%s:%i - StartDoc failed.\n", _FL);
		return false;
	}	
	
	int JobPages = Events->OnBeginPrint(&dc);
	bool Status = false;

	DOCINFO Info;

	ZeroObj(Info);
	Info.cbSize = sizeof(DOCINFO); 
	Info.lpszDocName = PrintJobName ? PrintJobName : "Lgi Print Job"; 

	if (Pages > 0)
		JobPages = min(JobPages, Pages);
		
	for (int i=0; i<JobPages; i++)
	{
		if (StartPage(dc.Handle()) > 0)
		{
			Status |= Events->OnPrintPage(&dc, i);
			EndPage(dc.Handle());
		}
		else
		{
			d->Err.Printf("%s:%i - StartPage failed.", _FL);
			Status = false;
			break;
		}
	}
	
	GString OutputFile = dc.GetOutputFileName();
	if (FileExists(OutputFile))
	{
		LgiBrowseToFile(OutputFile);
	}
	
	return Status;
}
Ejemplo n.º 20
0
/*----------------------------------------------------------------------
|   PLT_SyncMediaBrowser::Browse
+---------------------------------------------------------------------*/
NPT_Result
PLT_SyncMediaBrowser::Browse(PLT_DeviceDataReference&      device, 
                             const char*                   object_id, 
                             PLT_MediaObjectListReference& list)
{
    NPT_Result res = NPT_FAILURE;
    NPT_Int32  index = 0;

    // reset output params
    list = NULL;

    // look into cache first
    if (m_UseCache && NPT_SUCCEEDED(m_Cache.Get(device->GetUUID(), object_id, list))) return NPT_SUCCESS;

    do {	
        PLT_BrowseDataReference browse_data(new PLT_BrowseData());

        // send off the browse packet.  Note that this will
        // not block.  There is a call to WaitForResponse in order
        // to block until the response comes back.
        res = Browse(browse_data,
            device,
            (const char*)object_id,
            index,
            1024,
            false,
            "*",
            "");		
        NPT_CHECK_LABEL_WARNING(res, done);
        
        if (NPT_FAILED(browse_data->res)) {
            res = browse_data->res;
            NPT_CHECK_LABEL_WARNING(res, done);
        }

        if (browse_data->info.items->GetItemCount() == 0)
            break;

        if (list.IsNull()) {
            list = browse_data->info.items;
        } else {
            list->Add(*browse_data->info.items);
            // clear the list items so that the data inside is not
            // cleaned up by PLT_MediaItemList dtor since we copied
            // each pointer into the new list.
            browse_data->info.items->Clear();
        }

        // stop now if our list contains exactly what the server said it had
        if (browse_data->info.tm && browse_data->info.tm == list->GetItemCount())
            break;

        // ask for the next chunk of entries
        index = list->GetItemCount();
    } while(1);

done:
    // cache the result
    if (m_UseCache && NPT_SUCCEEDED(res) && !list.IsNull() && list->GetItemCount()) {
        m_Cache.Put(device->GetUUID(), object_id, list);
    }

    // clear entire cache data for device if failed, the device could be gone
    if (NPT_FAILED(res) && m_UseCache) m_Cache.Clear(device->GetUUID());
    
    return res;
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE8
//----------------------------------
void SetTool::EvClickBrowse8(void)
{
    Browse(ID_TOOL8PATH,ID_TOOL8NAME,"8");
}
//----------------------------------
// Event EV_BN_CLICKED for ID_BROWSE1
//----------------------------------
void SetTool::EvClickBrowse1(void)
{
    Browse(ID_TOOL1PATH,ID_TOOL1NAME, "1");
}