void ScanFileOrFolder::listFolder(QFileInfo source,QFileInfo destination)
{
    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1 (%2), destination: %3 (%4)").arg(source.absoluteFilePath()).arg(source.isSymLink()).arg(destination.absoluteFilePath()).arg(destination.isSymLink()));
    if(stopIt)
        return;
    destination=resolvDestination(destination);
    if(stopIt)
        return;
    if(fileErrorAction==FileError_Skip)
        return;
    //if is same
    if(source.absoluteFilePath()==destination.absoluteFilePath())
    {
        emit folderAlreadyExists(source,destination,true);
        waitOneAction.acquire();
        QString destinationSuffixPath;
        switch(folderExistsAction)
        {
            case FolderExists_Merge:
            break;
            case FolderExists_Skip:
                return;
            break;
            case FolderExists_Rename:
                ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination before rename: "+destination.absoluteFilePath());
                if(newName.isEmpty())
                {
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"pattern: "+folder_isolation.pattern());
                    //resolv the new name
                    destinationSuffixPath=destination.baseName();
                    int num=1;
                    do
                    {
                        if(num==1)
                        {
                            if(firstRenamingRule.isEmpty())
                                destinationSuffixPath=tr("%1 - copy").arg(destination.baseName());
                            else
                            {
                                destinationSuffixPath=firstRenamingRule;
                                destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                            }
                        }
                        else
                        {
                            if(otherRenamingRule.isEmpty())
                                destinationSuffixPath=tr("%1 - copy (%2)").arg(destination.baseName()).arg(num);
                            else
                            {
                                destinationSuffixPath=otherRenamingRule;
                                destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                destinationSuffixPath.replace(QStringLiteral("%number%"),QString::number(num));
                            }
                        }
                        num++;
                        if(destination.completeSuffix().isEmpty())
                            destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                        else
                            destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath+text_dot+destination.completeSuffix());
                    }
                    while(destination.exists());
                }
                else
                {
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use new name: "+newName);
                    destinationSuffixPath = newName;
                }
                destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination after rename: "+destination.absoluteFilePath());
            break;
            default:
                return;
            break;
        }
    }
    //check if destination exists
    if(checkDestinationExists)
    {
        if(destination.exists())
        {
            emit folderAlreadyExists(source,destination,false);
            waitOneAction.acquire();
            QString destinationSuffixPath;
            switch(folderExistsAction)
            {
                case FolderExists_Merge:
                break;
                case FolderExists_Skip:
                    return;
                break;
                case FolderExists_Rename:
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination before rename: "+destination.absoluteFilePath());
                    if(newName.isEmpty())
                    {
                        //resolv the new name
                        QFileInfo destinationInfo;
                        int num=1;
                        do
                        {
                            if(num==1)
                            {
                                if(firstRenamingRule.isEmpty())
                                    destinationSuffixPath=tr("%1 - copy").arg(destination.baseName());
                                else
                                {
                                    destinationSuffixPath=firstRenamingRule;
                                    destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                }
                            }
                            else
                            {
                                if(otherRenamingRule.isEmpty())
                                    destinationSuffixPath=tr("%1 - copy (%2)").arg(destination.baseName()).arg(num);
                                else
                                {
                                    destinationSuffixPath=otherRenamingRule;
                                    destinationSuffixPath.replace(QStringLiteral("%name%"),destination.baseName());
                                    destinationSuffixPath.replace(QStringLiteral("%number%"),QString::number(num));
                                }
                            }
                            destinationInfo.setFile(destinationInfo.absolutePath()+text_slash+destinationSuffixPath);
                            num++;
                        }
                        while(destinationInfo.exists());
                    }
                    else
                    {
                        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use new name: "+newName);
                        destinationSuffixPath = newName;
                    }
                    if(destination.completeSuffix().isEmpty())
                        destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath);
                    else
                        destination.setFile(destination.absolutePath()+text_slash+destinationSuffixPath+QStringLiteral(".")+destination.completeSuffix());
                    ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destination after rename: "+destination.absoluteFilePath());
                break;
                default:
                    return;
                break;
            }
        }
    }
    //do source check
    //check of source is readable
    do
    {
        fileErrorAction=FileError_NotSet;
        if(!source.isReadable() || !source.isExecutable() || !source.exists() || !source.isDir())
        {
            if(!source.isDir())
                emit errorOnFolder(source,tr("This is not a folder"));
            else if(!source.exists())
                emit errorOnFolder(source,tr("The folder does exists"));
            else
                emit errorOnFolder(source,tr("The folder is not readable"));
            waitOneAction.acquire();
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionNum: "+QString::number(fileErrorAction));
        }
    } while(fileErrorAction==FileError_Retry);
    do
    {
        QDir tempDir(source.absoluteFilePath());
        fileErrorAction=FileError_NotSet;
        if(!tempDir.isReadable() || !tempDir.exists())
        {
            emit errorOnFolder(source,tr("Problem with name encoding"));
            waitOneAction.acquire();
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionNum: "+QString::number(fileErrorAction));
        }
    } while(fileErrorAction==FileError_Retry);
    if(stopIt)
        return;
    /// \todo check here if the folder is not readable or not exists
    QFileInfoList entryList;
    if(copyListOrder)
        entryList=QDir(source.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst|QDir::Name|QDir::IgnoreCase);//possible wait time here
    else
        entryList=QDir(source.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System);//possible wait time here
    if(stopIt)
        return;
    int sizeEntryList=entryList.size();
    emit newFolderListing(source.absoluteFilePath());
    if(mode!=Ultracopier::Move)
        emit addToMkPath(source,destination,sizeEntryList);
    for (int index=0;index<sizeEntryList;++index)
    {
        QFileInfo fileInfo=entryList.at(index);
        if(stopIt)
            return;
        if(haveFilters)
        {
            if(reloadTheNewFilters)
            {
                QMutexLocker lock(&filtersMutex);
                QCoreApplication::processEvents(QEventLoop::AllEvents);
                reloadTheNewFilters=false;
                this->include=this->include_send;
                this->exclude=this->exclude_send;
            }
            QString fileName=fileInfo.fileName();
            if(fileInfo.isDir() && !fileInfo.isSymLink())
            {
                bool excluded=false,included=(include.size()==0);
                int filters_index=0;
                while(filters_index<exclude.size())
                {
                    if(exclude.at(filters_index).apply_on==ApplyOn_folder || exclude.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                    {
                        if(fileName.contains(exclude.at(filters_index).regex))
                        {
                            excluded=true;
                            break;
                        }
                    }
                    filters_index++;
                }
                if(excluded)
                {}
                else
                {
                    filters_index=0;
                    while(filters_index<include.size())
                    {
                        if(include.at(filters_index).apply_on==ApplyOn_folder || include.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                        {
                            if(fileName.contains(include.at(filters_index).regex))
                            {
                                included=true;
                                break;
                            }
                        }
                        filters_index++;
                    }
                    if(!included)
                    {}
                    else
                        listFolder(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName());
                }
            }
            else
            {
                bool excluded=false,included=(include.size()==0);
                int filters_index=0;
                while(filters_index<exclude.size())
                {
                    if(exclude.at(filters_index).apply_on==ApplyOn_file || exclude.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                    {
                        if(fileName.contains(exclude.at(filters_index).regex))
                        {
                            excluded=true;
                            break;
                        }
                    }
                    filters_index++;
                }
                if(excluded)
                {}
                else
                {
                    filters_index=0;
                    while(filters_index<include.size())
                    {
                        if(include.at(filters_index).apply_on==ApplyOn_file || include.at(filters_index).apply_on==ApplyOn_fileAndFolder)
                        {
                            if(fileName.contains(include.at(filters_index).regex))
                            {
                                included=true;
                                break;
                            }
                        }
                        filters_index++;
                    }
                    if(!included)
                    {}
                    else
                        #ifndef ULTRACOPIER_PLUGIN_RSYNC
                        emit fileTransfer(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName(),mode);
                        #else
                        {
                            bool sendToTransfer=false;
                            if(!rsync)
                                sendToTransfer=true;
                            else if(!QFile::exists(destination.absoluteFilePath()+"/"+fileInfo.fileName()))
                                sendToTransfer=true;
                            else if(fileInfo.lastModified()!=QFileInfo(destination.absoluteFilePath()+"/"+fileInfo.fileName()).lastModified())
                                sendToTransfer=true;
                            if(sendToTransfer)
                                emit fileTransfer(fileInfo.absoluteFilePath(),destination.absoluteFilePath()+"/"+fileInfo.fileName(),mode);
                        }
                        #endif
                }
            }
        }
        else
        {
            if(fileInfo.isDir() && !fileInfo.isSymLink())//possible wait time here
                //listFolder(source,destination,suffixPath+fileInfo.fileName()+QDir::separator());
                listFolder(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName());//put unix separator because it's transformed into that's under windows too
            else
                #ifndef ULTRACOPIER_PLUGIN_RSYNC
                emit fileTransfer(fileInfo,destination.absoluteFilePath()+text_slash+fileInfo.fileName(),mode);
                #else
                {
                    bool sendToTransfer=false;
                    if(!rsync)
                        sendToTransfer=true;
                    else if(!QFile::exists(destination.absoluteFilePath()+"/"+fileInfo.fileName()))
                        sendToTransfer=true;
                    else if(fileInfo.lastModified()!=QFileInfo(destination.absoluteFilePath()+"/"+fileInfo.fileName()).lastModified())
                        sendToTransfer=true;
                    if(sendToTransfer)
                        emit fileTransfer(fileInfo.absoluteFilePath(),destination.absoluteFilePath()+"/"+fileInfo.fileName(),mode);
                }
                #endif
        }
    }
    #ifdef ULTRACOPIER_PLUGIN_RSYNC
    if(rsync)
    {
        //check the reverse path here
        QFileInfoList entryListDestination;
        if(copyListOrder)
            entryListDestination=QDir(destination.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst|QDir::Name|QDir::IgnoreCase);//possible wait time here
        else
            entryListDestination=QDir(destination.absoluteFilePath()).entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System);//possible wait time here
        int sizeEntryListDestination=entryListDestination.size();
        int index=0;
        for (int indexDestination=0;indexDestination<sizeEntryListDestination;++indexDestination)
        {
            index=0;
            while(index<sizeEntryList)
            {
                if(entryListDestination.at(indexDestination).fileName()==entryList.at(index).fileName())
                    break;
                index++;
            }
            if(index==sizeEntryList)
            {
                //then not found, need be remove
                emit addToRmForRsync(entryListDestination.at(indexDestination));
            }
         }
         return;
    }
    #endif
    if(mode==Ultracopier::Move)
    {
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"source: "+source.absoluteFilePath()+", sizeEntryList: "+QString::number(sizeEntryList));
        emit addToMovePath(source,destination,sizeEntryList);
    }
}
示例#2
0
bool QFileSystemIteratorPrivate::matchesFilters(const QAbstractFileEngineIterator *it) const
{
    const bool filterPermissions = ((filters & QDir::PermissionMask)
                                    && (filters & QDir::PermissionMask) != QDir::PermissionMask);
    const bool skipDirs     = !(filters & (QDir::Dirs | QDir::AllDirs));
    const bool skipFiles    = !(filters & QDir::Files);
    const bool skipSymlinks = (filters & QDir::NoSymLinks);
    const bool doReadable   = !filterPermissions || (filters & QDir::Readable);
    const bool doWritable   = !filterPermissions || (filters & QDir::Writable);
    const bool doExecutable = !filterPermissions || (filters & QDir::Executable);
    const bool includeHidden = (filters & QDir::Hidden);
    const bool includeSystem = (filters & QDir::System);

#ifndef QT_NO_REGEXP
    // Prepare name filters
    QList<QRegExp> regexps;
    bool hasNameFilters = !nameFilters.isEmpty() && !(nameFilters.contains(QLatin1String("*")));
    if (hasNameFilters) {
        for (int i = 0; i < nameFilters.size(); ++i) {
            regexps << QRegExp(nameFilters.at(i),
                               (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive,
                               QRegExp::Wildcard);
        }
    }
#endif

    QString fileName = it->currentFileName();
    if (fileName.isEmpty()) {
        // invalid entry
        return false;
    }

    QFileInfo fi = it->currentFileInfo();
    QString filePath = it->currentFilePath();

#ifndef QT_NO_REGEXP
    // Pass all entries through name filters, except dirs if the AllDirs
    // filter is passed.
    if (hasNameFilters && !((filters & QDir::AllDirs) && fi.isDir())) {
        bool matched = false;
        for (int i = 0; i < regexps.size(); ++i) {
            if (regexps.at(i).exactMatch(fileName)) {
                matched = true;
                break;
            }
        }
        if (!matched)
            return false;
    }
#endif

    bool dotOrDotDot = (fileName == QLatin1String(".") || fileName == QLatin1String(".."));
    if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot)
        return false;

    bool isHidden = !dotOrDotDot && fi.isHidden();
    if (!includeHidden && isHidden)
        return false;

    bool isSystem = (!fi.isFile() && !fi.isDir() && !fi.isSymLink())
                    || (!fi.exists() && fi.isSymLink());
    if (!includeSystem && isSystem)
        return false;

    bool alwaysShow = (filters & QDir::TypeMask) == 0
                      && ((isHidden && includeHidden)
                          || (includeSystem && isSystem));

    // Skip files and directories
    if ((filters & QDir::AllDirs) == 0 && skipDirs && fi.isDir()) {
        if (!alwaysShow)
            return false;
    }

    if ((skipFiles && (fi.isFile() || !fi.exists()))
            || (skipSymlinks && fi.isSymLink())) {
        if (!alwaysShow)
            return false;
    }

    if (filterPermissions
            && ((doReadable && !fi.isReadable())
                || (doWritable && !fi.isWritable())
                || (doExecutable && !fi.isExecutable()))) {
        return false;
    }

    if (!includeSystem && !dotOrDotDot && ((fi.exists() && !fi.isFile() && !fi.isDir() && !fi.isSymLink())
                                           || (!fi.exists() && fi.isSymLink()))) {
        return false;
    }

    return true;
}
示例#3
0
void IconView::HandleImport(void)
{
    QFileInfo path;
    QDir importdir;

#if 0
    DialogBox *importDlg = new DialogBox(GetMythMainWindow(),
                                         tr("Import pictures?"));

    importDlg->AddButton(tr("No"));
    importDlg->AddButton(tr("Yes"));
    DialogCode code = importDlg->exec();
    importDlg->deleteLater();
    if (kDialogCodeButton1 != code)
        return;
#endif

    // Makes import directory samba/windows friendly (no colon)
    QString idirname = m_currDir + "/" +
        MythDate::current().toString("yyyy-MM-dd_hh-mm-ss");

    importdir.mkdir(idirname);
    importdir.setPath(idirname);

    for (QStringList::const_iterator it = m_paths.begin();
         it != m_paths.end(); ++it)
    {
        path.setFile(*it);
        if (path.isDir() && path.isReadable())
        {
            ImportFromDir(*it, importdir.absolutePath());
        }
#if 0
        else if (path.isFile() && path.isExecutable())
        {
            // TODO this should not be enabled by default!!!
            QString cmd = *it + " " + importdir.absolutePath();
            LOG(VB_GENERAL, LOG_INFO, LOC + QString("Executing %1").arg(cmd));
            myth_system(cmd);
        }
#endif
        else
        {
            LOG(VB_GENERAL, LOG_ERR, LOC +
                QString("Could not read or execute %1").arg(*it));
        }
    }

    importdir.refresh();
    if (importdir.count() == 0)
    {
#if 0
        DialogBox *nopicsDlg = new DialogBox(GetMythMainWindow(),
                                             tr("Nothing found to import"));

        nopicsDlg->AddButton(tr("OK"));
        nopicsDlg->exec();
        nopicsDlg->deleteLater();
#endif

        return;
    }

    LoadDirectory(m_currDir);
}
示例#4
0
void set_defaults (MISC *misc, OPTIONS *options, NV_BOOL restore)
{
  if (!restore)
    {
      misc->draw_area_width = 1220;
      misc->draw_area_height = 950;
      misc->drawing_canceled = NVFalse;
      misc->feature = NULL;
      memset (&misc->bfd_header, 0, sizeof (BFDATA_HEADER));
      misc->feature_mod = NVFalse;
      misc->resized = NVTrue;
      misc->area_drawn = NVFalse;
      misc->poly_count = 0;
      misc->maxd = 10;
      misc->reference_flag = NVFalse;
      misc->slice = NVFalse;
      misc->hotkey = -1;
      misc->busy = NVFalse;
      misc->visible_feature_count = 0;
      misc->html_help_tag = "#edit_pfm";
      misc->marker_mode = 0;
      misc->frozen_point = -1;
      misc->need_sparse = NVFalse;
      misc->mask_active = NVFalse;
      misc->filter_mask = NVFalse;
      misc->filter_kill_list = NULL;
      misc->filter_kill_count = 0;
      misc->av_dist_list = NULL;
      misc->av_dist_count = 0;
      misc->filtered = NVFalse;
      misc->hydro_lidar_present = NVFalse;
      misc->lidar_present = NVFalse;
      misc->hof_present = NVFalse;
      misc->gsf_present = NVFalse;
      misc->highlight_count = 0;
      misc->highlight = NULL;
      misc->num_lines = 0;


      //  Set up the sine and cosine values for slicing.

      for (NV_INT32 i = 0 ; i < 3600 ; i++)
        {
          misc->sin_array[i] = sinf (((NV_FLOAT32) i / 10.0) * NV_DEG_TO_RAD);
          misc->cos_array[i] = cosf (((NV_FLOAT32) i / 10.0) * NV_DEG_TO_RAD);
        }


      //  Tooltip text for the buttons and actions that have editable accelerators

      misc->buttonText[SAVE_EXIT_KEY] = pfmEdit3D::tr ("Save changes and exit");
      misc->buttonText[SAVE_EXIT_MASK_KEY] = pfmEdit3D::tr ("Save changes, exit, and filter mask in pfmView");
      misc->buttonText[NO_SAVE_EXIT_KEY] = pfmEdit3D::tr ("Exit without saving changes");
      misc->buttonText[RESET_KEY] = pfmEdit3D::tr ("Reset to original view");
      misc->buttonText[DELETE_POINT_MODE_KEY] = pfmEdit3D::tr ("Select delete subrecord/record edit mode");
      misc->buttonText[DELETE_RECTANGLE_MODE_KEY] = pfmEdit3D::tr ("Select delete rectangle edit mode");
      misc->buttonText[DELETE_POLYGON_MODE_KEY] = pfmEdit3D::tr ("Select delete polygon edit mode");
      misc->buttonText[FILTER_KEY] = pfmEdit3D::tr ("Run the statistical filter");
      misc->buttonText[ATTR_FILTER_KEY] = pfmEdit3D::tr ("Run the attribute filter");
      misc->buttonText[RECTANGLE_FILTER_MASK_KEY] = pfmEdit3D::tr ("Select rectangle filter mask mode");
      misc->buttonText[POLYGON_FILTER_MASK_KEY] = pfmEdit3D::tr ("Select polygon filter mask mode");
      misc->buttonText[RUN_HOTKEY_POLYGON_MODE_KEY] = pfmEdit3D::tr ("Select run hotkey program in polygon mode");
      misc->buttonText[EDIT_FEATURE_MODE_KEY] = pfmEdit3D::tr ("Select edit feature mode");
      misc->buttonText[UNDO_KEY] = pfmEdit3D::tr ("Undo last edit operation");
      misc->buttonText[DISPLAY_MULTIPLE_KEY] = pfmEdit3D::tr ("Select display multiple lines mode");
      misc->buttonText[DISPLAY_ALL_KEY] = pfmEdit3D::tr ("Display all lines");
      misc->buttonText[CLEAR_HIGHLIGHT_KEY] = pfmEdit3D::tr ("Clear all highlighted/marked points");
      misc->buttonText[HIGHLIGHT_POLYGON_MODE_KEY] = pfmEdit3D::tr ("Select highlight/mark points in polygon mode");
      misc->buttonText[CLEAR_POLYGON_MODE_KEY] = pfmEdit3D::tr ("Select clear all highlighted/marked points in polygon mode");
      misc->buttonText[TOGGLE_CONTOUR_KEY] = pfmEdit3D::tr ("Toggle contour drawing");
      misc->buttonText[COLOR_BY_DEPTH_ACTION_KEY] = pfmEdit3D::tr ("Color by depth");
      misc->buttonText[COLOR_BY_LINE_ACTION_KEY] = pfmEdit3D::tr ("Color by line");
      misc->buttonText[AV_DISTANCE_THRESHOLD_KEY] = pfmEdit3D::tr ("CZMIL LIDAR attribute viewer distance threshold tool");


      //  Icons for the buttons and actions that have editable accelerators

      misc->buttonIcon[SAVE_EXIT_KEY] = QIcon (":/icons/exit_save.xpm");
      misc->buttonIcon[SAVE_EXIT_MASK_KEY] = QIcon (":/icons/exit_mask.xpm");
      misc->buttonIcon[NO_SAVE_EXIT_KEY] = QIcon (":/icons/exit_no_save.xpm");
      misc->buttonIcon[RESET_KEY] = QIcon (":/icons/reset_view.xpm");
      misc->buttonIcon[DELETE_POINT_MODE_KEY] = QIcon (":/icons/delete_point.xpm");
      misc->buttonIcon[DELETE_RECTANGLE_MODE_KEY] = QIcon (":/icons/delete_rect.xpm");
      misc->buttonIcon[DELETE_POLYGON_MODE_KEY] = QIcon (":/icons/delete_poly.xpm");
      misc->buttonIcon[FILTER_KEY] = QIcon (":/icons/filter.xpm");
      misc->buttonIcon[ATTR_FILTER_KEY] = QIcon (":/icons/attr_filter.xpm");
      misc->buttonIcon[RECTANGLE_FILTER_MASK_KEY] = QIcon (":/icons/filter_mask_rect.xpm");
      misc->buttonIcon[POLYGON_FILTER_MASK_KEY] = QIcon (":/icons/filter_mask_poly.xpm");
      misc->buttonIcon[RUN_HOTKEY_POLYGON_MODE_KEY] = QIcon (":/icons/hotkey_poly.xpm");
      misc->buttonIcon[EDIT_FEATURE_MODE_KEY] = QIcon (":/icons/editfeature.xpm");
      misc->buttonIcon[UNDO_KEY] = QIcon (":/icons/undo.png");
      misc->buttonIcon[DISPLAY_MULTIPLE_KEY] = QIcon (":/icons/displaylines.xpm");
      misc->buttonIcon[DISPLAY_ALL_KEY] = QIcon (":/icons/displayall.xpm");
      misc->buttonIcon[CLEAR_HIGHLIGHT_KEY] = QIcon (":/icons/clear_highlight.xpm");
      misc->buttonIcon[HIGHLIGHT_POLYGON_MODE_KEY] = QIcon (":/icons/highlight_polygon.xpm");
      misc->buttonIcon[CLEAR_POLYGON_MODE_KEY] = QIcon (":/icons/clear_polygon.xpm");
      misc->buttonIcon[TOGGLE_CONTOUR_KEY] = QIcon (":/icons/contour.xpm");
      misc->buttonIcon[COLOR_BY_DEPTH_ACTION_KEY] = QIcon (":/icons/color_by_depth.xpm");
      misc->buttonIcon[COLOR_BY_LINE_ACTION_KEY] = QIcon (":/icons/color_by_line.xpm");
      misc->buttonIcon[AV_DISTANCE_THRESHOLD_KEY] = QIcon(":/icons/distance_threshold.xpm");


      //  NULL out the buttons and actions so we can tell them apart.

      for (NV_INT32 i = 0 ; i < HOTKEYS ; i++)
        {
          misc->button[i] = NULL;
          misc->action[i] = NULL;
        }


      misc->abe_share->key = 0;
      misc->abe_share->modcode = 0;
      misc->displayed_area.min_y = -91.0;

      misc->qsettings_org = pfmEdit3D::tr ("navo.navy.mil");
      misc->qsettings_app = pfmEdit3D::tr ("pfmEdit3D");

      misc->add_feature_index = -1;
      misc->nearest_feature_point = -1;

      misc->bfd_open = NVFalse;

      misc->undo = NULL;
      misc->undo_count = 0;
      misc->time_attr = -1;
      misc->datum_attr = -1;
      misc->ellipsoid_attr = -1;
      misc->process_id = getpid ();


      //  This is a special case for an option.  We don't want to reset the undo levels if we called for a restore of defaults from the prefs dialog.

      options->undo_levels = 100;


#ifdef NVWIN3X

      misc->help_browser = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";

      QFileInfo br (misc->help_browser);

      if (!br.exists () || !br.isExecutable ()) misc->help_browser = "C:\\Program Files\\Internet Explorer\\iexplore.exe";

#else

      misc->help_browser = "firefox";

#endif
    }


  /*

    Ancillary program command line substitutions:


    [MOSAIC_FILE] - associated mosaic file name
    [TARGET_FILE] - associated feature (target) file name
    [PFM_FILE] - PFM list or handle file name
    [BIN_FILE] - PFM bin directory name
    [INDEX_FILE] - PFM index directory name
    [INPUT_FILE] - input data file associated with the current point
    [SHARED_MEMORY_ID] - ABE shared memory ID (some programs like chartsPic require this)
    [LINE] - line name associated with the current point
    [Z_VALUE] - Z value of the current point
    [X_VALUE] - X value (usually longitude) associated with the current point
    [Y_VALUE] - Y value (usually latitude) associated with the current point
    [MIN_Y] - minimum Y value in the currently displayed area
    [MIN_X] - minimum X value in the currently displayed area
    [MAX_Y] - maximum Y value in the currently displayed area
    [MAX_X] - maximum X value in the currently displayed area
    [FILE_NUMBER] - PFM input file number associated with the current point
    [LINE_NUMBER] - PFM input line number associated with the current point
    [VALIDITY] - PFM validity word for the current point
    [RECORD] - input file record number associated with the current point
    [SUBRECORD] - input file subrecord (usually beam) number associated with the current point
    [DATA_TYPE] - PFM data type of the current point

    [CL] - run this program as a command line program (creates a dialog for output)
    [SHARED_MEMORY_KEY] - Add the shared memory ID so the outboard program can track it


    Note: the commands used to be options (i.e. user modifiable but it became too complicated).
    If you change these you must update the documentation in hotkeysHelp.cpp.

    Note: Polygon eligible commands cannot have an associated button.  Associated buttons are set in pfmEdit3D.cpp.

    If you want to add or subtract programs it needs to be done here, in pfmEdit3DDef.hpp, and add or subtract buttons
    in pfmEdit3D.cpp.

  */


  options->kill_and_respawn = NVFalse;

  for (NV_INT32 i = 0 ; i < NUMPROGS ; i++)
    {
      options->kill_switch[i] = KILL_SWITCH_OFFSET + i;

      for (NV_INT32 j = 0 ; j < PFM_DATA_TYPES ; j++) options->data_type[i][j] = NVFalse;

      switch (i)
        {
        case EXAMGSF:
          options->prog[i] = "examGSF --file [INPUT_FILE] --record [RECORD]";
          options->name[i] = "examGSF";
          options->description[i] = pfmEdit3D::tr ("GSF non-graphical data viewer.  Displays data for nearest point.");
          options->data_type[i][PFM_GSF_DATA] = NVTrue;
          options->hotkey[i] = "e";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;

        case GSFMONITOR:
          options->prog[i] = "gsfMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "gsfMonitor";
          options->description[i] = pfmEdit3D::tr ("GSF non-graphical data viewer.  Displays ping data for nearest point.");
          options->data_type[i][PFM_GSF_DATA] = NVTrue;
          options->hotkey[i] = "g";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case WAVEFORMMONITOR:
          options->prog[i] = "waveformMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "waveformMonitor";
          options->description[i] = pfmEdit3D::tr ("HOF/WLF waveform monitor (PMT, APD, IR, Raman).  Displays waveform for nearest point.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_WLF_DATA] = NVTrue;
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "w";
          options->action[i] = "1,2,3,4";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case UNISIPS:
          options->prog[i] = "unisips [INPUT_FILE] -record [RECORD]";
          options->name[i] = "unisips";
          options->description[i] = 
            pfmEdit3D::tr ("UNISIPS image file graphical data viewer.  Displays image data in line containing the nearest point.");
          options->data_type[i][PFM_UNISIPS_DEPTH_DATA] = NVTrue;
          options->hotkey[i] = "u";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;


          //  For historical reasons we are using "x" to kick this off.  It used to be the "extended" information
          //  for the waveformMonitor program.

        case LIDARMONITOR:
          options->prog[i] = "lidarMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "lidarMonitor";
          options->description[i] = pfmEdit3D::tr ("HOF, TOF, WLF, HAWKEYE textual data viewer.  Displays entire record for nearest point.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_SHOALS_TOF_DATA] = NVTrue;
          options->data_type[i][PFM_HAWKEYE_HYDRO_DATA] = NVTrue;
          options->data_type[i][PFM_HAWKEYE_TOPO_DATA] = NVTrue;
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "x";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case HAWKEYEMONITOR:
          options->prog[i] = "hawkeyeMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "hawkeyeMonitor";
          options->description[i] = pfmEdit3D::tr ("HAWKEYE graphic waveform and text data viewer.  Displays data for nearest point.");
          options->data_type[i][PFM_HAWKEYE_HYDRO_DATA] = NVTrue;
          options->hotkey[i] = "h";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case CHARTSPIC:
          options->prog[i] = "chartsPic [SHARED_MEMORY_KEY]";
          options->name[i] = "chartsPic";
          options->description[i] = pfmEdit3D::tr ("HOF and TOF down-looking image viewer.  Displays nearest down-looking photo.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_SHOALS_TOF_DATA] = NVTrue;
          options->data_type[i][PFM_WLF_DATA] = NVTrue;
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "i";
          options->action[i] = "r,t";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;


          //  Don't move mosaicView from 8 unless you change the zoom check in the keypress event in pfmEdit3D.cpp
          //  to match the new number.

        case MOSAICVIEW:
          options->prog[i] = "mosaicView [SHARED_MEMORY_KEY] [MOSAIC_FILE]";
          options->name[i] = "mosaicView";
          options->description[i] = pfmEdit3D::tr ("GeoTIFF viewer for photo mosaics or other GeoTIFF files (scanned maps, etc.).");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "m";
          options->action[i] = "z,+,-";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;

        case WAVEWATERFALL_APD:
          options->prog[i] = "waveWaterfall [SHARED_MEMORY_KEY] -a";
          options->name[i] = "waveWaterfall (APD)";
          options->description[i] = 
            pfmEdit3D::tr ("HOF/WLF waveform waterfall display (APD waveform).  Displays APD waveforms for geographically nearest 9 records.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_WLF_DATA] = NVTrue;
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "a";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case WAVEWATERFALL_PMT:
          options->prog[i] = "waveWaterfall [SHARED_MEMORY_KEY] -p";
          options->name[i] = "waveWaterfall (PMT)";
          options->description[i] = 
            pfmEdit3D::tr ("HOF/WLF waveform waterfall display (PMT waveform).  Displays PMT waveforms for geographically nearest 9 records.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_WLF_DATA] = NVTrue;
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "p";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case CZMILWAVEMONITOR:
          options->prog[i] = "CZMILwaveMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "CZMILwaveMonitor";
          options->description[i] = pfmEdit3D::tr ("CZMIL waveform monitor.  Displays waveform(s) for nearest point(s).");
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "Alt+w";
          options->action[i] = "n,1,2,3,4,5";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;

        case HOFRETURNKILL:
          options->prog[i] = "hofReturnKill [SHARED_MEMORY_KEY]";
          options->name[i] = "hofReturnKill (invalidate low slope returns)";
          options->description[i] = pfmEdit3D::tr ("Kill HOF returns based on fore/back slope and amplitude.");
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->hotkey[i] = "!";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVTrue;
          options->hk_poly_filter[i] = 1;
          options->state[i] = 0;
          break;

        case HOFRETURNKILL_SWA:
          options->prog[i] = "hofReturnKill -s [SHARED_MEMORY_KEY]";
          options->name[i] = "hofReturnKill (invalidate shallow water algorithm data)";
          options->description[i] = pfmEdit3D::tr ("Kill HOF Shallow Water Algorithm or Shoreline Depth Swap data.");
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->hotkey[i] = "$";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVTrue;
          options->hk_poly_filter[i] = 1;
          options->state[i] = 0;
          break;


        case ATTRIBUTEVIEWER:
          options->prog[i] = "attributeViewer [SHARED_MEMORY_KEY]";
          options->name[i] = "attributeViewer";
          options->description[i] = pfmEdit3D::tr ("CZMIL LIDAR attribute viewer.  Analyze/edit key parameters of CZMIL LIDAR shot(s).");
          options->data_type[i][PFM_CZMIL_DATA] = NVTrue;
          options->hotkey[i] = "Alt+a";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;


        case RMSMONITOR:
          options->prog[i] = "rmsMonitor [SHARED_MEMORY_KEY]";
          options->name[i] = "rmsMonitor";
          options->description[i] = pfmEdit3D::tr ("CHARTS HOF and TOF navigation RMS textual data viewer.  Displays entire record for nearest point.");
          options->data_type[i][PFM_SHOALS_1K_DATA] = NVTrue;
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->data_type[i][PFM_SHOALS_TOF_DATA] = NVTrue;
          options->hotkey[i] = "r";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 1;
          break;


        case HOFWAVEFILTER:
          options->prog[i] = "hofWaveFilter [SHARED_MEMORY_KEY]";
          options->name[i] = "hofWaveFilter";
          options->description[i] = pfmEdit3D::tr ("CHARTS HOF waveform filter.  Checks adjacent waveforms for isolated points.");
          options->data_type[i][PFM_CHARTS_HOF_DATA] = NVTrue;
          options->hotkey[i] = "Ctrl+w";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 2;
          options->state[i] = 0;
          break;


          //  IMPORTANT NOTE: The following six functions are not ancillary programs.  If you have to add new ancillary programs,
          //  add them above these just for esthetics.

        case INVALIDATE_FEATURES:
          options->prog[i] = "INVALIDATE_FEATURES";
          options->name[i] = "INVALIDATE FEATURES";
          options->description[i] = pfmEdit3D::tr ("Invalidate all features included in the hotkey polygon.  This is an internal function.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "v";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVTrue;
          options->hk_poly_filter[i] = 1;
          options->state[i] = 0;
          break;


        case ACCEPT_FILTER_HIGHLIGHTED:
          options->prog[i] = "DELETE FILTER HIGHLIGHTED";
          options->name[i] = "DELETE FILTER HIGHLIGHTED";
          options->description[i] = pfmEdit3D::tr ("Delete points marked by the filter or highlighted.  This is an internal function.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "Del";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;


        case REJECT_FILTER_HIGHLIGHTED:
          options->prog[i] = "CLEAR FILTER HIGHLIGHTED";
          options->name[i] = "CLEAR FILTER HIGHLIGHTED";
          options->description[i] = pfmEdit3D::tr ("Clear points marked by the filter/highlighted or restore highlighted invalid points.  This is an internal function.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "Ins";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;


        case DELETE_SINGLE_POINT:
          options->prog[i] = "DELETE SINGLE POINT";
          options->name[i] = "DELETE SINGLE POINT";
          options->description[i] = pfmEdit3D::tr ("Delete single point nearest cursor in DELETE_POINT mode.  This is an internal function.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "d";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;


          //  IMPORTANT NOTE: The following two functions affect external ancillary programs.  They are used for freezing the marker
          //  or freezing all of the multi-markers.

        case FREEZE:
          options->prog[i] = "FREEZE";
          options->name[i] = "FREEZE MAIN BOX CURSOR";
          options->description[i] = pfmEdit3D::tr ("Toggle freezing of the box cursor.  This is an internal function that affects ancillary programs.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "f";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;

        case FREEZE_ALL:
          options->prog[i] = "FREEZE ALL";
          options->name[i] = "FREEZE ALL BOX CURSORS";
          options->description[i] = pfmEdit3D::tr ("Toggle freezing of all of the box cursors.  This is an internal function that affects ancillary programs.");
          options->data_type[i][PFM_UNDEFINED_DATA] = NVTrue;
          options->hotkey[i] = "Alt+f";
          options->action[i] = "";
          options->progButton[i] = NULL;
          options->hk_poly_eligible[i] = NVFalse;
          options->hk_poly_filter[i] = 0;
          options->state[i] = 0;
          break;
        }
    }


  options->min_window_size = 4.0;
  options->iho_min_window = 0;
  options->display_man_invalid = NVFalse;
  options->display_flt_invalid = NVFalse;
  options->display_contours = NVFalse;
  options->display_null = NVFalse;
  options->display_feature = 0;
  options->display_children = NVFalse;
  options->display_reference = NVFalse;
  options->display_feature_info = NVFalse;
  options->function = DELETE_POLYGON;
  options->slice_percent = 5;
  options->slice_alpha = 24;
  options->contour_width = 2;
  options->smoothing_factor = 0;
  options->point_size = 3;
  options->contour_color = QColor (255, 255, 255);
  options->edit_color = QColor (255, 255, 255, 255);
  options->marker_color = QColor (255, 255, 255, 255);
  options->ref_color[0] = QColor (255, 255, 255, 255);
  options->tracker_color = QColor (255, 255, 0, 255);
  options->background_color = QColor (0, 0, 0, 255);
  options->scale_color = QColor (255, 255, 255, 255);
  options->feature_color = QColor (255, 255, 255, 128);
  options->feature_info_color = QColor (255, 255, 255, 255);
  options->feature_highlight_color = QColor (255, 0, 0, 255);
  options->verified_feature_color = QColor (0, 255, 0, 128);
  options->feature_size = 0.01;
  options->unload_prog = "pfm_unload";
  options->auto_unload = NVFalse;
  options->last_rock_feature_desc = 4;
  options->last_offshore_feature_desc = 17;
  options->last_light_feature_desc = 9;
  options->last_lidar_feature_desc = 0;
  options->last_feature_description = "";
  options->last_feature_remarks = "";
  options->overlap_percent = 5;
  options->feature_dir = ".";
  options->main_button_icon_size = 24;
  options->rotation_increment = 5.0;
  options->color_index = 0;
  options->flag_index = PRE_USER - 10;
  options->sparse_limit = 250000;
  options->exaggeration = 3.0;
  options->zoom_percent = 10;
  options->screenshot_delay = 2;
  options->draw_scale = NVTrue;
  options->zx_rotation = 0.0;
  options->y_rotation = 0.0;
  options->filterSTD = 2.4;
  options->deep_filter_only = NVFalse;
  options->feature_radius = 20.0;
  options->drawingMode = NVMAPGL_RENDER_POINT_MODE;
  options->objectWidth = 0.002;
  options->objectDivisionals = 8;
  options->distThresh = 4.0;
  options->auto_scale = NVTrue;
  options->hofWaveFilter_search_radius = 2.0;
  options->hofWaveFilter_search_width = 8;
  options->hofWaveFilter_rise_threshold = 5;
  options->hofWaveFilter_pmt_ac_zero_offset_required = 10;
  options->hofWaveFilter_apd_ac_zero_offset_required = 5;


  //  Default to red-blue, unlocked, 0.0 for all color bands.

  for (NV_INT32 i = 0 ; i < NUM_HSV ; i++)
    {
      options->min_hsv_color[i] = 0;
      options->max_hsv_color[i] = 240;
      options->min_hsv_locked[i] = NVFalse;
      options->max_hsv_locked[i] = NVFalse;
      options->min_hsv_value[i] = 0.0;
      options->max_hsv_value[i] = 0.0;
    }


  //  Now change the color by depth default to red-magenta.

  options->max_hsv_color[0] = 315;


  // 
  //  Set the multi-waveform cursor colors.  MAX_STACK_POINTS is 9 so we manually define 9 colors.
  //  If MAX_STACK_POINTS gets changed you should add/subtract.
  //

  // white

  misc->abe_share->mwShare.multiColors[0].r = 255;
  misc->abe_share->mwShare.multiColors[0].g = 255;
  misc->abe_share->mwShare.multiColors[0].b = 255;
  misc->abe_share->mwShare.multiColors[0].a = 255;


  // red 

  misc->abe_share->mwShare.multiColors[1].r = 255;
  misc->abe_share->mwShare.multiColors[1].g = 0;
  misc->abe_share->mwShare.multiColors[1].b = 0;
  misc->abe_share->mwShare.multiColors[1].a = 255;


  // yellow 

  misc->abe_share->mwShare.multiColors[2].r = 255;
  misc->abe_share->mwShare.multiColors[2].g = 255;
  misc->abe_share->mwShare.multiColors[2].b = 0;
  misc->abe_share->mwShare.multiColors[2].a = 255;


  // green

  misc->abe_share->mwShare.multiColors[3].r = 0;
  misc->abe_share->mwShare.multiColors[3].g = 255;
  misc->abe_share->mwShare.multiColors[3].b = 0;
  misc->abe_share->mwShare.multiColors[3].a = 255;


  // cyan

  misc->abe_share->mwShare.multiColors[4].r = 0;
  misc->abe_share->mwShare.multiColors[4].g = 255;
  misc->abe_share->mwShare.multiColors[4].b = 255;
  misc->abe_share->mwShare.multiColors[4].a = 255;


  // blue

  misc->abe_share->mwShare.multiColors[5].r = 0;
  misc->abe_share->mwShare.multiColors[5].g = 0;
  misc->abe_share->mwShare.multiColors[5].b = 255;
  misc->abe_share->mwShare.multiColors[5].a = 255;


  // orange

  misc->abe_share->mwShare.multiColors[6].r = 153;
  misc->abe_share->mwShare.multiColors[6].g = 128;
  misc->abe_share->mwShare.multiColors[6].b = 0;
  misc->abe_share->mwShare.multiColors[6].a = 255;


  // magenta

  misc->abe_share->mwShare.multiColors[7].r = 128;
  misc->abe_share->mwShare.multiColors[7].g = 0;
  misc->abe_share->mwShare.multiColors[7].b = 255;
  misc->abe_share->mwShare.multiColors[7].a = 255;


  // dark green

  misc->abe_share->mwShare.multiColors[8].r = 0;
  misc->abe_share->mwShare.multiColors[8].g = 153;
  misc->abe_share->mwShare.multiColors[8].b = 0;
  misc->abe_share->mwShare.multiColors[8].a = 255;


  for (NV_INT32 i = 0 ; i < MAX_STACK_POINTS ; i++)
    {
      options->waveColor[i].setRgb (misc->abe_share->mwShare.multiColors[i].r, misc->abe_share->mwShare.multiColors[i].g,
                                    misc->abe_share->mwShare.multiColors[i].b);
      options->waveColor[i].setAlpha (misc->abe_share->mwShare.multiColors[i].a);
    }


  options->buttonAccel[SAVE_EXIT_KEY] = "Ctrl+s";
  options->buttonAccel[SAVE_EXIT_MASK_KEY] = "Ctrl+f";
  options->buttonAccel[NO_SAVE_EXIT_KEY] = "Ctrl+q";
  options->buttonAccel[RESET_KEY] = "Ctrl+r";
  options->buttonAccel[DELETE_POINT_MODE_KEY] = "F3";
  options->buttonAccel[DELETE_RECTANGLE_MODE_KEY] = "F4";
  options->buttonAccel[DELETE_POLYGON_MODE_KEY] = "F5";
  options->buttonAccel[FILTER_KEY] = "F6";
  options->buttonAccel[ATTR_FILTER_KEY] = "Ctrl+a";
  options->buttonAccel[RECTANGLE_FILTER_MASK_KEY] = "F7";
  options->buttonAccel[POLYGON_FILTER_MASK_KEY] = "F8";
  options->buttonAccel[RUN_HOTKEY_POLYGON_MODE_KEY] = "F9";
  options->buttonAccel[EDIT_FEATURE_MODE_KEY] = "F10";
  options->buttonAccel[UNDO_KEY] = "Ctrl+z";
  options->buttonAccel[DISPLAY_MULTIPLE_KEY] = "F11";
  options->buttonAccel[DISPLAY_ALL_KEY] = "F12";
  options->buttonAccel[CLEAR_HIGHLIGHT_KEY] = "Ctrl+h";
  options->buttonAccel[HIGHLIGHT_POLYGON_MODE_KEY] = "Ctrl+p";
  options->buttonAccel[CLEAR_POLYGON_MODE_KEY] = "Ctrl+c";
  options->buttonAccel[TOGGLE_CONTOUR_KEY] = "Alt+c";
  options->buttonAccel[COLOR_BY_DEPTH_ACTION_KEY] = "Ctrl+d";
  options->buttonAccel[COLOR_BY_LINE_ACTION_KEY] = "Ctrl+l";
  options->buttonAccel[AV_DISTANCE_THRESHOLD_KEY] = "Alt+d";
}
示例#5
0
bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInfo &fi) const
{
    Q_ASSERT(!fileName.isEmpty());

    // filter . and ..?
    const int fileNameSize = fileName.size();
    const bool dotOrDotDot = fileName[0] == QLatin1Char('.')
                             && ((fileNameSize == 1)
                                 ||(fileNameSize == 2 && fileName[1] == QLatin1Char('.')));
    if ((filters & QDir::NoDot) && dotOrDotDot && fileNameSize == 1)
        return false;
    if ((filters & QDir::NoDotDot) && dotOrDotDot && fileNameSize == 2)
        return false;
    if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) // ### Qt5 remove (NoDotAndDotDot == NoDot|NoDotDot)
        return false;

    // name filter
#ifndef QT_NO_REGEXP
    // Pass all entries through name filters, except dirs if the AllDirs
    if (!nameFilters.isEmpty() && !((filters & QDir::AllDirs) && fi.isDir())) {
        bool matched = false;
        for (QVector<QRegExp>::const_iterator iter = nameRegExps.constBegin(),
                                              end = nameRegExps.constEnd();
                iter != end; ++iter) {

            if (iter->exactMatch(fileName)) {
                matched = true;
                break;
            }
        }
        if (!matched)
            return false;
    }
#endif
    // skip symlinks
    const bool skipSymlinks = (filters & QDir::NoSymLinks);
    const bool includeSystem = (filters & QDir::System);
    if(skipSymlinks && fi.isSymLink()) {
        // The only reason to save this file is if it is a broken link and we are requesting system files.
        if(!includeSystem || fi.exists())
            return false;
    }

    // filter hidden
    const bool includeHidden = (filters & QDir::Hidden);
    if (!includeHidden && !dotOrDotDot && fi.isHidden())
        return false;

    // filter system files
    if (!includeSystem && (!(fi.isFile() || fi.isDir() || fi.isSymLink())
                    || (!fi.exists() && fi.isSymLink())))
        return false;

    // skip directories
    const bool skipDirs = !(filters & (QDir::Dirs | QDir::AllDirs));
    if (skipDirs && fi.isDir())
        return false;

    // skip files
    const bool skipFiles    = !(filters & QDir::Files);
    if (skipFiles && fi.isFile())
        // Basically we need a reason not to exclude this file otherwise we just eliminate it.
        return false;

    // filter permissions
    const bool filterPermissions = ((filters & QDir::PermissionMask)
                                    && (filters & QDir::PermissionMask) != QDir::PermissionMask);
    const bool doWritable = !filterPermissions || (filters & QDir::Writable);
    const bool doExecutable = !filterPermissions || (filters & QDir::Executable);
    const bool doReadable = !filterPermissions || (filters & QDir::Readable);
    if (filterPermissions
        && ((doReadable && !fi.isReadable())
            || (doWritable && !fi.isWritable())
            || (doExecutable && !fi.isExecutable()))) {
        return false;
    }

    return true;
}
示例#6
0
void DataInput::start()
{
    QNetworkRequest nr;
    QString url;
    //qDebug() << "DataInput:start:"<<type<<":"<<input->arg1();

    if( type == "ifttt" ) {
        // url = "http://api.thingm.com/blink1/eventsall/" + iftttKey;
        url = "http://feed.thingm.com/blink1/eventsall/" + iftttKey;
        //url = "http://localhost:3232/blink1/eventsall/" + iftttKey;
        nr.setUrl(QUrl(url));
        reply = networkManager->get(nr);
        connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError()));
    }
    else if( type == "url" ) { 
        url = input->arg1();
        //qDebug() << "datainput:start url: "<<url; 
        if(!url.startsWith("http://") && !url.startsWith("https://"))
            url="http://"+url;
        QUrl correctUrl(url);
        if(correctUrl.isValid()) {
            nr.setUrl(QUrl(url));
            reply = networkManager->get(nr);
            connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
            connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError()));
        }
        else {
            input->setArg2("Bad URL");
            input->setDate(-1);  // FIXME: don't like -1 here
            emit toDelete(this);
        }
    }
    else if( type == "file" ) { 
        QFileInfo fileInfo;
        fileInfo.setFile(input->arg1());
        if( !fileInfo.exists() ) {
            qDebug() << "datainput:start: no file";
            input->setArg2("Not Found");
            input->setDate(-1);
        }
        else { 
            int lastModTime = fileInfo.lastModified().toTime_t(); // why was cast to uint?
            if( lastModTime > input->date()) {
                qDebug() << "datainput:start: file newer";
                QFile f(input->arg1());
                if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
                    input->setArg2("Couldn't Open");
                    input->setDate(-1);  // FIXME: why -1? what does it mean?
                    emit toDelete(this);
                    return;
                }
                input->setDate( lastModTime); //fileInfo.lastModified().toTime_t());
                QString txt = "";
                QTextStream in(&f);
                txt.append(in.readAll());

                bool good = parsePatternOrColor( txt, type, lastModTime );
                if( !good ) { 
                    input->setArg2("Bad Parse");
                }
            } // last modified
            else { 
                //input->setArg2("Old File");  // FIXME: should do something to indicate older file
                //input->setDate(-1);
            }
        }
        emit toDelete(this);
    }
    else if( type == "script" ) { 
        //QString path = QStandardPaths::locate(QStandardPaths::DocumentsLocation, input->arg1());
        QFileInfo fileInfo;
        fileInfo.setFile( input->arg1() );
        if( !fileInfo.exists() ) {
            input->setArg2("Not Found");
            input->setDate(-1);
            emit toDelete(this);
        } 
        else if( !fileInfo.isExecutable() ) { 
            input->setArg2("Not Executable");
            input->setDate(-1);
            emit toDelete(this);
        }
        else { 
            // FIXME: should check new value compare to lastVal
            // (and FIXME: need to refactor to properly use lastVal for all monitor types)
            //if(fileInfo.lastModified().toTime_t() != (uint)input->date()){
            // no, don't do lastModTime check on exec file, jeez
            input->setDate(fileInfo.lastModified().toTime_t());
            process = new QProcess;
            connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(onProcessOutput()));
            connect(process, SIGNAL(readyReadStandardError()), this, SLOT(onError()));
            connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError()));
            connect(process, SIGNAL(finished(int)), this, SLOT(onProcessFinished()));
            // start process running
            process->start( fileInfo.canonicalFilePath() );
        }
    }
示例#7
0
文件: iconview.cpp 项目: mhyon/mythtv
void IconView::HandleImport(void)
{
    QFileInfo path;
    QDir importdir;

    // Makes import directory samba/windows friendly (no colon)
    QString idirname = m_currDir + "/" +
        MythDate::current().toString("yyyy-MM-dd_hh-mm-ss");

    importdir.mkdir(idirname);
    importdir.setPath(idirname);

    for (QStringList::const_iterator it = m_paths.begin();
         it != m_paths.end(); ++it)
    {
        path.setFile(*it);
        if (path.isDir() && path.isReadable())
        {
            ImportFromDir(*it, importdir.absolutePath());
        }
        else if (path.isFile() && path.isExecutable())
        {
            if (m_allowImportScripts)
            {
                QString cmd = *it + " " + importdir.absolutePath();

                MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
                MythUIBusyDialog *busy =
                        new MythUIBusyDialog(tr("Importing images from camera. Please wait..."),
                                                popupStack,
                                                "importbusydialog");

                if (busy->Create())
                {
                    popupStack->AddScreen(busy, false);
                }
                else
                {
                    delete busy;
                    busy = NULL;
                }

                ImportThread *import = new ImportThread(cmd);
                import->start();

                while (!import->isFinished())
                {
                    usleep(500);
                    qApp->processEvents();
                }

                delete import;

                if (busy)
                    busy->Close();
            }
            else
            {
                ShowOkPopup(tr("Found an import script (%1) but running them has been disabled in the settings!")
                               .arg(*it));
                importdir.rmdir(importdir.absolutePath());
                return;
            }
        }
        else
        {
            LOG(VB_GENERAL, LOG_ERR, LOC +
                QString("Could not read or execute %1").arg(*it));

            ShowOkPopup(tr("Could not read or execute %1").arg(*it));
        }
    }

    importdir.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
    importdir.refresh();
    if (importdir.count() == 0)
    {
        ShowOkPopup(tr("Nothing found to import"));
        importdir.rmdir(importdir.absolutePath());
        return;
    }
    else
        ShowOkPopup(tr("Found %1 images").arg(importdir.count()));

    LoadDirectory(m_currDir);
}
示例#8
0
QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
{
    QIcon retIcon;
    QString fileExtension = fi.suffix().toUpper();
    fileExtension.prepend(QLatin1String("."));

    const QString keyBase = QLatin1String("qt_") + fileExtension;

    QPixmap pixmap;
    if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
        QPixmapCache::find(keyBase + QLatin1String("16"), pixmap);
    }

    if (!pixmap.isNull()) {
        retIcon.addPixmap(pixmap);
        if (QPixmapCache::find(keyBase + QLatin1String("32"), pixmap)) {
            retIcon.addPixmap(pixmap);
            if (QPixmapCache::find(keyBase + QLatin1String("64"), pixmap)) {
                retIcon.addPixmap(pixmap);
                if (QPixmapCache::find(keyBase + QLatin1String("128"), pixmap)) {
                    retIcon.addPixmap(pixmap);
                    return retIcon;
                }
            }
        }
    }


    FSRef macRef;
    OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fi.canonicalFilePath().toUtf8().constData()),
                                    &macRef, 0);
    if (status != noErr)
        return retIcon;
    FSCatalogInfo info;
    HFSUniStr255 macName;
    status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0);
    if (status != noErr)
        return retIcon;
    IconRef iconRef;
    SInt16 iconLabel;
    status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
                                    kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
                                    &iconRef, &iconLabel);
    if (status != noErr)
        return retIcon;
    qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon);
    ReleaseIconRef(iconRef);

    if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
        pixmap = retIcon.pixmap(16);
        QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
        pixmap = retIcon.pixmap(32);
        QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
        pixmap = retIcon.pixmap(64);
        QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
        pixmap = retIcon.pixmap(128);
        QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
    }

    return retIcon;
}
示例#9
0
/*!
    returns a string containing the general information about the file \c name
    and some content specific information
    (number of columns and lines for ASCII, color-depth for images etc.).
 */
