本文整理汇总了C++中QDir函数的典型用法代码示例。如果您正苦于以下问题:C++ QDir函数的具体用法?C++ QDir怎么用?C++ QDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QDir
QFileInfoList DocumentsDir::getTemplates() const
{
return QDir( getTemplatesDirName() ).entryInfoList( QStringList("*.xml"), QDir::Files );
}
开发者ID:SvOlli,项目名称:fridgegrid,代码行数:4,代码来源:DocumentsDir.cpp
示例2: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
app.setApplicationName("ksvg2icns");
app.setApplicationVersion(KICONTHEMES_VERSION_STRING);
QCommandLineParser parser;
parser.setApplicationDescription(app.translate("main", "Creates an icns file from an svg image"));
parser.addPositionalArgument("iconname", app.translate("main", "The svg icon to convert"));
parser.addHelpOption();
parser.process(app);
if (parser.positionalArguments().isEmpty()) {
parser.showHelp();
return 1;
}
bool isOk;
// create a temporary dir to create an iconset
QTemporaryDir tmpDir("ksvg2icns");
tmpDir.setAutoRemove(true);
isOk = tmpDir.isValid();
EXIT_ON_ERROR(isOk, "Unable to create temporary directory\n");
isOk = QDir(tmpDir.path()).mkdir("out.iconset");
EXIT_ON_ERROR(isOk, "Unable to create out.iconset directory\n");
const QString outPath = tmpDir.path() + "/out.iconset";
const QStringList &args = app.arguments();
EXIT_ON_ERROR(args.size() == 2,
"Usage: %s svg-image\n",
qPrintable(args.value(0)));
const QString &svgFileName = args.at(1);
// open the actual svg file
QSvgRenderer svg;
isOk = svg.load(svgFileName);
EXIT_ON_ERROR(isOk, "Unable to load %s\n", qPrintable(svgFileName));
// The sizes are from:
// https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html
struct OutFiles
{
int size;
QString out1;
QString out2;
};
// create the pngs in various resolutions
const OutFiles outFiles[] = {
{ 1024, outPath + "/[email protected]", QString() },
{ 512, outPath + "/icon_512x512.png", outPath + "/[email protected]" },
{ 256, outPath + "/icon_256x256.png", outPath + "/[email protected]" },
{ 128, outPath + "/icon_128x128.png", QString() },
{ 64, outPath + "/[email protected]", QString() },
{ 32, outPath + "/icon_32x32.png", outPath + "/[email protected]" },
{ 16, outPath + "/icon_16x16.png", QString() }
};
for (size_t i = 0; i < sizeof(outFiles) / sizeof(OutFiles); ++i) {
isOk = writeImage(svg, outFiles[i].size, outFiles[i].out1, outFiles[i].out2);
if (!isOk) {
return 1;
}
}
// convert the iconset to icns using the "iconutil" command
const QString outIcns = QFileInfo(svgFileName).baseName() + ".icns";
const QStringList utilArgs = QStringList()
<< "-c" << "icns"
<< "-o" << outIcns
<< outPath;
QProcess iconUtil;
iconUtil.setProgram("iconUtil");
iconUtil.setArguments(utilArgs);
iconUtil.start("iconutil", utilArgs, QIODevice::ReadOnly);
isOk = iconUtil.waitForFinished(-1);
EXIT_ON_ERROR(isOk, "Unable to launch iconutil: %s\n", qPrintable(iconUtil.errorString()));
EXIT_ON_ERROR(iconUtil.exitStatus() == QProcess::NormalExit, "iconutil crashed!\n");
EXIT_ON_ERROR(iconUtil.exitCode() == 0, "iconutil returned %d\n", iconUtil.exitCode());
return 0;
}
开发者ID:KDE,项目名称:kiconthemes,代码行数:93,代码来源:ksvg2icns.cpp
示例3: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(companion);
QApplication app(argc, argv);
app.setApplicationName("OpenTX Simulator");
app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org");
#ifdef __APPLE__
app.setStyle(new MyProxyStyle);
#endif
QString dir;
if (argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
/* QTranslator companionTranslator;
companionTranslator.load(":/companion_" + locale);
QTranslator qtTranslator;
qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator);
*/
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0;
#ifdef JOYSTICKS
sdlFlags |= SDL_INIT_JOYSTICK;
#endif
#ifdef SIMU_AUDIO
sdlFlags |= SDL_INIT_AUDIO;
#endif
SDL_Init(sdlFlags);
#endif
RegisterEepromInterfaces();
registerOpenTxFirmwares();
SimulatorDialog *dialog;
const char * eepromFileName;
QString fileName;
QByteArray path;
QDir eedir;
QFile file;
QMessageBox msgBox;
msgBox.setWindowTitle("Radio type");
msgBox.setText("Which radio type do you want to simulate?");
msgBox.setIcon(QMessageBox::Question);
QAbstractButton *taranisButton = msgBox.addButton("Taranis", QMessageBox::ActionRole);
QAbstractButton *sky9xButton = msgBox.addButton("9X-Sky9X", QMessageBox::ActionRole);
QAbstractButton *gruvinButton = msgBox.addButton("9X-Gruvin9X", QMessageBox::ActionRole);
QAbstractButton *proButton = msgBox.addButton("9XR-Pro", QMessageBox::ActionRole);
msgBox.addButton("9X-M128", QMessageBox::ActionRole);
QPushButton *exitButton = msgBox.addButton(QMessageBox::Close);
eedir = QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
if (!eedir.exists("OpenTX")) {
eedir.mkdir("OpenTX");
}
eedir.cd("OpenTX");
msgBox.exec();
if (msgBox.clickedButton() == exitButton)
return 0;
else if (msgBox.clickedButton() == taranisButton) {
current_firmware_variant = GetFirmware("opentx-taranis-haptic-en");
fileName = eedir.filePath("eeprom-taranis.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialogTaranis();
}
else if (msgBox.clickedButton() == sky9xButton) {
current_firmware_variant = GetFirmware("opentx-sky9x-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-bluetooth-en");
fileName = eedir.filePath("eeprom-sky9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else if (msgBox.clickedButton() == gruvinButton) {
current_firmware_variant = GetFirmware("opentx-gruvin9x-heli-templates-sdcard-voice-DSM2PPM-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-ttsen-en");
fileName = eedir.filePath("eeprom-gruvin9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else if (msgBox.clickedButton() == proButton) {
current_firmware_variant = GetFirmware("opentx-9xrpro-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-en");
fileName = eedir.filePath("eeprom-9xrpro.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else {
current_firmware_variant = GetFirmware("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
fileName = eedir.filePath("eeprom-9x128.bin");
path = fileName.toAscii();
eepromFileName = path.data();
//.........这里部分代码省略.........
开发者ID:sneheshs,项目名称:opentx,代码行数:101,代码来源:simulator.cpp
示例4: QMainWindow
/*////////////////////////////////////////////Start program//////////////////////////////////////////////*/
Krudio::Krudio(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Krudio)
{
ui->setupUi(this);
ui->waitMinute->hide();//Скрываем label загрузки буфера
ceckBUFFtimer = new QTimer();//таймер для буферинга
QDir(QDir::homePath()).mkdir(".krudio");
//Иконка в трее
trIcon = new QSystemTrayIcon(); //инициализируем объект
trIcon->setIcon(QIcon::fromTheme("krudio",QIcon("/usr/share/icons/hicolor/48x48/apps/krudio.svg"))); //устанавливаем иконку
trIcon->show(); //отображаем объект
//При клике сворачивать или разворачивать окно
connect(trIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(showHide(QSystemTrayIcon::ActivationReason)));
//Создаем контекстное меню для иконки в трее, чтобы закрывать программу
QMenu* pmnu = new QMenu("&Menu");
pmnu->addAction("&Exit", this, SLOT(closeEV()));
trIcon->setContextMenu(pmnu);
//Иконка в трее
//Подключение к базе
QSqlDatabase dbase = QSqlDatabase::addDatabase("QSQLITE");
fullPath=QDir::homePath()+"/.krudio/"+baseName;
dbase.setDatabaseName(fullPath);
if (!dbase.open()) {
qDebug() << "Что-то пошло не так!";
return;
}
//Подключение к базе
QSqlQuery a_query;
//Создаем таблицу со станциями
QString str =
"CREATE TABLE "+tableStationsName+" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT, url TEXT);";
bool b = a_query.exec(str);
if (!b) {qDebug() << "Таблица со станциями уже существует.";}
//Создаем таблицу со станциями
//Создаем таблицу с настройками
str = "CREATE TABLE "+tableSettingName+" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, setting TEXT, value INTEGER);";
b = a_query.exec(str);
if (!b) {qDebug() << "Таблица с настройками уже существует.";}
//Создаем таблицу с настройками
//Проверяем какие настройки включены
if (!a_query.exec("SELECT * FROM "+tableSettingName)) {qDebug() << "Не получается прочитать информацию с таблицы.";return;}
QSqlRecord rec = a_query.record();//Записываем результ с выборки
//Создаем переменные к которым будем присваивать значения из таблицы
QString setting="",
id="";
int value,
colorIcons=-1,// -1 Настроек нет
sizeIcon=-1;// -1 Настроек нет
while (a_query.next()) {
id = a_query.value(rec.indexOf("id")).toString();
setting = a_query.value(rec.indexOf("setting")).toString();
value = a_query.value(rec.indexOf("value")).toInt();
//Если есть настройки цвета иконок, то добавляем в переменную значение
if(setting=="color"){
colorIcons=value;
}
//Если есть настройки размера иконок, то добавляем в переменную значение
if(setting=="iconsize"){
sizeIcon=value;
}
}
//Сохраняем настройки если их нет
QString str_insert;
if(sizeIcon==-1){
str_insert = "INSERT INTO "+tableSettingName+" (id, setting, value) VALUES (NULL, '%1', %2);";
str = str_insert.arg("iconsize").arg(0);//32
b = a_query.exec(str);
if (!b) {qDebug() << "Данные не вставляются";}
currentsizeIcon=0;
}
else{
setsizeIcon(sizeIcon,false);
currentsizeIcon=sizeIcon;
}
if(colorIcons==-1){
//Добавляем настройку цвета по умолчанию
str_insert = "INSERT INTO "+tableSettingName+" (id, setting, value) VALUES (NULL, '%1', %2);";
str = str_insert.arg("color").arg(0);
b = a_query.exec(str);
if (!b) {qDebug() << "Данные не вставляются";}
setcolorIcon(0,false);
currentColorNumb=0;
}else{
setcolorIcon(colorIcons,false);
currentColorNumb=colorIcons;
}
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//Включаем запрет на редактирование таблицы
refreshTable();//Обновляем содержимое таблицы
}
开发者ID:manjarqo,项目名称:krudio,代码行数:97,代码来源:krudio.cpp
示例5: sltInstallPackage
void UIGlobalSettingsExtension::sltInstallPackage()
{
/*
* Open file-open window to let user to choose package file.
*
* The default location is the user's Download or Downloads directory with
* the user's home directory as a fallback. ExtPacks are downloaded.
*/
QString strBaseFolder = QDir::homePath() + "/Downloads";
if (!QDir(strBaseFolder).exists())
{
strBaseFolder = QDir::homePath() + "/Download";
if (!QDir(strBaseFolder).exists())
strBaseFolder = QDir::homePath();
}
QString strTitle = tr("Select an extension package file");
QStringList extensions;
for (int i = 0; i < VBoxExtPackFileExts.size(); ++i)
extensions << QString("*.%1").arg(VBoxExtPackFileExts[i]);
QString strFilter = tr("Extension package files (%1)").arg(extensions.join(" "));
QStringList fileNames = QIFileDialog::getOpenFileNames(strBaseFolder, strFilter, this, strTitle, 0, true, true);
QString strFilePath;
if (!fileNames.isEmpty())
strFilePath = fileNames.at(0);
/*
* Install the chosen package.
*/
if (!strFilePath.isEmpty())
{
QString strExtPackName;
doInstallation(strFilePath, QString(), this, &strExtPackName);
/*
* Since we might be reinstalling an existing package, we have to
* do a little refreshing regardless of what the user chose.
*/
if (!strExtPackName.isNull())
{
/* Remove it from the cache. */
for (int i = 0; i < m_cache.m_items.size(); i++)
if (!strExtPackName.compare(m_cache.m_items[i].m_strName, Qt::CaseInsensitive))
{
m_cache.m_items.removeAt(i);
break;
}
/* Remove it from the tree. */
const int cItems = m_pPackagesTree->topLevelItemCount();
for (int i = 0; i < cItems; i++)
{
UIExtensionPackageItem *pItem = static_cast<UIExtensionPackageItem*>(m_pPackagesTree->topLevelItem(i));
if (!strExtPackName.compare(pItem->name(), Qt::CaseInsensitive))
{
delete pItem;
break;
}
}
/* Reinsert it into the cache and tree. */
CExtPackManager manager = vboxGlobal().virtualBox().GetExtensionPackManager();
const CExtPack &package = manager.Find(strExtPackName);
if (package.isOk())
{
m_cache.m_items << fetchData(package);
UIExtensionPackageItem *pItem = new UIExtensionPackageItem(m_pPackagesTree, m_cache.m_items.last());
m_pPackagesTree->setCurrentItem(pItem);
m_pPackagesTree->sortByColumn(1, Qt::AscendingOrder);
}
}
}
}
开发者ID:svn2github,项目名称:virtualbox,代码行数:75,代码来源:UIGlobalSettingsExtension.cpp
示例6: mkdir
QString Utils::path(const QString &location, const QString &fileName) {
mkdir(location);
QString path = QDir(location).absoluteFilePath(fileName);
return QDir::cleanPath(path);
}
开发者ID:gcollura,项目名称:saucybacon,代码行数:5,代码来源:Utils.cpp
示例7: dialog
bool QLCFixtureEditor::saveAs()
{
/* Bail out if there is no manufacturer or model */
if (checkManufacturerModel() == false)
return false;
/* Create a file save dialog */
QFileDialog dialog(this);
dialog.setWindowTitle(tr("Save fixture definition"));
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.setNameFilter(KQXFFilter);
QString path;
QDir dir = QLCFixtureDefCache::userDefinitionDirectory();
if (m_fileName.isEmpty() == true)
{
/* Construct a new path for the (yet) unnamed file */
QString man = m_fixtureDef->manufacturer().replace(" ", "-");
QString mod = m_fixtureDef->model().replace(" ", "-");
path = QString("%1-%2%3").arg(man).arg(mod).arg(KExtFixture);
dialog.setDirectory(dir);
dialog.selectFile(path);
}
else
{
/* The fixture already has a file name. Use that then. */
dialog.setDirectory(QDir(m_fileName));
dialog.selectFile(m_fileName);
}
/* Execute the dialog */
if (dialog.exec() != QDialog::Accepted)
return false;
path = dialog.selectedFiles().first();
if (path.length() != 0)
{
if (path.right(strlen(KExtFixture)) != QString(KExtFixture))
path += QString(KExtFixture);
QFile::FileError error = m_fixtureDef->saveXML(path);
if (error == QFile::NoError)
{
m_fileName = path;
setCaption();
setModified(false);
return true;
}
else
{
QMessageBox::critical(this, tr("Fixture saving failed"),
tr("Unable to save fixture definition:\n%1")
.arg(QLCFile::errorString(error)));
return false;
}
}
else
{
return false;
}
}
开发者ID:lelazary,项目名称:qlcplus,代码行数:61,代码来源:fixtureeditor.cpp
示例8: qWordsIter
//.........这里部分代码省略.........
{
if(n==1)
req_id = rsTurtle->turtleSearch(words.front()) ;
else
req_id = rsTurtle->turtleSearch(lin_exp) ;
qReturn.insert("turtleID",req_id);
}
else
req_id = ((((uint32_t)rand()) << 16)^0x1e2fd5e4) + (((uint32_t)rand())^0x1b19acfe) ; // generate a random 32 bits request id
/* extract keywords from lineEdit */
// make a compound expression with an AND
//
//std::list<DirDetails> finalResults ;
std::list<DirDetails> initialResults;
//RS_FILE_HINTS_REMOTE
//rsFiles->SearchBoolExp(&exprs, initialResults, RS_FILE_HINTS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
FileSearchFlags fsf;
if (searchOptions.value("localindexed", false).toBool()){
//std::cerr << "incuding local\n";
fsf = RS_FILE_HINTS_LOCAL;
}
if (searchOptions.value("remoteindexed", false).toBool()){
//std::cerr << "incuding remote\n";
fsf |= RS_FILE_HINTS_REMOTE;
}
if (searchOptions.value("boolexp", false).toBool()){
rsFiles->SearchBoolExp(&exprs, initialResults, fsf);
}else{
rsFiles->SearchKeywords(words, initialResults, fsf);
}
//if(searchFriends) fsf = RS_FILE_HINTS_REMOTE;
//rsFiles->getSharedDirectories();
//SharedDirInfo sdinfo;
//sdinfo.
std::cerr << "webscriptrs: result count: " << initialResults.size() << std::endl;
/* which extensions do we use? */
DirDetails dd;
for(std::list<DirDetails>::iterator resultsIter = initialResults.begin(); resultsIter != initialResults.end(); resultsIter ++)
{
//std::cout << "webscriptrs: " << dd.hash << std::endl;
dd = *resultsIter;
QVariantMap qdd;
qdd.insert("age",dd.age);//QString::number(dir.age)?
//qdd.insert("message",dd.children);
qdd.insert("size",QString::number(dd.count));
//qdd.insert("message",dd.flags);
qdd.insert("hash",QString::fromStdString(dd.hash));
qdd.insert("id",QString::fromStdString(dd.id));
qdd.insert("mind_age",dd.min_age);
qdd.insert("srname",QString::fromUtf8(dd.name.c_str()));
//qdd.insert("message",dd.parent);
//qdd.insert("message",dd.parent_groups);
qdd.insert("path",QString::fromUtf8(dd.path.c_str()));
qdd.insert("prow",dd.prow);
//qdd.insert("message",dd.ref);
qdd.insert("type",dd.type);
FileInfo info;
//The flags copied from SearchDialog.cpp:1096
if (rsFiles->FileDetails(dd.hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_SPEC_ONLY, info)){
/* make path for downloaded or downloading files */
//QFileInfo qinfo;
std::string path;
path = info.path.substr(0,info.path.length()-info.fname.length());
QDir apath = QDir(QString::fromUtf8(path.c_str()));
qdd.insert("fullpath", apath.absolutePath());
/* open folder with a suitable application */
/*qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.isDir()) {
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "openFolderSearch(): can't open folder " << path << std::endl;
}
}*/
} else {
std::cout << "file details failed\n";
}
qResults.push_back(qdd);
//finalResults.push_back(dd);
}
/* abstraction to allow reusee of tree rendering code */
//resultsToTree(keywords,req_id, finalResults);
qReturn.insert("status","sucess");
qReturn.insert("results",qResults);
return qReturn;
}
开发者ID:Fealum,项目名称:WebScriptRS,代码行数:101,代码来源:webbridgers.cpp
示例9: QtFindNextFile
QtFindNextFile(const char_t* path){
dir_ = QDir(path);
list_ = dir_.entryList();
n_ = 0;
}
开发者ID:ProjectAsura,项目名称:xtal-language,代码行数:5,代码来源:main.cpp
示例10: is_directory
virtual bool is_directory(const char_t* path){
return QDir(path).exists();
}
开发者ID:ProjectAsura,项目名称:xtal-language,代码行数:3,代码来源:main.cpp
示例11: QDir
QDir QFileInfo::dir( bool absPath ) const
{
return QDir( dirPath(absPath) );
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:4,代码来源:qfileinfo.cpp
示例12: QDialog
MainSettingsDialog::MainSettingsDialog(QSettings *settings, QList<InputDevice *> *devices, QWidget *parent) :
QDialog(parent, Qt::Dialog),
ui(new Ui::MainSettingsDialog)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
this->settings = settings;
this->allDefaultProfile = 0;
this->connectedDevices = devices;
#ifdef USE_SDL_2
fillControllerMappingsTable();
#endif
QString defaultProfileDir = settings->value("DefaultProfileDir", "").toString();
int numberRecentProfiles = settings->value("NumberRecentProfiles", 5).toInt();
bool closeToTray = settings->value("CloseToTray", false).toBool();
if (!defaultProfileDir.isEmpty() && QDir(defaultProfileDir).exists())
{
ui->profileDefaultDirLineEdit->setText(defaultProfileDir);
}
ui->numberRecentProfileSpinBox->setValue(numberRecentProfiles);
if (closeToTray)
{
ui->closeToTrayCheckBox->setChecked(true);
}
findLocaleItem();
#ifdef USE_SDL_2
populateAutoProfiles();
fillAllAutoProfilesTable();
fillGUIDComboBox();
#else
delete ui->categoriesListWidget->item(3);
delete ui->categoriesListWidget->item(1);
ui->stackedWidget->removeWidget(ui->controllerMappingsPage);
ui->stackedWidget->removeWidget(ui->page_2);
#endif
delete ui->categoriesListWidget->item(2);
ui->stackedWidget->removeWidget(ui->page);
QString autoProfileActive = settings->value("AutoProfiles/AutoProfilesActive", "").toString();
if (!autoProfileActive.isEmpty() && autoProfileActive == "1")
{
ui->activeCheckBox->setChecked(true);
ui->autoProfileTableWidget->setEnabled(true);
}
connect(ui->categoriesListWidget, SIGNAL(currentRowChanged(int)), ui->stackedWidget, SLOT(setCurrentIndex(int)));
connect(ui->controllerMappingsTableWidget, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(mappingsTableItemChanged(QTableWidgetItem*)));
connect(ui->mappingDeletePushButton, SIGNAL(clicked()), this, SLOT(deleteMappingRow()));
connect(ui->mappngInsertPushButton, SIGNAL(clicked()), this, SLOT(insertMappingRow()));
//connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(syncMappingSettings()));
connect(this, SIGNAL(accepted()), this, SLOT(saveNewSettings()));
connect(ui->profileOpenDirPushButton, SIGNAL(clicked()), this, SLOT(selectDefaultProfileDir()));
connect(ui->activeCheckBox, SIGNAL(toggled(bool)), ui->autoProfileTableWidget, SLOT(setEnabled(bool)));
//connect(ui->activeCheckBox, SIGNAL(toggled(bool)), ui->devicesComboBox, SLOT(setEnabled(bool)));
connect(ui->devicesComboBox, SIGNAL(activated(int)), this, SLOT(changeDeviceForProfileTable(int)));
connect(ui->autoProfileTableWidget, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(processAutoProfileActiveClick(QTableWidgetItem*)));
connect(ui->autoProfileAddPushButton, SIGNAL(clicked()), this, SLOT(openAddAutoProfileDialog()));
connect(ui->autoProfileDeletePushButton, SIGNAL(clicked()), this, SLOT(openDeleteAutoProfileConfirmDialog()));
connect(ui->autoProfileEditPushButton, SIGNAL(clicked()), this, SLOT(openEditAutoProfileDialog()));
connect(ui->autoProfileTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(changeAutoProfileButtonsState()));
}
开发者ID:Xatory,项目名称:antimicro,代码行数:70,代码来源:mainsettingsdialog.cpp
示例13: QDir
bool K3b::DirSizeJob::countDir( const QString& dir )
{
QStringList l = QDir(dir).entryList( QDir::AllEntries|QDir::Hidden|QDir::System|QDir::NoDotAndDotDot );
return countFiles( l, dir );
}
开发者ID:franhaufer,项目名称:k3b,代码行数:5,代码来源:k3bdirsizejob.cpp
示例14: QDir
QString WebBridgeRS::getDownloadDirectory()
{
QDir path = QDir(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()));
return path.absolutePath();
}
开发者ID:Fealum,项目名称:WebScriptRS,代码行数:5,代码来源:webbridgers.cpp
示例15: make_path
void make_path( const char * e )
{
QDir().mkpath( e ) ;
}
开发者ID:mhogomchungu,项目名称:SiriKali,代码行数:4,代码来源:lxqt_wallet.cpp
示例16: scanForExternalUtilities
void Config::scanForExternalUtilities(){
bool sufound = FALSE;
bool pbifound1 = FALSE;
bool pbifound2 = FALSE;
//Setup the commands to look for (lists in order of preference)
QStringList suCMD;
suCMD << "pc-su" << "qsu" << "gksu" << "kdesu"; //graphical "switch user" utilities
QString pbiCMD1 = "pbi_makeport"; //command to create a PBI from ports
QString pbiCMD2 = "pbi_create"; //command to create a PBI from local sources
//Get the current application path
QString cpath = QCoreApplication::applicationDirPath();
if(cpath.endsWith("/.sbin")){ cpath.chop(6); } //Fix for PBI installation of EasyPBI
//Set the search paths
QStringList paths;
paths <<"/usr/local/bin/"<<"/usr/local/sbin/"<<"/usr/bin/"<<"/usr/sbin/"<<cpath+"/bin/"<<cpath+"/sbin/";
//Perform the Search
for(int i=0; i<paths.length(); i++){
//PBI build commands
if(!pbifound1){
if(QFile::exists(paths[i]+pbiCMD1)){
pbifound1 = TRUE;
detStruct[0] = paths[i]+pbiCMD1; //pbi_makeport
}
}
if(!pbifound2){
if(QFile::exists(paths[i]+pbiCMD2)){
pbifound2 = TRUE;
detStruct[1] = paths[i]+pbiCMD2; //pbi_create
}
}
//SU utility
if(!sufound){
for(int j=0; j<suCMD.length(); j++){
if(QFile::exists(paths[i]+suCMD[j])){
sufound = TRUE;
detStruct[2] = paths[i]+suCMD[j]; //su utility
break;
}
}
}
} // end loop over paths
//Now search for the FreeBSD ports tree
QString ret;
QStringList portsLocations;
//Set the locations to search for the ports tree
portsLocations << "/usr/ports" << defaultSettings[1]+"ports";
//Search the locations
for(int i=0; i<portsLocations.size(); i++){
if( QDir(portsLocations[i]).exists() ){
if( QFile::exists(portsLocations[i]+"/COPYRIGHT") ){
detStruct[3]=portsLocations[i];
}
}
}
//Now Check the structures and set any internal flags
checkStructures();
}
开发者ID:Jheengut,项目名称:pcbsd,代码行数:61,代码来源:config.cpp
示例17: QDir
void AssetServer::run() {
ThreadedAssignment::commonInit(ASSET_SERVER_LOGGING_TARGET_NAME, NodeType::AssetServer);
auto nodeList = DependencyManager::get<NodeList>();
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
const QString RESOURCES_PATH = "assets";
_resourcesDirectory = QDir(ServerPathUtils::getDataDirectory()).filePath(RESOURCES_PATH);
qDebug() << "Creating resources directory";
_resourcesDirectory.mkpath(".");
bool noExistingAssets = !_resourcesDirectory.exists() \
|| _resourcesDirectory.entryList(QDir::Files).size() == 0;
if (noExistingAssets) {
qDebug() << "Asset resources directory not found, searching for existing asset resources";
QString oldDataDirectory = QCoreApplication::applicationDirPath();
auto oldResourcesDirectory = QDir(oldDataDirectory).filePath("resources/" + RESOURCES_PATH);
if (QDir(oldResourcesDirectory).exists()) {
qDebug() << "Existing assets found in " << oldResourcesDirectory << ", copying to " << _resourcesDirectory;
QDir resourcesParentDirectory = _resourcesDirectory.filePath("..");
if (!resourcesParentDirectory.exists()) {
qDebug() << "Creating data directory " << resourcesParentDirectory.absolutePath();
resourcesParentDirectory.mkpath(".");
}
auto files = QDir(oldResourcesDirectory).entryList(QDir::Files);
for (auto& file : files) {
auto from = oldResourcesDirectory + QDir::separator() + file;
auto to = _resourcesDirectory.absoluteFilePath(file);
qDebug() << "\tCopying from " << from << " to " << to;
QFile::copy(from, to);
}
}
}
qDebug() << "Serving files from: " << _resourcesDirectory.path();
// Scan for new files
qDebug() << "Looking for new files in asset directory";
auto files = _resourcesDirectory.entryInfoList(QDir::Files);
QRegExp filenameRegex { "^[a-f0-9]{" + QString::number(SHA256_HASH_HEX_LENGTH) + "}(\\..+)?$" };
for (const auto& fileInfo : files) {
auto filename = fileInfo.fileName();
if (!filenameRegex.exactMatch(filename)) {
qDebug() << "Found file: " << filename;
if (!fileInfo.isReadable()) {
qDebug() << "\tCan't open file for reading: " << filename;
continue;
}
// Read file
QFile file { fileInfo.absoluteFilePath() };
file.open(QFile::ReadOnly);
QByteArray data = file.readAll();
auto hash = hashData(data);
auto hexHash = hash.toHex();
qDebug() << "\tMoving " << filename << " to " << hexHash;
file.rename(_resourcesDirectory.absoluteFilePath(hexHash) + "." + fileInfo.suffix());
}
}
}
开发者ID:AaronHillaker,项目名称:hifi,代码行数:72,代码来源:AssetServer.cpp
示例18: malloc
void MainWindow::downloadFileFinished(QNetworkReply* reply) {
if (reply->error() != QNetworkReply::NoError) {
QMessageBox::critical(this, "ERROR", reply->errorString());
filesToDownload.clear();
nextFileToDownload = 0;
return;
}
int bufferSize = 8192 * 2;
char* buffer = (char*) malloc(bufferSize);
QSettings settings;
QString swgFolder = settings.value("swg_folder").toString();
QString downloadedFile = filesToDownload.at(nextFileToDownload);
downloadedFile = downloadedFile.remove(0, patchUrl.length());
QString dir;
if (downloadedFile.contains("/")) {
dir = downloadedFile.mid(0, downloadedFile.lastIndexOf("/"));
}
downloadedFile = downloadedFile.mid(downloadedFile.lastIndexOf("/") + 1);
QString fullPath;
if (dir.isEmpty())
fullPath = swgFolder + "/" + downloadedFile;
else
fullPath = swgFolder + "/" + dir + "/" + downloadedFile;
if (!QDir(swgFolder + "/" + dir).exists())
QDir(swgFolder + "/" + dir).mkpath(".");
QFile fileObject(fullPath);
//fileObject.set
if (!fileObject.open(QIODevice::WriteOnly)) {
QMessageBox::critical(this, "ERROR", "Could not open to write downloaded file to disk! " + swgFolder + "/" + downloadedFile);
filesToDownload.clear();
nextFileToDownload = 0;
free(buffer);
return;
}
int read = 0;
while ((read = reply->read(buffer, bufferSize)) > 0) {
if (fileObject.write(buffer, read) == -1) {
QMessageBox::critical(this, "ERROR", "Could not write downloaded file to disk!");
filesToDownload.clear();
nextFileToDownload = 0;
free(buffer);
return;
}
}
fileObject.close();
free(buffer);
qDebug() << "downloading file:" << downloadedFile << " finished!";
if (++nextFileToDownload < filesToDownload.size()) {
QString downloadingFile = filesToDownload.at(nextFileToDownload);
downloadingFile = downloadingFile.mid(downloadingFile.lastIndexOf("/") + 1);
ui->label_current_work->setStyleSheet("color:black");
ui->label_current_work->setText("Downloading: " + downloadingFile);
QNetworkReply* reply = clientFilesNetworkAccessManager.get(QNetworkRequest(filesToDownload.at(nextFileToDownload)));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
lastReceivedBytesTime.restart();
lastReceivedBytes = 0;
ui->progressBar_loading->setValue(nextFileToDownload);
} else {
ui->progressBar_loading->setValue(nextFileToDownload);
downloadFinished();
}
}
开发者ID:jwmclean,项目名称:Launchpad,代码行数:91,代码来源:mainwindow.cpp
示例19: qt_libraryInfoFile
QString qt_libraryInfoFile()
{
if (!Option::globals->qmake_abslocation.isEmpty())
return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf");
return QString();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:6,代码来源:option.cpp
示例20: QDir
void frmUpload::leSelectDirectoryChanged()
{
ui.pbScan->setEnabled(!ui.leSelectDirectory->text().isEmpty()
? QDir().exists(ui.leSelectDirectory->text())
: false);
}
开发者ID:zadziora,项目名称:qnapi,代码行数:6,代码来源:frmupload.cpp
注:本文中的QDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论