本文整理汇总了C++中profile::Ptr类的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void Profiler_Imp::Start(int id)
{
Profile::Ptr profile = nullptr;
for (auto& x : m_profiles)
{
if (x->GetID() == id)
{
profile = x;
}
}
if (profile == nullptr)
{
profile = make_shared<Profile>(id);
m_profiles.push_back(profile);
}
profile->GetCurrent()->SetStartTime(asd::GetTime());
#if _WIN32
profile->GetCurrent()->SetProcessorNumber(GetCurrentProcessorNumber());
#elif defined(__APPLE__)
// sched_getcpuがないようなので代用。よりよいものがあれば差し替えてください。
profile->GetCurrent()->SetProcessorNumber(
std::hash<std::thread::id>()(std::this_thread::get_id()));
#else
profile->GetCurrent()->SetProcessorNumber(sched_getcpu());
#endif
}
示例2: profileLabel
QString ProfilePlotView::profileLabel(Profile::Ptr profile)
{
if (profile->name())
return QString::fromStdString(profile->name().get());
if (profile->computer())
{
if (profile->computer()->name())
return QString::fromStdString(profile->computer()->name().get());
if (profile->computer()->model())
{
if (profile->computer()->manufacturer())
{
return QString("%1 %2")
.arg(QString::fromStdString(profile->computer()->manufacturer().get()))
.arg(QString::fromStdString(profile->computer()->model().get()));
}
else
{
return QString::fromStdString(profile->computer()->model().get());
}
}
}
return "Unknown Profile";
}
示例3: updateAction
void ProfileList::updateAction(QAction* action , Profile::Ptr info)
{
Q_ASSERT(action);
Q_ASSERT(info);
action->setText(info->name());
action->setIcon(KIcon(info->icon()));
}
示例4: setupAppearancePage
void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
{
ColorSchemeViewDelegate* delegate = new ColorSchemeViewDelegate(this);
_ui->colorSchemeList->setItemDelegate(delegate);
_colorSchemeAnimationTimeLine = new QTimeLine( 500 , this );
delegate->setEntryTimeLine(_colorSchemeAnimationTimeLine);
connect( _colorSchemeAnimationTimeLine , SIGNAL(valueChanged(qreal)) , this ,
SLOT(colorSchemeAnimationUpdate()) );
_ui->transparencyWarningWidget->setVisible(false);
_ui->editColorSchemeButton->setEnabled(false);
_ui->removeColorSchemeButton->setEnabled(false);
// setup color list
updateColorSchemeList(true);
_ui->colorSchemeList->setMouseTracking(true);
_ui->colorSchemeList->installEventFilter(this);
_ui->colorSchemeList->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
connect( _ui->colorSchemeList->selectionModel() ,
SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&))
, this , SLOT(colorSchemeSelected()) );
connect( _ui->colorSchemeList , SIGNAL(entered(const QModelIndex&)) , this ,
SLOT(previewColorScheme(const QModelIndex&)) );
updateColorSchemeButtons();
connect( _ui->editColorSchemeButton , SIGNAL(clicked()) , this ,
SLOT(editColorScheme()) );
connect( _ui->removeColorSchemeButton , SIGNAL(clicked()) , this ,
SLOT(removeColorScheme()) );
connect( _ui->newColorSchemeButton , SIGNAL(clicked()) , this ,
SLOT(newColorScheme()) );
// setup font preview
bool antialias = info->property<bool>(Profile::AntiAliasFonts);
QFont font = info->font();
if (!antialias)
font.setStyleStrategy(QFont::NoAntialias);
_ui->fontPreviewLabel->installEventFilter(this);
_ui->fontPreviewLabel->setFont(font);
_ui->fontSizeSlider->setValue( font.pointSize() );
_ui->fontSizeSlider->setMinimum( KGlobalSettings::smallestReadableFont().pointSize() );
connect( _ui->fontSizeSlider , SIGNAL(valueChanged(int)) , this ,
SLOT(setFontSize(int)) );
connect( _ui->editFontButton , SIGNAL(clicked()) , this ,
SLOT(showFontDialog()) );
// setup font smoothing
_ui->antialiasTextButton->setChecked(antialias);
connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this ,
SLOT(setAntialiasText(bool)) );
}
示例5: setupGeneralPage
void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
{
// basic profile options
_ui->profileNameEdit->setText( info->name() );
ShellCommand command( info->command() , info->arguments() );
_ui->commandEdit->setText( command.fullCommand() );
KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion);
exeCompletion->setParent(this);
exeCompletion->setDir(QString());
_ui->commandEdit->setCompletionObject( exeCompletion );
_ui->initialDirEdit->setText( info->defaultWorkingDirectory() );
KUrlCompletion* dirCompletion = new KUrlCompletion(KUrlCompletion::DirCompletion);
dirCompletion->setParent(this);
_ui->initialDirEdit->setCompletionObject( dirCompletion );
_ui->initialDirEdit->setClearButtonShown(true);
_ui->dirSelectButton->setIcon( KIcon("folder-open") );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
_ui->startInSameDirButton->setChecked(info->property<bool>(Profile::StartInCurrentSessionDir));
// window options
_ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) );
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
connect( _ui->iconSelectButton , SIGNAL(clicked()) , this , SLOT(selectIcon()) );
connect( _ui->startInSameDirButton , SIGNAL(toggled(bool)) , this ,
SLOT(startInSameDir(bool)));
connect( _ui->profileNameEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(profileNameChanged(const QString&)) );
connect( _ui->initialDirEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(initialDirChanged(const QString&)) );
connect(_ui->commandEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(commandChanged(const QString&)) );
connect(_ui->showMenuBarButton , SIGNAL(toggled(bool)) , this ,
SLOT(showMenuBar(bool)) );
connect(_ui->environmentEditButton , SIGNAL(clicked()) , this ,
SLOT(showEnvironmentEditor()) );
}
示例6: itemDataChanged
void ManageProfilesDialog::itemDataChanged(QStandardItem* item)
{
if (item->column() == ShortcutColumn) {
QKeySequence sequence = QKeySequence::fromString(item->text());
ProfileManager::instance()->setShortcut(item->data(ShortcutRole).value<Profile::Ptr>(),
sequence);
} else if (item->column() == ProfileNameColumn) {
QString newName = item->text();
Profile::Ptr profile = item->data(ProfileKeyRole).value<Profile::Ptr>();
QString oldName = profile->name();
if (newName != oldName) {
QHash<Profile::Property, QVariant> properties;
properties.insert(Profile::Name, newName);
properties.insert(Profile::UntranslatedName, newName);
ProfileManager::instance()->changeProfile(profile, properties);
}
}
}
示例7: addItems
void ManageProfilesDialog::addItems(const Profile::Ptr profile)
{
if (profile->isHidden())
return;
QList<QStandardItem*> items;
for (int i = 0; i < 3; i++)
items << new QStandardItem;
updateItemsForProfile(profile, items);
_sessionModel->appendRow(items);
}
示例8: addItems
void ProfileSettings::addItems(const Profile::Ptr profile)
{
if (profile->isHidden())
return;
QList<QStandardItem*> items;
items.reserve(3);
for (int i = 0; i < 3; i++)
items.append(new QStandardItem);
updateItemsForProfile(profile, items);
_sessionModel->appendRow(items);
}
示例9: testProfileFileNames
// Verify the correct file name is created from the untranslatedname
void ProfileTest::testProfileFileNames()
{
Profile::Ptr profile = Profile::Ptr(new Profile);
QFileInfo fileInfo;
ProfileWriter* writer = new KDE4ProfileWriter;
profile->setProperty(Profile::UntranslatedName, "Indiana");
fileInfo.setFile(writer->getPath(profile));
QCOMPARE(fileInfo.fileName(), QString("Indiana.profile"));
profile->setProperty(Profile::UntranslatedName, "Old Paris");
fileInfo.setFile(writer->getPath(profile));
QCOMPARE(fileInfo.fileName(), QString("Old Paris.profile"));
/* FIXME: deal w/ file systems that are case-insensitive
This leads to confusion as both Test and test can appear in the Manager
Profile dialog while really there is only 1 test.profile file.
Suggestions: all lowercase, testing the file system, ...
*/
/*
profile->setProperty(Profile::UntranslatedName, "New Profile");
fileInfo.setFile(writer->getPath(profile));
QCOMPARE(fileInfo.fileName(), QString("new profile.profile"));
*/
/* FIXME: don't allow certain characters in file names
Consider: ,^@=+{}[]~!?:&*\"|#%<>$\"'();`'/\
Suggestions: changing them all to _, just remove them, ...
Bug 315086 comes from a user using / in the profile name - multiple
issues there.
*/
/*
profile->setProperty(Profile::UntranslatedName, "new/profile");
fileInfo.setFile(writer->getPath(profile));
QCOMPARE(fileInfo.fileName(), QString("new_profile.profile"));
*/
delete writer;
}
示例10: End
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void Profiler_Imp::End(int id)
{
Profile::Ptr profile = nullptr;
for (auto& x : m_profiles)
{
if (x->GetID() == id)
{
profile = x;
}
}
if (profile == nullptr)
{
#if _WIN32
throw exception("対応するStartがありません。");
#else
assert(0);
#endif
}
profile->GetCurrent()->SetEndTime(asd::GetTime());
profile->Archive();
}
示例11: updateItemsForProfile
void ManageProfilesDialog::updateItemsForProfile(const Profile::Ptr profile, QList<QStandardItem*>& items) const
{
// Profile Name
items[ProfileNameColumn]->setText(profile->name());
if (!profile->icon().isEmpty())
items[ProfileNameColumn]->setIcon(KIcon(profile->icon()));
items[ProfileNameColumn]->setData(QVariant::fromValue(profile), ProfileKeyRole);
items[ProfileNameColumn]->setToolTip(i18nc("@info:tooltip", "Click to rename profile"));
// Favorite Status
const bool isFavorite = ProfileManager::instance()->findFavorites().contains(profile);
if (isFavorite)
items[FavoriteStatusColumn]->setData(KIcon("dialog-ok-apply"), Qt::DecorationRole);
else
items[FavoriteStatusColumn]->setData(KIcon(), Qt::DecorationRole);
items[FavoriteStatusColumn]->setData(QVariant::fromValue(profile), ProfileKeyRole);
items[FavoriteStatusColumn]->setToolTip(i18nc("@info:tooltip", "Click to toggle status"));
// Shortcut
QString shortcut = ProfileManager::instance()->shortcut(profile).toString();
items[ShortcutColumn]->setText(shortcut);
items[ShortcutColumn]->setData(QVariant::fromValue(profile), ShortcutRole);
items[ShortcutColumn]->setToolTip(i18nc("@info:tooltip", "Double click to change shortcut"));
}
示例12: parse_dives
void TransferWorker::parse_dives(Driver::Ptr driver, const dive_data_t & dives)
{
IMixFinder::Ptr mf = boost::dynamic_pointer_cast<IMixFinder>(m_session->finder<Mix>());
Mix::Ptr air = mf->findByName("Air");
parser_data data;
data.mixfinder = mf;
// Parse the Dives
dive_data_t::const_iterator it;
for (it = dives.begin(); it != dives.end(); it++)
{
// Setup Parser Data
data.dive.reset(new Dive);
data.mixes.clear();
data.profile.clear();
data.vendor.clear();
data.haswp = false;
data.curmix = air;
// Parse the Header and Profile
driver->parse(it->first, & parse_header, & parse_profile, & data);
// Append the final Waypoint
if (data.haswp)
data.profile.push_back(data.curwp);
// Update Dive Data
data.dive->setComputer(m_dc);
// Set the Dive Mix as the first Mix in the profile
if (data.haswp)
data.dive->setMix(data.profile.begin()->mix);
// Create Profile
Profile::Ptr profile = Profile::Ptr(new Profile);
profile->setComputer(m_dc);
profile->setDive(data.dive);
profile->setImported(time(NULL));
profile->setProfile(data.profile);
profile->setRawProfile(it->first);
profile->setVendor(json_encode(data.vendor));
// Emit Parsed Dive
emit parsedDive(profile);
}
}
示例13: setProfile
void EditProfileDialog::setProfile(Profile::Ptr profile)
{
_profileKey = profile;
Q_ASSERT( profile );
// update caption
updateCaption(profile->name());
// mark each page of the dialog as out of date
// and force an update of the currently visible page
//
// the other pages will be updated as necessary
_pageNeedsUpdate.fill(true);
preparePage( _ui->tabWidget->currentIndex() );
if ( _tempProfile )
{
_tempProfile = new Profile;
}
}
示例14: fileInfo
QString KDE4ProfileWriter::getPath(const Profile::Ptr profile)
{
// both location have trailing slash
static const QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/konsole/");
static const QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last() + QStringLiteral("konsole/");
const QString candidateLocalPath = localDataLocation + profile->untranslatedName() + ".profile";
QString newPath;
// when the path property is not set, it means the profile has just
// been created in memory and has never been saved into disk before.
//
// use "name.profile" as filename and save it under $KDEHOME
if (!profile->isPropertySet(Profile::Path)) {
return candidateLocalPath;
}
// for a system wide profile, save the modified version as
// a local profile under $KDEHOME
if (profile->path().startsWith(systemDataLocation)) {
return candidateLocalPath;
}
// for a local profile, use its existing path
if (profile->path().startsWith(localDataLocation)) {
newPath = profile->path();
} else {
// for the ad-hoc profiles in non-standard places
//
// * if its path is writable for user, use its existing path
// * if its path is not writable for user, save it under $KDEHOME
//
QFileInfo fileInfo(profile->path());
if (fileInfo.isWritable()) {
newPath = profile->path();
} else {
newPath = candidateLocalPath;
}
}
return newPath;
}
示例15: while
void KDE4ProfileWriter::writeProperties(KConfig& config,
const Profile::Ptr profile,
const Profile::PropertyInfo* properties)
{
const char* groupName = 0;
KConfigGroup group;
while (properties->name != 0) {
if (properties->group != 0) {
if (groupName == 0 || qstrcmp(groupName, properties->group) != 0) {
group = config.group(properties->group);
groupName = properties->group;
}
if (profile->isPropertySet(properties->property))
group.writeEntry(QString(properties->name),
profile->property<QVariant>(properties->property));
}
properties++;
}
}