Exemple #1
0
void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
{
  switch (Pid) {
    case 0x12: {
         cSchedulesLock SchedulesLock(true, 10);
         cSchedules *Schedules = (cSchedules *)cSchedules::Schedules(SchedulesLock);
         if (Schedules)
            cEIT EIT(Schedules, Source(), Tid, Data);
         else {
            // If we don't get a write lock, let's at least get a read lock, so
            // that we can set the running status and 'seen' timestamp (well, actually
            // with a read lock we shouldn't be doing that, but it's only integers that
            // get changed, so it should be ok)
            cSchedulesLock SchedulesLock(false, 50);
            cSchedules *Schedules = (cSchedules *)cSchedules::Schedules(SchedulesLock);
            if (Schedules)
               cEIT EIT(Schedules, Source(), Tid, Data, true);
            }
         }
         break;
    case 0x14: {
         if (Setup.SetSystemTime && Setup.TimeTransponder && ISTRANSPONDER(Transponder(), Setup.TimeTransponder))
            cTDT TDT(Data);
         }
         break;
    }
}
Exemple #2
0
void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
{
  switch (Pid) {
    case 0x12: {
         cSchedulesLock SchedulesLock(true, 10);
         cSchedules *Schedules = (cSchedules *)cSchedules::Schedules(SchedulesLock);
         if (Schedules)
            cEIT EIT(Schedules, Source(), Tid, Data);
         else {
            // If we don't get a write lock, let's at least get a read lock, so
            // that we can set the running status and 'seen' timestamp (well, actually
            // with a read lock we shouldn't be doing that, but it's only integers that
            // get changed, so it should be ok)
            cSchedulesLock SchedulesLock;
            cSchedules *Schedules = (cSchedules *)cSchedules::Schedules(SchedulesLock);
            if (Schedules)
               cEIT EIT(Schedules, Source(), Tid, Data, true);
            }
         }
         break;
    case 0x14: {
         /* TB: (time(NULL) < 31536000*2) 
          * always get the time if the system time has never been set
          * regardless of the transponder */
         if ((time(NULL) < VALID_TIME) || ((Setup.SetSystemTime && Setup.TimeTransponder) && ISTRANSPONDER(Transponder(), Setup.TimeTransponder)))
            cTDT TDT(Data);
         }
         break;
    }
}
Exemple #3
0
static QDir dataDotDot()
{
#ifdef WIN32
    if ((QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) == 0)
    {
        // Use this for non-DOS-based Windowses
        char path[MAX_PATH];
        HRESULT h = SHGetFolderPathA( NULL, 
                                      CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE,
                                      NULL, 
                                      0, 
                                      path );
        if (h == S_OK)
            return QString::fromLocal8Bit( path );
    }
    return QDir::home();

#elif defined(Q_WS_MAC)

    #define EIT( x ) { OSErr err = x; if (err != noErr) throw 1; }
    try
    {
        short vRefNum = 0;
        long dirId;
        EIT( ::FindFolder( kOnAppropriateDisk, 
                           kApplicationSupportFolderType,
                           kDontCreateFolder, 
                           &vRefNum, 
                           &dirId ) );

        // Now we have a vRefNum and a dirID - but *not* an Unix-Path as string.
        // Lets make one based from this:
        FSSpec fsspec;
        EIT( ::FSMakeFSSpec( vRefNum, dirId, NULL, &fsspec ) );

        // ...and build an FSRef based on thes FSSpec.
        FSRef fsref;
        EIT( ::FSpMakeFSRef( &fsspec, &fsref ) );

        // ...then extract the Unix Path as a C-String from the FSRef
        unsigned char path[512];
        EIT( ::FSRefMakePath( &fsref, path, 512 ) );

        return QDir::homePath() + QString::fromUtf8( (char*)path );
    }
    catch (int)
    {
        return QDir::home().filePath( "Library/Application Support" );
    }

#elif defined(Q_WS_X11)
    return QDir::home().filePath( ".local/share" );

#else
    return QDir::home();
#endif
}