QString FileDataSource::fileInfoString(const QString &name){
	QString infoString;
	QFileInfo fileInfo;
	QString fileTypeString;
	QIODevice *file = new QFile(name);

	QString fileName;
    if (name.at(0) != QDir::separator()) {
        fileName = QDir::homePath() + QDir::separator() + name;
    } else {
        fileName = name;
	}

	if(file==0)
		file = new QFile(fileName);

	if (file->open(QIODevice::ReadOnly)){
		QStringList infoStrings;

		//general information about the file
		infoStrings << "<u><b>" + fileName + "</b></u><br>";
		fileInfo.setFile(fileName);

		infoStrings << i18n("Readable: %1", fileInfo.isReadable() ? i18n("yes") : i18n("no"));

		infoStrings << i18n("Writable: %1", fileInfo.isWritable() ? i18n("yes") : i18n("no"));

		infoStrings << i18n("Executable: %1", fileInfo.isExecutable() ? i18n("yes") : i18n("no"));

		infoStrings << i18n("Created: %1", fileInfo.created().toString());
		infoStrings << i18n("Last modified: %1", fileInfo.lastModified().toString());
		infoStrings << i18n("Last read: %1", fileInfo.lastRead().toString());
		infoStrings << i18n("Owner: %1", fileInfo.owner());
		infoStrings << i18n("Group: %1", fileInfo.group());
		infoStrings << i18n("Size: %1", i18np("%1 cByte", "%1 cBytes", fileInfo.size()));

#ifdef HAVE_FITS
        if (fileName.endsWith(QLatin1String(".fits"))) {
            FITSFilter* fitsFilter = new FITSFilter;

            infoStrings << i18n("Images: %1", QString::number(fitsFilter->imagesCount(fileName) ));
            infoStrings << i18n("Tables: %1", QString::number(fitsFilter->tablesCount(fileName) ));

            delete fitsFilter;
        }
#endif

		// file type and type specific information about the file
#ifdef Q_OS_LINUX
		QProcess *proc = new QProcess();
		QStringList args;
		args<<"-b"<<fileName;
		proc->start( "file", args);

		if(proc->waitForReadyRead(1000) == false){
			infoStrings << i18n("Could not open file %1 for reading.", fileName);
		}else{
			fileTypeString = proc->readLine();
			if( fileTypeString.contains(i18n("cannot open")) )
				fileTypeString="";
			else {
				fileTypeString.remove(fileTypeString.length()-1,1);	// remove '\n'
			}
		}
		infoStrings << i18n("File type: %1", fileTypeString);
#endif

		//TODO depending on the file type, generate additional information about the file:
		//Number of lines for ASCII, color-depth for images etc. Use the specific filters here.
		// port the old labplot1.6 code.
		if( fileTypeString.contains("ASCII")){
			infoStrings << "<br/>";
			infoStrings << i18n("Number of columns: %1", AsciiFilter::columnNumber(fileName));

			infoStrings << i18n("Number of lines: %1", AsciiFilter::lineNumber(fileName));
		}
		infoString += infoStrings.join("<br/>");
	} else{
		infoString += i18n("Could not open file %1 for reading.", fileName);
	}

	return infoString;
}
示例#10
0
bool QDir::readDirEntries( const QString &nameFilter,
                           int filterSpec, int sortSpec )
{
    int i;
    if ( !fList ) {
        fList  = new QStringList;
        CHECK_PTR( fList );
        fiList = new QFileInfoList;
        CHECK_PTR( fiList );
        fiList->setAutoDelete( TRUE );
    } else {
        fList->clear();
        fiList->clear();
    }

    QStringList filters = qt_makeFilterList( nameFilter );

    bool doDirs	    = (filterSpec & Dirs)	!= 0;
    bool doFiles    = (filterSpec & Files)	!= 0;
    bool noSymLinks = (filterSpec & NoSymLinks) != 0;
    bool doReadable = (filterSpec & Readable)	!= 0;
    bool doWritable = (filterSpec & Writable)	!= 0;
    bool doExecable = (filterSpec & Executable) != 0;
    bool doHidden   = (filterSpec & Hidden)	!= 0;

#if defined(_OS_OS2EMX_)
    //QRegExp   wc( nameFilter, FALSE, TRUE );	// wild card, case insensitive
#else
    //QRegExp   wc( nameFilter, TRUE, TRUE );	// wild card, case sensitive
#endif
    QFileInfo fi;
    DIR	     *dir;
    dirent   *file;

    dir = opendir( QFile::encodeName(dPath) );
    if ( !dir ) {
#if defined(CHECK_NULL)
        qWarning( "QDir::readDirEntries: Cannot read the directory: %s",
                  QFile::encodeName(dPath).data() );
#endif
        return FALSE;
    }

    while ( (file = readdir(dir)) ) {
        QString fn = QFile::decodeName(file->d_name);
        fi.setFile( *this, fn );
        if ( !match( filters, fn ) && !(allDirs && fi.isDir()) )
            continue;
        if  ( (doDirs && fi.isDir()) || (doFiles && fi.isFile()) ) {
            if ( noSymLinks && fi.isSymLink() )
                continue;
            if ( (filterSpec & RWEMask) != 0 )
                if ( (doReadable && !fi.isReadable()) ||
                        (doWritable && !fi.isWritable()) ||
                        (doExecable && !fi.isExecutable()) )
                    continue;
            if ( !doHidden && fn[0] == '.' &&
                    fn != QString::fromLatin1(".")
                    && fn != QString::fromLatin1("..") )
                continue;
            fiList->append( new QFileInfo( fi ) );
        }
    }
    if ( closedir(dir) != 0 ) {
#if defined(CHECK_NULL)
        qWarning( "QDir::readDirEntries: Cannot close the directory: %s",
                  dPath.local8Bit().data() );
#endif
    }

    // Sort...
    if(fiList->count()) {
        QDirSortItem* si= new QDirSortItem[fiList->count()];
        QFileInfo* itm;
        i=0;
        for (itm = fiList->first(); itm; itm = fiList->next())
            si[i++].item = itm;
        qt_cmp_si_sortSpec = sortSpec;
        qsort( si, i, sizeof(si[0]), qt_cmp_si );
        // put them back in the list
        fiList->setAutoDelete( FALSE );
        fiList->clear();
        int j;
        for ( j=0; j<i; j++ ) {
            fiList->append( si[j].item );
            fList->append( si[j].item->fileName() );
        }
        delete [] si;
        fiList->setAutoDelete( TRUE );
    }

    if ( filterSpec == (FilterSpec)filtS && sortSpec == (SortSpec)sortS &&
            nameFilter == nameFilt )
        dirty = FALSE;
    else
        dirty = TRUE;
    return TRUE;
}
示例#11
0
void SplitVideo::startMencoder()
{
    QTime t;

    int startTime = t.secsTo( ui->teFrom->time() );
    int endTime = t.secsTo( ui->teTo->time() );

    QFileInfo fi;

    QString inputFile = m_core->mdat.filename;
    QString outputFile;

    fi.setFile( m_core->mdat.filename );

    if ( m_core->mdat.type == TYPE_DVD || m_core->mdat.type == TYPE_VCD )
    {
        outputFile = QDesktopServices::storageLocation( QDesktopServices::MoviesLocation ) + tr( "/Movie_" ) +
                QString::number( startTime ) + "_" +
                QString::number( endTime ) + ".avi";
    }
    else
    {
        outputFile = fi.absolutePath() + "/" + fi.baseName() + "_" +
                QString::number( startTime ) + "_" +
                QString::number( endTime ) + "." + fi.suffix();
    }
    outputFile = getNewFileName( outputFile );

    if ( !canWriteTo( outputFile ) )
    {
        qDebug("SplitVideo::startMencoder():   cannot trim video ( maybe your disk is mounted read-only? )");
        outputFile = QDesktopServices::storageLocation( QDesktopServices::MoviesLocation ) + "/" +
                fi.baseName() + "_" +
                QString::number( startTime ) + "_" +
                QString::number( endTime ) + "." + fi.suffix();
        outputFile = getNewFileName( outputFile );
    }

    qDebug("SplitVideo::startMencoder():   outputFile is %s", outputFile.toLocal8Bit().data() );

    // we cannot splitting if time is not valid
    if ( !checkTime( startTime, endTime ) )
        return;

    if ( !checkDiskSpace( outputFile, endTime - startTime, m_core->mdat.duration ) )
    {
        ui->labelError->setText( tr( "Cannot trim video ( maybe you have no enough disk space? )" ) );
        return;
    }

    m_isStopMencoder = false;
    m_error = -1;
    m_startTime = startTime;
    m_endTime = endTime;
    m_inputFile = inputFile;
    m_outputFile = outputFile;

    // Use absolute path, otherwise after changing to the screenshot directory
    // the mencoder path might not be found if it's a relative path
    // (seems to be necessary only for linux)
    QString mencoder_bin = pref->mencoder_bin;
    fi.setFile( mencoder_bin );
    if ( fi.exists() && fi.isExecutable() && !fi.isDir() )
    {
        mencoder_bin = fi.absoluteFilePath();
    }

    m_proc->clearArguments();
    m_proc->addArgument( mencoder_bin );
    m_proc->addArgument( m_inputFile );
    m_proc->addArgument( "-oac" );
    if ( m_isCutError )
        m_proc->addArgument( "pcm" );
    else
        m_proc->addArgument( "copy" );
    m_proc->addArgument( "-ovc" );
    m_proc->addArgument( "copy" );
    m_proc->addArgument( "-ss" );
    m_proc->addArgument( QString::number( m_startTime ) );
    m_proc->addArgument( "-endpos" );
    m_proc->addArgument( QString::number( m_endTime - m_startTime ) );
    m_proc->addArgument( "-o" );
    m_proc->addArgument( m_outputFile );

    QString commandline = m_proc->arguments().join(" ");
    qDebug("SplitVideo::startMencoder: command: '%s'", commandline.toUtf8().data());

    if ( !m_proc->start() ) {
        // error handling
        qWarning("SplitVideo::startMencoder: mencoder process didn't start");
    }

    updateControls();
}
示例#12
0
/** Creates the \c ls command result 
  *
  * It creates it in the packetData string.
  *
  */
