Esempio n. 1
0
void CardiacMeshReaderUI::connectSignals() {

  // Page 1
  connect(directoryEdit, SIGNAL(editingFinished()), this, SLOT(newDirectory()));
  connect(directoryChooser, SIGNAL(clicked()), this, SLOT(dirChooser()));
  connect(p1NextButton, SIGNAL(clicked()), this, SLOT(page1Next()));
  connect(p1FinishButton, SIGNAL(clicked()), this, SLOT(page1Finish()));

  // Page 2
  minSliceSlider->setMinimum(0);
  maxSliceSlider->setMinimum(0);

  connect(directoryEditMesh, SIGNAL(editingFinished()), this, SLOT(newDirectoryMesh()));
  connect(directoryChooserMesh, SIGNAL(clicked()), this, SLOT(dirChooserMesh()));
  connect(minSliceSlider, SIGNAL(valueChanged(int)), this, SLOT(minSliderChanged(int)));
  connect(maxSliceSlider, SIGNAL(valueChanged(int)), this, SLOT(maxSliderChanged(int)));
  connect(p2BackButton, SIGNAL(clicked()), this, SLOT(page2Back()));
  connect(p2NextButton, SIGNAL(clicked()), this, SLOT(page2Next()));
  connect(p2FinishButton, SIGNAL(clicked()), this, SLOT(page2Finish()));

  // Page 3
  connect(nameLineEdit, SIGNAL(editingFinished()), this, SLOT(namesChanged()));
  connect(meshNameLineEdit, SIGNAL(editingFinished()), this, SLOT(namesChanged()));
  connect(p3BackButton, SIGNAL(clicked()), this, SLOT(page3Back()));
  connect(p3FinishButton, SIGNAL(clicked()), this, SLOT(page3Finish()));
}
bool QtFileIconView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break;
    case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break;
    case 2: newDirectory(); break;
    case 3: currentDir(); break;
    case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break;
    case 6: viewLarge(); break;
    case 7: viewSmall(); break;
    case 8: viewBottom(); break;
    case 9: viewRight(); break;
    case 10: flowEast(); break;
    case 11: flowSouth(); break;
    case 12: itemTextTruncate(); break;
    case 13: itemTextWordWrap(); break;
    case 14: sortAscending(); break;
    case 15: sortDescending(); break;
    case 16: arrangeItemsInGrid(); break;
    case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 18: openFolder(); break;
    default:
	return QIconView::qt_invoke( _id, _o );
    }
    return TRUE;
}
Esempio n. 3
0
void QtFileIconView::keyPressEvent( QKeyEvent *e )
{
    if ( e->key() == Key_N &&
            ( e->state() & ControlButton ) )
        newDirectory();
    else
        QIconView::keyPressEvent( e );
}
Esempio n. 4
0
//! Popup a dialog box to choose a directory
void CardiacMeshReaderUI::dirChooser() {
  QString dir;
  QDir lastDirUp = QDir(m_lastDir);
  lastDirUp.cdUp();
  dir = QFileDialog::getExistingDirectory(this, "Select DICOM Directory", lastDirUp.path(), QFileDialog::ShowDirsOnly);

  if (dir != "") {
    // The user did select a directory.
    directoryEdit->setText(dir);
    newDirectory();
  }
}
Esempio n. 5
0
void MainWindow::on_treeView_customContextMenuRequested(QPoint pos)
{
    QMenu *menu = new QMenu;
    QAction *action;

    action = new QAction(tr("&New"), this);
    action->setToolTip(tr("Create a new directory"));
    connect(action, SIGNAL(triggered()), this, SLOT(newDirectory()));
    menu->addAction(action);

    action = new QAction(tr("&Remove"), this);
    action->setToolTip(tr("Remove directory"));
    if (ui->treeView->selectionModel()->selection().isEmpty())
        action->setEnabled(false);
    connect(action, SIGNAL(triggered()), this, SLOT(removeDirectory()));
    menu->addAction(action);

    menu->exec(ui->treeView->mapToGlobal(pos));
}
Esempio n. 6
0
//-----------------------------------------------------------------------------
void ctkDirectoryButton::setDirectory(const QString& dir)
{
  Q_D(ctkDirectoryButton);
  QDir newDirectory(dir);

  if (d->Directory == newDirectory)
    {
    emit directorySelected(d->DisplayAbsolutePath ?
                           newDirectory.absolutePath() :
                           newDirectory.path());
    return;
    }

  d->Directory = newDirectory;
  d->updateDisplayText();

  emit directorySelected(d->DisplayAbsolutePath ?
                         newDirectory.absolutePath() :
                         newDirectory.path());

  emit directoryChanged(d->DisplayAbsolutePath ? d->Directory.absolutePath() : d->Directory.path());
}
Esempio n. 7
0
SyntroReview::SyntroReview(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	layoutWindow();
	restoreWindowState();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
	connect(ui.actionCFSSelection, SIGNAL(triggered()), this, SLOT(onCFSSelection()));
	connect(ui.actionAudioSetup, SIGNAL(triggered()), this, SLOT(onAudioSetup()));
	ui.actionOpen->setEnabled(false);
	ui.actionClose->setEnabled(false);
	ui.actionCFSSelection->setEnabled(false);

	SyntroUtils::syntroAppInit();

	m_audioSize = -1;
	m_audioRate = -1;
	m_audioChannels = -1;

#if defined(Q_OS_OSX) || defined(Q_OS_WIN32)
		m_audioOut = NULL;
		m_audioOutDevice = NULL;
#else
		m_audioOutIsOpen = false;
#endif

    QSettings *settings = SyntroUtils::getSettings();

    settings->beginGroup(AUDIO_GROUP);

    if (!settings->contains(AUDIO_OUTPUT_DEVICE))

#ifdef Q_OS_OSX
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE_MAC);
#else
#ifdef Q_OS_LINUX
        settings->setValue(AUDIO_OUTPUT_DEVICE, 0);

    if (!settings->contains(AUDIO_OUTPUT_CARD))
        settings->setValue(AUDIO_OUTPUT_CARD, 0);
