// Save all models under their original names void Aten::saveModels() { for (Model* m = models_.first(); m != NULL; m = m->next) { setCurrentModel(m); // Check model's filter - it will be the import filter, so try to get the partner FilePluginInterface* plugin = m->plugin(); if (plugin == NULL) { Messenger::print("No plugin available for model '%s'. Not saved.", qPrintable(m->name())); continue; } if (! plugin->canExport()) { Messenger::print("Plugin for model '%s' has no export capability (format '%s'). Not saved.", qPrintable(m->name()), qPrintable(plugin->name())); continue; } if (m->filename().isEmpty()) { Messenger::print("Model '%s' has no filename set. Not saved.", qPrintable(m->name())); continue; } // Save the model exportModel(m, m->filename(), m->plugin()); } }
// Export all currently loaded models in the referenced format void Aten::exportModels() { Messenger::enter("Aten::exportModels"); QFileInfo fileInfo; QString newFilename; // Loop over loaded models for (Model* m = models_.first(); m != NULL; m = m->next) { // Set current model setCurrentModel(m); // Generate new filename for model, with new suffix fileInfo.setFile(m->filename()); newFilename = fileInfo.dir().absoluteFilePath(fileInfo.baseName() + "." + exportModelPlugin_->extensions().first()); QFileInfo newFileInfo(newFilename); // Make sure that the new filename is not the same as the old filename if (fileInfo == newFileInfo) { Messenger::print("Exported file would overwrite the original (%s) - not converted.", qPrintable(m->filename())); continue; } if (exportModel(m, newFilename, exportModelPlugin_, FilePluginStandardImportOptions(), exportModelPluginOptions_)) Messenger::print("Model '%s' saved to file '%s' (%s)", qPrintable(m->name()), qPrintable(newFilename), qPrintable(exportModelPlugin_->name())); else Messenger::print("Failed to save model '%s'.", qPrintable(m->name())); m->enableUndoRedo(); } Messenger::exit("Aten::exportModels"); }
bool ModelMgrWidget::init() { bool result = true; // setCurrentModel(QStringLiteral("数据管理")); return result; }
// Run all stored commands on all loaded models void Aten::processModels() { ReturnValue rv; for (Model* m = models_.first(); m != NULL; m = m->next) { for (Program* cmd = batchCommands_.first(); cmd != NULL; cmd = cmd->next) { // Set the current model setCurrentModel(m); // Run the command list if (!cmd->execute(rv)) return; } } }
Qtwitter::Qtwitter( QWidget *parent ) : MainWindow( parent ) { connect( this, SIGNAL(switchModel(QString)), SLOT(setCurrentModel(QString)) ); connect( this, SIGNAL(switchToPublicTimelineModel()), SLOT(setPublicTimelineModel()) ); core = new Core( this ); connect( this, SIGNAL(updateTweets()), core, SLOT(forceGet()) ); connect( this, SIGNAL(openBrowser(QUrl)), core, SLOT(openBrowser(QUrl)) ); connect( this, SIGNAL(post(QString,QString,int)), core, SLOT(post(QString,QString,int)) ); connect( this, SIGNAL(resizeView(int,int)), core, SIGNAL(resizeData(int,int))); connect( this, SIGNAL(shortenUrl(QString)), core, SLOT(shortenUrl(QString))); connect( core, SIGNAL(twitterAccountsChanged(QList<TwitterAccount>,bool)), this, SLOT(setupTwitterAccounts(QList<TwitterAccount>,bool)) ); connect( core, SIGNAL(urlShortened(QString)), this, SLOT(replaceUrl(QString))); connect( core, SIGNAL(about()), this, SLOT(about()) ); connect( core, SIGNAL(addReplyString(QString,int)), this, SIGNAL(addReplyString(QString,int)) ); connect( core, SIGNAL(addRetweetString(QString)), this, SIGNAL(addRetweetString(QString)) ); connect( core, SIGNAL(errorMessage(QString)), this, SLOT(popupError(QString)) ); connect( core, SIGNAL(resetUi()), this, SLOT(resetStatusEdit()) ); connect( core, SIGNAL(requestStarted()), this, SLOT(showProgressIcon()) ); if ( QSystemTrayIcon::supportsMessages() ) connect( core, SIGNAL(sendNewsReport(QString)), this, SLOT(popupMessage(QString)) ); twitpic = new TwitPicView( this ); connect( twitpic, SIGNAL(uploadPhoto(QString,QString,QString)), core, SLOT(uploadPhoto(QString,QString,QString)) ); connect( twitpic, SIGNAL(abortUpload()), core, SLOT(abortUploadPhoto()) ); connect( this, SIGNAL(openTwitPicDialog()), twitpic, SLOT(show()) ); connect( core, SIGNAL(twitPicResponseReceived()), twitpic, SLOT(resetForm()) ); connect( core, SIGNAL(twitPicDataSendProgress(int,int)), twitpic, SLOT(showUploadProgress(int,int)) ); settingsDialog = new Settings( this, core, twitpic, this ); connect( this, SIGNAL(settingsDialogRequested()), settingsDialog, SLOT( show() ) ); QSignalMapper *mapper = new QSignalMapper( this ); mapper->setMapping( qApp, 1 ); connect( qApp, SIGNAL(aboutToQuit()), mapper, SLOT(map()) ); connect( mapper, SIGNAL(mapped(int)), settingsDialog, SLOT(saveConfig(int)) ); }
void ModelMgrWidget::updateModels() { // QLayoutItem *child; while (child = q_horiLayoutMain->takeAt(0)) { QWidget *widget = child->widget(); if (widget) { widget->setParent(0); widget->deleteLater(); } delete child; } // IconButton *buttonHome = new IconButton(QPixmap(":/application/image/home-1.png"), this); buttonHome->setObjectName("buttonHome"); buttonHome->setFixedSize(25, 25); buttonHome->setToolTip(QStringLiteral("主页")); q_horiLayoutMain->addWidget(buttonHome); QComboBox *comboBoxModel = new QComboBox(this); comboBoxModel->addItem(QStringLiteral("数据管理")); comboBoxModel->addItem(QStringLiteral("数据查询")); comboBoxModel->addItem(QStringLiteral("数据分析")); comboBoxModel->setMinimumWidth(QFontMetrics(comboBoxModel->font()) .width(comboBoxModel->itemText(0)) + 50); comboBoxModel->setToolTip(QStringLiteral("只切换模式界面,不初始化界面数据")); q_horiLayoutMain->addWidget(comboBoxModel); // connect(buttonHome, &QPushButton::clicked, [=](bool){ setCurrentModel(QStringLiteral("数据管理")); }); // QStringListIterator citerModelStack(q_modelStack); while (citerModelStack.hasNext()) { const QString &model = citerModelStack.next(); // JClickableLabel *labelName = new JClickableLabel(model, this); labelName->setObjectName("labelName"); labelName->setAlignment(Qt::AlignVCenter); labelName->setText(model); IconButton *buttonArrow = new IconButton(QPixmap(":/application/image/arrow-1.png"), this); buttonArrow->setObjectName("buttonArrow"); buttonArrow->setFixedSize(20, 25); q_horiLayoutMain->addWidget(labelName); q_horiLayoutMain->addWidget(buttonArrow); // connect(labelName, &JClickableLabel::clicked, [=](){ setCurrentModel(labelName->text()); }); } // comboBoxModel->setCurrentText(q_modelStack.last()); // connect(comboBoxModel, &QComboBox::currentTextChanged, [=](const QString &text){ setCurrentModel(text, false); Q_EMIT currentIndexChanged(text); }); }