void RainbruRPG::Network::Ftp::FtpTransfer::lsResult(){
  LOGI("LIST command result :");
  packetData="";
  unsigned int childs=1;

  QDir dir(currentDirectory );
  dir.setFilter(QDir::Dirs| QDir::Files| QDir::NoSymLinks);
  dir.setSorting(QDir::Name);

  QFileInfoList list = dir.entryInfoList();

  LOGCATS("Sending ");
  LOGCATI(list.size());
  LOGCATS(" files.");
  LOGCAT();

  for (int i = 0; i < list.size(); ++i) {
    QFileInfo fileInfo = list.at(i);

    // ====== User permissions
    // Diretory ?
    if (fileInfo.isDir()){
      packetData+="d";

      QDir dir2(fileInfo.absoluteFilePath());
      childs=dir2.count();

    }
    else{
      packetData+="-";
      childs=1;
    }

    packetData+=filePermissions(fileInfo.isReadable(),fileInfo.isWritable(),
				fileInfo.isExecutable());

    packetData+=filePermissions(fileInfo.permission(QFile::ReadGroup),
				fileInfo.permission(QFile::WriteGroup),
				fileInfo.permission(QFile::ExeGroup));

    packetData+=filePermissions(fileInfo.permission(QFile::ReadOther),
				fileInfo.permission(QFile::WriteOther),
				fileInfo.permission(QFile::ExeOther));

    // Child number
    QString sChild;
    sChild.setNum(childs);
    sChild=sChild.rightJustified(5);
    packetData+=sChild;

    // Owner and group names
    packetData+=' ';
    QString sOwner=fileInfo.owner();
    sOwner=sOwner.leftJustified(9);
    packetData+=sOwner;
    QString sGroup=fileInfo.group();
    sGroup=sGroup.leftJustified(9);
    packetData+=sGroup;

    // File size
    qint64 size=fileInfo.size();

    QString sSize=fileSizeToString(size);
    sSize=sSize.rightJustified(8);
    packetData+=sSize;

    // Last modified time
    packetData+=" ";
    QDateTime dt=fileInfo.lastModified();
    packetData+=dt.toString("yyyy-MM-dd hh:mm");

    // File name and EOL
    packetData+=" ";
    packetData+=fileInfo.fileName();
    packetData+="\n";
  }
  LOGI("PacketData done. LIST result can be sent");
  int i=  packetData.size();
  LOGCATS("PacketData lenght :");
  LOGCATI(i);
  LOGCAT();
}
示例#13
0
//*******************************************************************
// enter                                                PRIVATE slot
//*******************************************************************
void QBtView::enter( const QModelIndex& in_index )
{
   const QString fname = model_->file_full_name( in_index ); // tak ma byc ze wzgledu na ..
   const QFileInfo fi( model_->file_path( in_index ) );
   const QString fpath = fi.absoluteFilePath();
   const QString dir = fi.absolutePath();
   
   if( fi.isDir() ) {                                 // KATALOG
      if( fi.isExecutable() && fi.isReadable() ) {
         if( ".." == fname ) {
            one_level_up();
         }
         else {
            initial_file_stack_.push( fi.fileName() );
            requests_.push( GOTO_TOP );
            model_->update( fpath );
         }
      }
      return;
   }
   else {                                             // PLIK (NIE KATALOG)
      if( fi.isExecutable() ) {                       // wykonywalne
#if !_WIN32
         if( QBtShared::is_binary_file( fpath ) ) {   // program
            static const QString PRG = "%1 &";
            system( PRG.arg( fpath ).toLocal8Bit() );
         }
         else {                                       // skrypt
            static const QString GNOME = "gnome-terminal --working-directory=%1 --command=%2";
            static const QString KDE = "konsole --workdir %1 -e %2";
            const QString cmd = QBtShared::is_gnome() ? GNOME : KDE;
            system( cmd.arg( dir ).arg( fpath ).toLocal8Bit() );
         }
#else
          ShellExecuteA(NULL, "open", fpath.toLocal8Bit(), NULL, dir.toLocal8Bit(), SW_SHOWNORMAL);
#endif
      }
      else {                                          // ZWYKLY PLIK
         const QString ext = fi.suffix().toLower();
         QString prg = QString();
         QString par = QString();
         if( is_ext_declared( ext, prg, par  ) ) {
            par.replace( "$dir", fi.absolutePath() );
            par.replace( "$name", fi.fileName() );
            par.replace( "$path", fi.absoluteFilePath() );
            const QString cmd = "\"%1\" \"%2\" &";
            system( cmd.arg( prg ).arg( par ).toLocal8Bit() );
         }
         else {
#if !_WIN32
            static const QString GNOME = "gnome-open %1";
            static const QString KDE   = "kfmclient exec %1";
            const QString cmd = QBtShared::is_gnome() ? GNOME : KDE;
            system( cmd.arg( fpath ).toLocal8Bit() );
#else
             ShellExecuteA(NULL, "open", fpath.toLocal8Bit(), NULL, dir.toLocal8Bit(), SW_SHOWNORMAL);
#endif
         }
      }
   }
}