RDCartSlot::RDCartSlot(int slotnum,RDRipc *ripc,RDCae *cae,RDStation *station,
		       RDConfig *config,RDListSvcs *svcs_dialog,
		       RDSlotDialog *slot_dialog,RDCartDialog *cart_dialog,
		       RDCueEditDialog *cue_dialog,
		       const QString &caption,RDAirPlayConf *conf,
		       QWidget *parent)
  : QWidget(parent)
{
  slot_number=slotnum;
  slot_ripc=ripc;
  slot_cae=cae;
  slot_station=station;
  slot_config=config;
  slot_svcs_dialog=svcs_dialog;
  slot_slot_dialog=slot_dialog;
  slot_cart_dialog=cart_dialog;
  slot_cue_dialog=cue_dialog;
  slot_caption=caption;
  slot_airplay_conf=conf;

  slot_svc_names=NULL;
  slot_stop_requested=false;
  slot_logline=new RDLogLine();
  slot_pause_enabled=false;
  slot_user=NULL;
  slot_svcname="";
  slot_breakaway_cart=0;
  slot_breakaway_length=0;
  slot_timescaling_active=false;
  slot_temp_cart=false;

  //
  // Fonts
  //
  QFont big_font("helvetica",36,QFont::Bold);
  big_font.setPixelSize(36);
  QFont mid_font("helvetica",14,QFont::Bold);
  mid_font.setPixelSize(14);

  //
  // Palettes
  //
  slot_ready_color=
    QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),backgroundColor());
  slot_playing_color=
    QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),backgroundColor());

  //
  // Slot Options
  //
  slot_options=new RDSlotOptions(station->name(),slotnum);
  slot_options->load();

  //
  // Play Deck
  //
  slot_deck=new RDPlayDeck(slot_cae,0,this);
  connect(slot_deck,SIGNAL(stateChanged(int,RDPlayDeck::State)),
	  this,SLOT(stateChangedData(int,RDPlayDeck::State)));
  connect(slot_deck,SIGNAL(position(int,int)),
	  this,SLOT(positionData(int,int)));
  connect(slot_deck,SIGNAL(hookEnd(int)),this,SLOT(hookEndData(int)));
  connect(slot_cae,SIGNAL(timescalingSupported(int,bool)),
	  this,SLOT(timescalingSupportedData(int,bool)));

  //
  // Start Button
  //
  slot_start_button=new QPushButton(QString().sprintf("%d",slotnum+1),this);
  slot_start_button->setGeometry(0,0,sizeHint().height(),sizeHint().height());
  slot_start_button->setFont(big_font);
  slot_start_button->setDisabled(true);
  connect(slot_start_button,SIGNAL(clicked()),this,SLOT(startData()));

  //
  // Slot Box
  //
  slot_box=new RDSlotBox(slot_deck,conf,this);
  slot_box->setBarMode(false);
  slot_box->setAllowDrags(station->enableDragdrop());
  slot_box->setAcceptDrops(station->enableDragdrop());
  slot_box->setGeometry(5+sizeHint().height(),0,
			slot_box->sizeHint().width(),
			slot_box->sizeHint().height());
  connect(slot_box,SIGNAL(doubleClicked()),this,SLOT(doubleClickedData()));
  connect(slot_box,SIGNAL(cartDropped(unsigned)),
	  this,SLOT(cartDroppedData(unsigned)));

  //
  // Load Button
  //
  slot_load_button=new QPushButton(tr("Load"),this);
  slot_load_button->
    setGeometry(sizeHint().height()+5+slot_box->sizeHint().width()+5,0,
		sizeHint().height(),sizeHint().height());
  slot_load_button->setFont(mid_font);
  connect(slot_load_button,SIGNAL(clicked()),this,SLOT(loadData()));

  //
  // Options Button
  //
  slot_options_button=new QPushButton(this);
  slot_options_button->
    setGeometry(2*sizeHint().height()+10+slot_box->sizeHint().width()+5,0,
		sizeHint().height(),sizeHint().height());
  slot_options_button->setFont(mid_font);
  connect(slot_options_button,SIGNAL(clicked()),this,SLOT(optionsData()));

  updateOptions();
  InitializeOptions();
}
Esempio n. 2
0
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow)
{
    if (!InitializeOptions(lpCmdLine))
    {
        if (!OptionSilent)
        {
            MessageBox(NULL, "Please specify the correct parameters:\r\n" \
                       "/path <Full path to the INF>\r\n" \
                       "/path:relative <Relative path to the INF from the current directory>\r\n" \
                       "/ddinstall <DDInstall section name to be processed>\r\n" \
                       "/os <Expected OS version in the form of x.y where x is MajorVersion, y is Minor version, ie 5.0 for Windows 2000>\r\n" \
                       "/buildnumber <Expected OS build number, ie 2195 for Windows 2000>\r\n" \
                       "/sp <Expected OS service pack number>\r\n",
                       "Pre-Installer",
                       MB_OK);

        }

        return ERR_FAIL;
    }

    if ((OptionOsVersionCheck) || (OptionOsBuildNumberCheck) || (OptionOsServicePackCheck))
    {
        OSVERSIONINFO OsVersionInfo;
        OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

        if (GetVersionEx(&OsVersionInfo))
        {
            if (OptionOsVersionCheck)
            {
                CHAR Version[32];

                sprintf(Version, "%d.%d", OsVersionInfo.dwMajorVersion, OsVersionInfo.dwMinorVersion);

                if (_stricmp(Version, ExpectedOsVersion))
                {
                    if (!OptionSilent)
                    {
                        CHAR ErrorMsg[256];
                        sprintf(ErrorMsg, "OS version %s doesn't match the expected %s", Version, ExpectedOsVersion);

                        MessageBox(NULL, ErrorMsg, "Pre-Installer", MB_OK);
                    }

                    return ERR_FAIL;
                }
            }

            if (OptionOsBuildNumberCheck)
            {
                if (OsVersionInfo.dwBuildNumber != ExpectedOsBuildNumber)
                {
                    if (!OptionSilent)
                    {
                        CHAR ErrorMsg[256];
                        sprintf(ErrorMsg, "OS build number %d doesn't match the expected %d", OsVersionInfo.dwBuildNumber, ExpectedOsBuildNumber);

                        MessageBox(NULL, ErrorMsg, "Pre-Installer", MB_OK);
                    }

                    return ERR_FAIL;
                }
            }

            if (OptionOsServicePackCheck)
            {
                CHAR ServicePack[32];

                sprintf(ServicePack, "Service Pack %d", ExpectedOsServicePack);

                if (_stricmp(OsVersionInfo.szCSDVersion, ServicePack))
                {
                    if (!OptionSilent)
                    {
                        CHAR ErrorMsg[256];
                        sprintf(ErrorMsg, "OS %s doesn't match the expected %s", OsVersionInfo.szCSDVersion, ServicePack);

                        MessageBox(NULL, ErrorMsg, "Pre-Installer", MB_OK);
                    }

                    return ERR_FAIL;
                }
            }
        }
        else
        {
            return ERR_FAIL;
        }
    }

    HINF InfHandle = SetupOpenInfFile(InfPath, NULL, INF_STYLE_WIN4 , NULL);	// Get INF Handle

    if (InfHandle != INVALID_HANDLE_VALUE)
    {
        HSPFILEQ QueueHandle = SetupOpenFileQueue();

        if (QueueHandle != INVALID_HANDLE_VALUE)
        {
            SetupInstallFilesFromInfSection(InfHandle, NULL, QueueHandle, DDInstallSection, NULL, SP_COPY_FORCE_NEWER);
            //Copies the files

            PVOID Context = SetupInitDefaultQueueCallback(NULL);

            if (Context)
            {
                SetupCommitFileQueue(NULL, QueueHandle, FileCallback, Context);

                SetupTermDefaultQueueCallback(Context);
            }

            SetupCloseFileQueue(QueueHandle);
        }

        // Do not do the following as we do not want to install the drivers yet. When the device is turned on,
        // Windows PnP will take care of the rest of the installation process.
#if 0
        CHAR DDInstallServicesSection[MAX_PATH];

        strcpy(DDInstallServicesSection, DDInstallSection);
        strcat(DDInstallServicesSection, ".Services");

        SetupInstallServicesFromInfSection(InfHandle, DDInstallServicesSection, SPSVCINST_TAGTOFRONT);

        HKEY RegKey = SetupDiOpenClassRegKey((LPGUID)&CLSID_MEDIA, KEY_ALL_ACCESS);

        if (RegKey != INVALID_HANDLE_VALUE)
        {
            SetupInstallFromInfSection(NULL, InfHandle, DDInstallSection, SPINST_REGISTRY, RegKey, NULL, NULL,
                                       NULL, NULL, NULL, NULL);		// Does the AddReg, Del Reg Stuff

            RegCloseKey(RegKey);
        }
#endif // 0

        SetupCloseInfFile(InfHandle);
    }

    if (SetupCopyOEMInf(InfPath, NULL, SPOST_PATH, NULL, NULL ,0, NULL, NULL))
    {
        return SUCCESS;
    }
    else
    {
        DWORD err = GetLastError();

        return ERR_FAIL;
    }
}