RDirNode::RDirNode(RDirNode* parent, std::string abspath) { changePath(abspath); parent = 0; setParent(parent); //figure out starting position if(parent !=0) { vec2f parentPos = parent->getPos(); vec2f offset; RDirNode* parentP = parent->getParent(); pos = parentPos; } else { pos = vec2f(0.0f, 0.0f); } float padded_file_radius = gGourceFileDiameter * 0.5; file_area = padded_file_radius * padded_file_radius * PI; visible_count = 0; visible = false; position_initialized = false; since_node_visible = 0.0; since_last_file_change = 0.0; since_last_node_change = 0.0; calcRadius(); calcColour(); }
void ftpInterface::connectToHost() { destroy(); ftp->connectToHost(host,ftpPort); ftp->login( user, passwd ); if(!directory.isEmpty()) changePath(directory); }
void SVDependTable::createHideEdit() { int nRow = numRows(); m_pHideEdit = new WLineEdit("", elementAt(nRow, 0)); if(m_pHideEdit) m_pHideEdit->hide(); m_pHideButton = new WPushButton("hide button", elementAt(nRow, 0)); if(m_pHideButton) { m_pHideButton->hide(); WObject::connect(m_pHideButton, SIGNAL(clicked()), this, SLOT(changePath())); } }
BinaryWidget::BinaryWidget(Binary *bin, QWidget *parent):NoteWidget(parent),note(bin) { description = new QTextEdit(note->getDescription()); path = new QLineEdit(note->getPath()); title->setText(note->getTitle()); changePathB = new QPushButton("...", this); QHBoxLayout* pathLayout = new QHBoxLayout; pathLayout->addWidget(path); pathLayout->addWidget(changePathB); binaryLayout = new QHBoxLayout; layout->addLayout(binaryLayout); layout->addLayout(pathLayout); layout->addWidget(description); connect(changePathB, SIGNAL(clicked()), this, SLOT(changePath())); connect(path,SIGNAL(textChanged(QString)),this,SLOT(updateNote())); connect(description,SIGNAL(textChanged()),this,SLOT(updateNote())); }
FileLogger::FileLogger(const QString &path, const bool backup, const int maxSize, const bool deleteOld, const int age, const FileLogAgeType ageType) : m_backup(backup) , m_maxSize(maxSize) , m_logFile(nullptr) { m_flusher.setInterval(0); m_flusher.setSingleShot(true); connect(&m_flusher, &QTimer::timeout, this, &FileLogger::flushLog); changePath(path); if (deleteOld) this->deleteOld(age, ageType); const Logger *const logger = Logger::instance(); foreach (const Log::Msg &msg, logger->getMessages()) addLogMessage(msg); connect(logger, &Logger::newLogMessage, this, &FileLogger::addLogMessage); }
bool FtpMainWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: connectToHost(); break; case 1: languageChange(); break; case 2: uploadFile(); break; case 3: downloadFile(); break; case 4: removeFile(); break; case 5: changePath((const QString&)static_QUType_QString.get(_o+1)); break; case 6: ftp_commandStarted(); break; case 7: ftp_commandFinished(); break; case 8: ftp_done((bool)static_QUType_bool.get(_o+1)); break; case 9: ftp_stateChanged((int)static_QUType_int.get(_o+1)); break; case 10: ftp_listInfo((const QUrlInfo&)*((const QUrlInfo*)static_QUType_ptr.get(_o+1))); break; case 11: ftp_rawCommandReply((int)static_QUType_int.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; case 12: changePathOrDownload((QListViewItem*)static_QUType_ptr.get(_o+1)); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }
RDirNode::RDirNode(RDirNode* parent, const std::string & abspath) { changePath(abspath); parent = 0; setParent(parent); accel = spos = prev_accel = vel = vec2(0.0f); //NOTE: parent is always being set to 0 so this never gets called ... //figure out starting position if(parent !=0) { vec2 parentPos = parent->getPos(); vec2 offset; pos = parentPos; } else { pos = vec2(0.0f, 0.0f); } float padded_file_radius = gGourceFileDiameter * 0.5; file_area = padded_file_radius * padded_file_radius * PI; visible_count = 0; visible = false; position_initialized = false; since_node_visible = 0.0; since_last_file_change = 0.0; since_last_node_change = 0.0; calcRadius(); calcColour(); }
bool RDirNode::addFile(RFile* f) { //doesnt match this path at all if(f->path.find(abspath) != 0) { if(parent!=0) return false; RDirNode* newparent; std::string common = commonPathPrefix(f->path); if(common.size()==0) common = "/"; newparent = new RDirNode(0, common); newparent->addNode(this); return newparent->addFile(f); } //simply change path of node and add this to it if( parent==0 && abspath == "/" && f->path.compare(abspath) != 0 && fileCount()==0 && dirCount()==0) { debugLog("modifying root path to %s\n", f->path.c_str()); changePath(f->path); } //is this dir - add to this node if(f->path.compare(abspath) == 0) { //debugLog("addFile %s to %s\n", f->fullpath.c_str(), abspath.c_str()); files.push_back(f); if(!f->isHidden()) visible_count++; f->setDir(this); fileUpdated(false); return true; } //does this belong to one of the children ? for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* child = (*it); bool added = child->addFile(f); if(added) return true; } //add new child, add it to that //if commonpath is longer than abspath, add intermediate node, else just add at the files path RDirNode* node = new RDirNode(this, f->path); node->addFile(f); addNode(node); // do we have dir nodes, with a common path element greater than abspath, // if so create another node, and move those nodes there std::string commonpath; vec2f commonPos; for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* child = (*it); std::string common = child->commonPathPrefix(f->path); if(common.size() > abspath.size() && common != f->path) { commonpath = common; commonPos = child->getPos(); break; } } // redistribute to new common node if(commonpath.size() > abspath.size()) { //debugLog("common path %s\n", commonpath.c_str()); RDirNode* cnode = new RDirNode(this, commonpath); cnode->setPos(commonPos); for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end();) { RDirNode* child = (*it); if(child->prefixedBy(commonpath)) { //debugLog("this path = %s, commonpath = %s, path = %s\n", abspath.c_str(), commonpath.c_str(), child->getPath().c_str()); it = children.erase(it); cnode->addNode(child); continue; } it++; } addNode(cnode); } return true; }
bool RDirNode::addFile(RFile* f) { //doesnt match this path at all if(f->path.find(abspath) != 0) { if(parent != 0) return false; //if this is the root node (ie no parent), we fork it //if we encounter a file with a non matching path to the //current root path. the calling process then checks if //the root now has a parent node, and changes the pointer. RDirNode* newparent; std::string common = commonPathPrefix(f->path); if(common.size()==0) common = "/"; newparent = new RDirNode(0, common); newparent->addNode(this); return newparent->addFile(f); } //simply change path of node and add this to it if( parent==0 && abspath == "/" && f->path.compare(abspath) != 0 && noFiles() && noDirs()) { debugLog("modifying root path to %s", f->path.c_str()); changePath(f->path); } //is this dir - add to this node if(f->path.compare(abspath) == 0) { //debugLog("addFile %s to %s\n", f->fullpath.c_str(), abspath.c_str()); files.push_back(f); if(!f->isHidden()) visible_count++; f->setDir(this); fileUpdated(false); return true; } bool added = false; //does this belong to one of the children ? for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* child = (*it); added = child->addFile(f); if(added) break; } if(added && parent != 0) return true; //do we have a file in this directory thats fullpath is a prefix of this file, if so //that file is actually a directory - the file should be removed, and a directory with that path added //if this is the root node we do this regardless of if the file was added to a child node for(std::list<RFile*>::const_iterator it = files.begin(); it != files.end(); it++) { RFile* file = (*it); if(f->path.find(file->fullpath) == 0) { //fprintf(stderr, "removing %s as is actually the directory of %s\n", file->fullpath.c_str(), f->fullpath.c_str()); file->remove(true); break; } } if(added) return true; //add new child, add it to that //if commonpath is longer than abspath, add intermediate node, else just add at the files path RDirNode* node = new RDirNode(this, f->path); node->addFile(f); addNode(node); // do we have dir nodes, with a common path element greater than abspath, // if so create another node, and move those nodes there std::string commonpath; vec2 commonPos; for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* child = (*it); std::string common = child->commonPathPrefix(f->path); if(common.size() > abspath.size() && common != f->path) { commonpath = common; commonPos = child->getPos(); break; } } // redistribute to new common node if(commonpath.size() > abspath.size()) { //debugLog("common path %s\n", commonpath.c_str()); RDirNode* cnode = new RDirNode(this, commonpath); cnode->setPos(commonPos); for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end();) { RDirNode* child = (*it); if(child->prefixedBy(commonpath)) { //debugLog("this path = %s, commonpath = %s, path = %s\n", abspath.c_str(), commonpath.c_str(), child->getPath().c_str()); it = children.erase(it); cnode->addNode(child); continue; } it++; } addNode(cnode); } return true; }
//Constructors: ProjectFilenamesDialog::ProjectFilenamesDialog(ftk::ProjectFiles * files, QWidget * parent) : QDialog(parent) { pFiles = files; QString buttonText = tr("Change..."); int labelWidths = 120; QVBoxLayout *masterLayout = new QVBoxLayout; /* QHBoxLayout *pLayout = new QHBoxLayout; projectLabel = new QLabel(tr("Project File: ")); projectLabel->setFixedWidth(labelWidths); projectFile = new QLabel(projfile); projectFile->setFrameShadow(QFrame::Sunken); projectFile->setFrameShape(QFrame::StyledPanel); pLayout->addWidget(projectLabel); pLayout->addWidget(projectFile); //pLayout->addStretch(5); masterLayout->addLayout(pLayout); */ QHBoxLayout *pathLayout = new QHBoxLayout; pathLabel = new QLabel(tr("Project Path: ")); pathLabel->setFixedWidth(labelWidths); inputPath = new QLabel(QString::fromStdString(files->path)); inputPath->setFrameShadow(QFrame::Sunken); inputPath->setFrameShape(QFrame::StyledPanel); pathButton = new QPushButton(buttonText); pathButton->setVisible(false); connect(pathButton, SIGNAL(clicked()), this, SLOT(changePath())); pathLayout->addWidget(pathLabel); pathLayout->addWidget(inputPath); pathLayout->addWidget(pathButton); masterLayout->addLayout(pathLayout); QHBoxLayout *nLayout = new QHBoxLayout; nameLabel = new QLabel(tr("Project Name: ")); nameLabel->setFixedWidth(labelWidths); nameText = new QLabel(QString::fromStdString(files->name)); nameText->setFrameShadow(QFrame::Sunken); nameText->setFrameShape(QFrame::StyledPanel); nameButton = new QPushButton(buttonText); connect(nameButton, SIGNAL(clicked()), this, SLOT(changeName())); nLayout->addWidget(nameLabel); nLayout->addWidget(nameText); nLayout->addWidget(nameButton); masterLayout->addLayout(nLayout); //masterLayout->addStretch(5); masterLayout->addSpacerItem(new QSpacerItem(labelWidths,5)); QHBoxLayout *iLayout = new QHBoxLayout; inputLabel = new QLabel(tr("Input: ")); inputLabel->setFixedWidth(labelWidths); inputFile = new QLabel(QString::fromStdString(files->input)); inputFile->setFrameShadow(QFrame::Sunken); inputFile->setFrameShape(QFrame::StyledPanel); inputButton = new QPushButton(buttonText); inputButton->setVisible(false); connect(inputButton, SIGNAL(clicked()), this, SLOT(changeInput())); iLayout->addWidget(inputLabel); iLayout->addWidget(inputFile); iLayout->addWidget(inputButton); masterLayout->addLayout(iLayout); QHBoxLayout *oLayout = new QHBoxLayout; outputLabel = new QLabel(tr("Output: ")); outputLabel->setFixedWidth(labelWidths); outputFile = new QLabel(QString::fromStdString(files->output)); outputFile->setFrameShadow(QFrame::Sunken); outputFile->setFrameShape(QFrame::StyledPanel); outputButton = new QPushButton(buttonText); outputButton->setVisible(false); connect(outputButton, SIGNAL(clicked()), this, SLOT(changeOutput())); oLayout->addWidget(outputLabel); oLayout->addWidget(outputFile); oLayout->addWidget(outputButton); masterLayout->addLayout(oLayout); QHBoxLayout *lLayout = new QHBoxLayout; logLabel = new QLabel(tr("Edit Log: ")); logLabel->setFixedWidth(labelWidths); logFile = new QLabel(QString::fromStdString(files->log)); logFile->setFrameShadow(QFrame::Sunken); logFile->setFrameShape(QFrame::StyledPanel); logButton = new QPushButton(buttonText); logButton->setEnabled(false); //Cannot change the log file here!! logButton->setVisible(false); connect(logButton, SIGNAL(clicked()), this, SLOT(changeLog())); lLayout->addWidget(logLabel); lLayout->addWidget(logFile); lLayout->addWidget(logButton); masterLayout->addLayout(lLayout); QHBoxLayout *dLayout = new QHBoxLayout; definitionLabel = new QLabel(tr("Project Definition: ")); definitionLabel->setFixedWidth(labelWidths); definitionFile = new QLabel(QString::fromStdString(files->definition)); definitionFile->setFrameShadow(QFrame::Sunken); definitionFile->setFrameShape(QFrame::StyledPanel); definitionButton = new QPushButton(buttonText); definitionButton->setVisible(false); connect(definitionButton, SIGNAL(clicked()), this, SLOT(changeDefinition())); dLayout->addWidget(definitionLabel); dLayout->addWidget(definitionFile); dLayout->addWidget(definitionButton); masterLayout->addLayout(dLayout); QHBoxLayout *tLayout = new QHBoxLayout; tableLabel = new QLabel(tr("Table: ")); tableLabel->setFixedWidth(labelWidths); tableFile = new QLabel(QString::fromStdString(files->table)); tableFile->setFrameShadow(QFrame::Sunken); tableFile->setFrameShape(QFrame::StyledPanel); tableButton = new QPushButton(buttonText); tableButton->setVisible(false); connect(tableButton, SIGNAL(clicked()), this, SLOT(changeTable())); tLayout->addWidget(tableLabel); tLayout->addWidget(tableFile); tLayout->addWidget(tableButton); masterLayout->addLayout(tLayout); QHBoxLayout *a_tLayout = new QHBoxLayout; adjTablesLabel = new QLabel(tr("Adj_Tables: ")); adjTablesLabel->setFixedWidth(labelWidths); adjTablesFile = new QLabel(QString::fromStdString(files->adjTables)); adjTablesFile->setFrameShadow(QFrame::Sunken); adjTablesFile->setFrameShape(QFrame::StyledPanel); adjTablesButton = new QPushButton(buttonText); adjTablesButton->setVisible(false); connect(adjTablesButton, SIGNAL(clicked()), this, SLOT(changeAdjTables())); a_tLayout->addWidget(adjTablesLabel); a_tLayout->addWidget(adjTablesFile); a_tLayout->addWidget(adjTablesButton); masterLayout->addLayout(a_tLayout); masterLayout->addStretch(5); QHBoxLayout *okLayout = new QHBoxLayout; quitButton = new QPushButton(tr("Cancel")); connect(quitButton, SIGNAL(clicked()), this, SLOT(reject())); okButton = new QPushButton(tr("Done")); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); okLayout->addStretch(20); okLayout->addWidget(quitButton); okLayout->addWidget(okButton); masterLayout->addLayout(okLayout); this->setLayout(masterLayout); //this->setupDefaults(); }