#else
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE);
#endif
#endif
    if (!settings->contains(AUDIO_ENABLE))
        settings->setValue(AUDIO_ENABLE, true);

	m_audioEnabled = settings->value(AUDIO_ENABLE).toBool();

	settings->endGroup();
	delete settings;
	m_client = new ReviewClient(this);
	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen()));
	connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(onClose()));
	connect(m_client, SIGNAL(newDirectory(QStringList)), this, SLOT(newDirectory(QStringList)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(showImage(QImage, QByteArray, unsigned int, QDateTime)), 
			this, SLOT(showImage(QImage, QByteArray, unsigned int, QDateTime)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newAudio(QByteArray, int, int, int)), this, SLOT(newAudio(QByteArray, int, int, int)));
	connect(m_client, SIGNAL(newCFSState(int)), this, SLOT(newCFSState(int)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newFileLength(unsigned int)), this, SLOT(newFileLength(unsigned int)), Qt::QueuedConnection);
	connect(this, SIGNAL(openFile(QString)), m_client, SLOT(openFile(QString)), Qt::QueuedConnection);
	connect(this, SIGNAL(closeFile()), m_client, SLOT(closeFile()), Qt::QueuedConnection);
	connect(this, SIGNAL(setPlayMode(int, bool)), m_client, SLOT(setPlayMode(int, bool)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newPlayMode(int)), this, SLOT(newPlayMode(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(setFrameIndex(unsigned int, int, bool)), m_client, SLOT(setFrameIndex(unsigned int, int, bool)), Qt::QueuedConnection);

	connect(m_client, SIGNAL(dirResponse(QStringList)), this, SLOT(dirResponse(QStringList)));
	connect(this, SIGNAL(requestDir()), m_client, SLOT(requestDir()));
	connect(this, SIGNAL(newCFSList()), m_client, SLOT(newCFSList()));

	m_client->resumeThread();

	m_statusTimer = startTimer(2000);
	m_directoryTimer = startTimer(10000);

	setWindowTitle(QString("%1 - %2")
		.arg(SyntroUtils::getAppType())
		.arg(SyntroUtils::getAppName()));

	setDisabledPlayControls();
}
Esempio n. 8
0
int main(int argSize, char ** argArray)
{
	unsigned checked = 0, errors = 0, i, permissionBit;
	struct passwd * userInfo = getpwuid(getuid());
	char * userDirectory = userInfo->pw_dir;
	struct stat fileInfo;
	
	for (i = 1; i < argSize; i++)
	{
		//Check to see if the file is a full path or not
		if (argArray[i][0] != '/')
		{
			argArray[i] = newDirectory(userDirectory, argArray[i]);
		}
		//Error checking
		if (stat(argArray[i], &fileInfo) == -1)
		{
			printf("Error: Cannot access '%s'...\n", argArray[i]);
			errors++;
			continue;
		}
		//Determine if the file is a binary or a directory
		if (fileInfo.st_mode / 32768 == 1)
		{
			printf("%s (file) ", argArray[i]);
		}
		else if (fileInfo.st_mode / 16384 == 1)
		{
			printf("%s (directory) ", argArray[i]);
		}
		//Determine the user's association to the file
		if (getuid() == fileInfo.st_uid)
		{
			permissionBit = 256;
			printf("User permissions: ");
		}
		else if (getuid() == fileInfo.st_gid)
		{
			permissionBit = 32;
			printf("Group permissions: ");
		}
		else
		{
			permissionBit = 4;
			printf("Outside permissions: ");
		}
		//Determine the file's permission modes
		if (fileInfo.st_mode & permissionBit)
		{
			printf("Read ");
		}
		if (fileInfo.st_mode & (permissionBit / 2))
		{
			printf("Write ");
		}
		if (fileInfo.st_mode & (permissionBit / 4))
		{
			printf("Execute");
		}
		printf("\n");
		checked++;
	}
	printf("Total files checked: %u\n", checked);
	printf("Total file errors: %u\n", errors);
	return 0;
}
Esempio n. 9
0
/* This is a recursive function.
 */
int
dirwalk (char* dir, bkupInfo* info)
{
    DIR*           pDir;
    struct dirent* pEnt;
    struct stat    stbuf;
    char*          newdir;      /* new (next) source directory */
    char*          bkupdir;     /* backup directory */


    assert(dir);
    assert(info);
    assert(info->bdir);
    assert(info->func);

    pDir = opendir(dir);
    if (!pDir) {
        errSysRet(("opendir(%s)", dir));
        return 0;
    }
    if (chdir(dir)) {
        errSysRet(("chdir(%s)", dir));
        return 0;
    }
    for (pEnt = readdir(pDir); pEnt; pEnt = readdir(pDir)) {
        if (lstat(pEnt->d_name, &stbuf)) {
            errSysRet(("stat(%s)", pEnt->d_name));
            continue;
        }
        switch (stbuf.st_mode & S_IFMT) {
        case S_IFSOCK:
            printf("%s/%s: socket ignored\n", dir, pEnt->d_name);
            break;
        case S_IFBLK:
            printf("%s/%s: block device ignored\n", dir, pEnt->d_name);
            break;
        case S_IFCHR:
            printf("%s/%s: character device ignored\n", dir, pEnt->d_name);
            break;
        case S_IFIFO:
            printf("%s/%s: fifo ignored\n", dir, pEnt->d_name);
            break;
        case S_IFDIR:
            if (strcmp(".", pEnt->d_name) == 0) {
                break;
            }
            if (strcmp("..", pEnt->d_name) == 0) {
                break;
            }
            bkupdir = malloc(info->blen +
                             strlen(dir) + strlen(pEnt->d_name) + 3);
            if (!bkupdir) {
                errSysRet(("%s/%s/%s: can't alloc memory",
                           info->bdir, dir, pEnt->d_name));
                continue;
            }
            strcpy(bkupdir, info->bdir);
            if (*dir != '/') {
                strcat(bkupdir, "/");
            }
            strcat(bkupdir, dir);
            strcat(bkupdir, "/");
            strcat(bkupdir, pEnt->d_name);
            newdir = bkupdir + info->blen;
            if (!newDirectory(bkupdir, &stbuf, info)) {
                errRet(("newDirectory(%s, 0x%08x)", bkupdir, stbuf.st_mode));
                continue;
            }
            dirwalk(newdir, info); /* recursion */
            free(bkupdir);
            if (chdir(dir)) {
                errSysRet(("chdir(%s)", dir));
                return 0;
            }
            break;
        case S_IFLNK:
        case S_IFREG:
            info->ctime = stbuf.st_ctime;
            info->mtime = stbuf.st_mtime;
            info->stbuf = &stbuf;
            (*info->func)(dir, pEnt->d_name, info);
            break;
        default:
            errRet(("%s/%s: unknown type (0x%x) ignored\n",
                  dir, pEnt->d_name, stbuf.st_mode & S_IFMT));
            break;
        }
    }
    if (closedir(pDir)) {
        errSysRet(("closedir(%d)", dir));
    }
    return 1;
}