本文整理汇总了C++中setProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ setProperty函数的具体用法?C++ setProperty怎么用?C++ setProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setProperty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QLOG_DEBUG
void KonvergoWindow::handleHostCommand(QString hostCommand)
{
QLOG_DEBUG() << "Got command:" << hostCommand;
QString arguments = "";
int arguments_start = hostCommand.indexOf(":");
if (arguments_start > 0)
{
arguments = hostCommand.mid(arguments_start + 1);
hostCommand = hostCommand.mid(0, arguments_start);
}
if (hostCommand == "fullscreen")
{
SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", !SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fullscreen").toBool());
}
else if (hostCommand == "close")
{
close();
}
else if (hostCommand == "player")
{
PlayerComponent::Get().userCommand(arguments);
}
else if (hostCommand == "toggleDebug")
{
if (property("showDebugLayer").toBool())
{
m_infoTimer->stop();
setProperty("showDebugLayer", false);
}
else
{
m_infoTimer->start();
updateDebugInfo();
setProperty("showDebugLayer", true);
}
}
else if (hostCommand == "recreateRpiUi")
{
DisplayManager* display_manager = DisplayComponent::Get().getDisplayManager();
if (display_manager)
display_manager->resetRendering();
}
else if (hostCommand == "reload")
{
emit reloadWebClient();
}
else if (hostCommand == "crash!")
{
*(volatile int*)0=0;
}
else if (hostCommand == "poweroff")
{
PowerComponent::Get().PowerOff();
}
else if (hostCommand == "suspend")
{
PowerComponent::Get().Suspend();
}
else if (hostCommand == "reboot")
{
PowerComponent::Get().Reboot();
}
else
{
QLOG_WARN() << "unknown host command" << hostCommand;
}
}
开发者ID:speedst3r,项目名称:plex-media-player,代码行数:67,代码来源:KonvergoWindow.cpp
示例2: setProperty
void CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, ExceptionCode& ec)
{
setProperty(propertyID, value, important, true, ec);
}
开发者ID:acss,项目名称:owb-mirror,代码行数:4,代码来源:CSSMutableStyleDeclaration.cpp
示例3: setProperty
void
HrPwWindow::configChanged(qint32)
{
setProperty("color", GColor(CPLOTBACKGROUND));
}
开发者ID:GoldenCheetah,项目名称:GoldenCheetah,代码行数:5,代码来源:HrPwWindow.cpp
示例4: HWSensorsFatalLog
bool PTIDSensors::start(IOService * provider)
{
if (!super::start(provider))
return false;
acpiDevice = (IOACPIPlatformDevice *)provider;
if (!acpiDevice) {
HWSensorsFatalLog("ACPI device not ready");
return false;
}
// On some computers (eg. RehabMan's ProBook 4530s), the system will hang on startup
// if kernel cache is used, because of the early call to updateTemperatures and/or
// updateTachometers. At least that is the case with an SSD and a valid pre-linked
// kernel, along with kernel cache enabled. This 1000ms sleep seems to fix the problem,
// enabling a clean boot with PTIDSensors enabled.
IOSleep(1000);
// Update timers
temperaturesLastUpdated = ptimer_read() - NSEC_PER_SEC;
tachometersLastUpdated = temperaturesLastUpdated;
acpiDevice->evaluateInteger("IVER", &version);
if (version == 0) {
OSString *name = OSDynamicCast(OSString, provider->getProperty("name"));
if (name && name->isEqualTo("INT3F0D"))
version = 0x30000;
else
return false;
}
setProperty("version", version, 64);
// Parse sensors
switch (version) {
case 0x30000: {
OSObject *object = NULL;
// Temperatures
if(kIOReturnSuccess == acpiDevice->evaluateObject("TSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing temperatures...");
int count = description->getCount();
for (int i = 1; i < count; i += 2) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(i)), i/2);
}
}
}
else HWSensorsErrorLog("failed to evaluate TSDL table");
// Tachometers
if(kIOReturnSuccess == acpiDevice->evaluateObject("OSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing tachometers...");
int count = description->getCount();
for (int i = 2; i < count; i += 3) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(i)), OSDynamicCast(OSString, description->getObject(i-1)), i/3);
}
}
}
else HWSensorsErrorLog("failed to evaluate OSDL table");
break;
}
case 0x20001: {
OSObject *object = NULL;
// Temperatures
if (kIOReturnSuccess == acpiDevice->evaluateObject("TMPV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing temperatures...");
int count = description->getCount();
for (int i = 1; i < count; i += 3) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(i)), i+1);
}
}
}
else HWSensorsErrorLog("failed to evaluate TMPV table");
// Tachometers
if (kIOReturnSuccess == acpiDevice->evaluateObject("OSDV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing tachometers...");
int count = description->getCount();
for (int i = 2; i < count; i += 4) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(i)), OSDynamicCast(OSString, description->getObject(i-1)), i+1);
}
}
}
else HWSensorsErrorLog("failed to evaluate OSDV table");
break;
}
//.........这里部分代码省略.........
开发者ID:Blackjva,项目名称:OS-X-FakeSMC-kozlek,代码行数:101,代码来源:PTIDSensors.cpp
示例5: toLamMonitor
/**
* Convert the TOF workspace into a monitor workspace. Crops to the monitorIndex and applying flat background correction as part of the process.
* @param toConvert : TOF wavlength to convert.
* @param monitorIndex : Monitor index to crop to
* @param backgroundMinMax : Min and Max Lambda range for Flat background correction.
* @return The cropped and corrected monitor workspace.
*/
MatrixWorkspace_sptr ReflectometryWorkflowBase::toLamMonitor(const MatrixWorkspace_sptr& toConvert,
const int monitorIndex, const MinMax& backgroundMinMax)
{
// Convert Units.
auto convertUnitsAlg = this->createChildAlgorithm("ConvertUnits");
convertUnitsAlg->initialize();
convertUnitsAlg->setProperty("InputWorkspace", toConvert);
convertUnitsAlg->setProperty("Target", "Wavelength");
convertUnitsAlg->setProperty("AlignBins", true);
convertUnitsAlg->execute();
// Crop the to the monitor index.
MatrixWorkspace_sptr monitorWS = convertUnitsAlg->getProperty("OutputWorkspace");
auto cropWorkspaceAlg = this->createChildAlgorithm("CropWorkspace");
cropWorkspaceAlg->initialize();
cropWorkspaceAlg->setProperty("InputWorkspace", monitorWS);
cropWorkspaceAlg->setProperty("StartWorkspaceIndex", monitorIndex);
cropWorkspaceAlg->setProperty("EndWorkspaceIndex", monitorIndex);
cropWorkspaceAlg->execute();
monitorWS = cropWorkspaceAlg->getProperty("OutputWorkspace");
// Flat background correction
auto correctMonitorsAlg = this->createChildAlgorithm("CalculateFlatBackground");
correctMonitorsAlg->initialize();
correctMonitorsAlg->setProperty("InputWorkspace", monitorWS);
correctMonitorsAlg->setProperty("WorkspaceIndexList",
boost::assign::list_of(0).convert_to_container<std::vector<int> >());
correctMonitorsAlg->setProperty("StartX", backgroundMinMax.get<0>());
correctMonitorsAlg->setProperty("EndX", backgroundMinMax.get<1>());
correctMonitorsAlg->setProperty("SkipMonitors",false);
correctMonitorsAlg->execute();
monitorWS = correctMonitorsAlg->getProperty("OutputWorkspace");
return monitorWS;
}
开发者ID:BigShows,项目名称:mantid,代码行数:42,代码来源:ReflectometryWorkflowBase.cpp
示例6: setFunction
/** Executes the algorithm
*
* @throw runtime_error Thrown if algorithm cannot execute
*/
void Fit::exec()
{
// this is to make it work with AlgorithmProxy
if (!m_domainCreator)
{
setFunction();
addWorkspaces();
}
std::string ties = getPropertyValue("Ties");
if (!ties.empty())
{
m_function->addTies(ties);
}
std::string contstraints = getPropertyValue("Constraints");
if (!contstraints.empty())
{
m_function->addConstraints(contstraints);
}
// prepare the function for a fit
m_function->setUpForFit();
API::FunctionDomain_sptr domain;
API::FunctionValues_sptr values; // TODO: should values be part of domain?
m_domainCreator->ignoreInvalidData(getProperty("IgnoreInvalidData"));
m_domainCreator->createDomain(domain,values);
// do something with the function which may depend on workspace
m_domainCreator->initFunction(m_function);
// get the minimizer
std::string minimizerName = getPropertyValue("Minimizer");
API::IFuncMinimizer_sptr minimizer = API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName);
// Try to retrieve optional properties
const int maxIterations = getProperty("MaxIterations");
// get the cost function which must be a CostFuncFitting
boost::shared_ptr<CostFuncFitting> costFunc = boost::dynamic_pointer_cast<CostFuncFitting>(
API::CostFunctionFactory::Instance().create(getPropertyValue("CostFunction"))
);
costFunc->setFittingFunction(m_function,domain,values);
minimizer->initialize(costFunc);
const int64_t nsteps = maxIterations*m_function->estimateNoProgressCalls();
API::Progress prog(this,0.0,1.0,nsteps);
m_function->setProgressReporter(&prog);
// do the fitting until success or iteration limit is reached
size_t iter = 0;
bool success = false;
std::string errorString;
g_log.debug("Starting minimizer iteration\n");
while (static_cast<int>(iter) < maxIterations)
{
iter++;
g_log.debug() << "Starting iteration " << iter << "\n";
m_function->iterationStarting();
if ( !minimizer->iterate() )
{
errorString = minimizer->getError();
g_log.debug() << "Iteration stopped. Minimizer status string=" << errorString << "\n";
success = errorString.empty() || errorString == "success";
if (success)
{
errorString = "success";
}
break;
}
prog.report();
m_function->iterationFinished();
if(g_log.is(Kernel::Logger::Priority::PRIO_INFORMATION))
{
g_log.debug() << "Iteration " << iter << ", cost function = " << minimizer->costFunctionVal() << "\n";
}
}
g_log.debug() << "Number of minimizer iterations=" << iter << "\n";
if (static_cast<int>(iter) >= maxIterations)
{
if ( !errorString.empty() )
{
errorString += '\n';
}
errorString += "Failed to converge after " + boost::lexical_cast<std::string>(maxIterations) + " iterations.";
}
// return the status flag
setPropertyValue("OutputStatus",errorString);
// degrees of freedom
size_t dof = domain->size() - costFunc->nParams();
if (dof == 0) dof = 1;
//.........这里部分代码省略.........
开发者ID:jkrueger1,项目名称:mantid,代码行数:101,代码来源:Fit.cpp
示例7: getProperty
void ModeratorTzero::execEvent(const std::string &emode) {
g_log.information("Processing event workspace");
const MatrixWorkspace_const_sptr matrixInputWS =
getProperty("InputWorkspace");
// generate the output workspace pointer
API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
if (matrixOutputWS != matrixInputWS) {
matrixOutputWS = matrixInputWS->clone();
setProperty("OutputWorkspace", matrixOutputWS);
}
auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
// calculate tof shift once for all neutrons if emode==Direct
double t0_direct(-1);
if (emode == "Direct") {
Kernel::Property *eiprop = outputWS->run().getProperty("Ei");
double Ei = boost::lexical_cast<double>(eiprop->value());
mu::Parser parser;
parser.DefineVar("incidentEnergy", &Ei); // associate E1 to this parser
parser.SetExpr(m_formula);
t0_direct = parser.Eval();
}
const auto &spectrumInfo = outputWS->spectrumInfo();
const double Lss = spectrumInfo.l1();
// Loop over the spectra
const size_t numHists = static_cast<size_t>(outputWS->getNumberHistograms());
Progress prog(this, 0.0, 1.0, numHists); // report progress of algorithm
PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS))
for (int i = 0; i < static_cast<int>(numHists); ++i) {
PARALLEL_START_INTERUPT_REGION
size_t wsIndex = static_cast<size_t>(i);
EventList &evlist = outputWS->getSpectrum(wsIndex);
if (evlist.getNumberEvents() > 0) // don't bother with empty lists
{
double L1(Lss); // distance from source to sample
double L2(-1); // distance from sample to detector
if (spectrumInfo.hasDetectors(i)) {
if (spectrumInfo.isMonitor(i)) {
// redefine the sample as the monitor
L1 = Lss + spectrumInfo.l2(i); // L2 in SpectrumInfo defined negative
L2 = 0;
} else {
L2 = spectrumInfo.l2(i);
}
} else {
g_log.error() << "Unable to calculate distances to/from detector" << i
<< '\n';
}
if (L2 >= 0) {
// One parser for each parallel processor needed (except Edirect mode)
double E1;
mu::Parser parser;
parser.DefineVar("incidentEnergy", &E1); // associate E1 to this parser
parser.SetExpr(m_formula);
// fast neutrons are shifted by min_t0_next, irrespective of tof
double v1_max = L1 / m_t1min;
E1 = m_convfactor * v1_max * v1_max;
double min_t0_next = parser.Eval();
if (emode == "Indirect") {
double t2(-1.0); // time from sample to detector. (-1) signals error
if (spectrumInfo.isMonitor(i)) {
t2 = 0.0;
} else {
static const double convFact =
1.0e-6 * sqrt(2 * PhysicalConstants::meV /
PhysicalConstants::NeutronMass);
std::vector<double> wsProp =
spectrumInfo.detector(i).getNumberParameter("Efixed");
if (!wsProp.empty()) {
double E2 = wsProp.at(0); //[E2]=meV
double v2 = convFact * sqrt(E2); //[v2]=meter/microsec
t2 = L2 / v2;
} else {
// t2 is kept to -1 if no Efixed is found
g_log.debug() << "Efixed not found for detector " << i << '\n';
}
}
if (t2 >= 0) // t2 < 0 when no detector info is available
{
// fix the histogram bins
auto &x = evlist.mutableX();
for (double &tof : x) {
if (tof < m_t1min + t2)
tof -= min_t0_next;
else
tof -= CalculateT0indirect(tof, L1, t2, E1, parser);
}
MantidVec tofs = evlist.getTofs();
for (double &tof : tofs) {
if (tof < m_t1min + t2)
tof -= min_t0_next;
//.........这里部分代码省略.........
开发者ID:DanNixon,项目名称:mantid,代码行数:101,代码来源:ModeratorTzero.cpp
示例8: QWidget
LoginPage::LoginPage(QWidget* parent)
: QWidget(parent)
, country_code_(new LineEditEx(this))
, phone_(new LineEditEx(this))
, combobox_(new CountrySearchCombobox(this))
, remaining_seconds_(0)
, timer_(new QTimer(this))
{
setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true));
if (objectName().isEmpty())
setObjectName(QStringLiteral("login_page"));
setProperty("LoginPageWidget", QVariant(true));
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
verticalLayout->setSpacing(0);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
auto back_button_widget = new QWidget(this);
auto back_button_layout = new QHBoxLayout(back_button_widget);
Utils::ApplyStyle(back_button_widget, "background-color: transparent;");
back_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
back_button_layout->setSpacing(0);
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
back_button_layout->setAlignment(Qt::AlignLeft);
{
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
prev_page_link_->setFlat(true);
prev_page_link_->setFocusPolicy(Qt::NoFocus);
prev_page_link_->setCursor(Qt::PointingHandCursor);
{
const QString s = "QPushButton { width: 20dip; height: 20dip; border: none; background-color: transparent; border-image: url(:/resources/contr_back_100.png); margin: 10dip; } QPushButton:hover { border-image: url(:/resources/contr_back_100_hover.png); } QPushButton#back_button:pressed { border-image: url(:/resources/contr_back_100_active.png); }";
Utils::ApplyStyle(prev_page_link_, s);
}
back_button_layout->addWidget(prev_page_link_);
}
verticalLayout->addWidget(back_button_widget);
/*
QWidget* back_button_widget = new QWidget(this);
back_button_widget->setObjectName(QStringLiteral("back_button_widget"));
back_button_widget->setProperty("BackButtonWidget", QVariant(true));
QHBoxLayout* back_button_layout = new QHBoxLayout(back_button_widget);
back_button_layout->setSpacing(0);
back_button_layout->setObjectName(QStringLiteral("back_button_layout"));
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setObjectName(QStringLiteral("prev_page_link"));
prev_page_link_->setCursor(QCursor(Qt::PointingHandCursor));
prev_page_link_->setProperty("LoginBackButton", QVariant(true));
back_button_layout->addWidget(prev_page_link_);
QSpacerItem* horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
back_button_layout->addItem(horizontalSpacer_3);
verticalLayout->addWidget(back_button_widget);
*/
QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout->addItem(verticalSpacer);
QWidget* main_widget = new QWidget(this);
main_widget->setObjectName(QStringLiteral("main_widget"));
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(main_widget->sizePolicy().hasHeightForWidth());
main_widget->setSizePolicy(sizePolicy);
main_widget->setProperty("CenterControlWidgetBack", QVariant(true));
QHBoxLayout* main_layout = new QHBoxLayout(main_widget);
main_layout->setSpacing(0);
main_layout->setObjectName(QStringLiteral("main_layout"));
main_layout->setContentsMargins(0, 0, 0, 0);
QSpacerItem* horizontalSpacer_6 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
main_layout->addItem(horizontalSpacer_6);
QWidget* controls_widget = new QWidget(main_widget);
controls_widget->setObjectName(QStringLiteral("controls_widget"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(controls_widget->sizePolicy().hasHeightForWidth());
controls_widget->setSizePolicy(sizePolicy1);
controls_widget->setProperty("CenterContolWidget", QVariant(true));
QVBoxLayout* controls_layout = new QVBoxLayout(controls_widget);
controls_layout->setSpacing(0);
controls_layout->setObjectName(QStringLiteral("controls_layout"));
controls_layout->setContentsMargins(0, 0, 0, 0);
PictureWidget* logo_widget = new PictureWidget(controls_widget, ":/resources/main_window/content_logo_100.png");
logo_widget->setFixedHeight(Utils::scale_value(80));
logo_widget->setFixedWidth(Utils::scale_value(80));
controls_layout->addWidget(logo_widget);
controls_layout->setAlignment(logo_widget, Qt::AlignHCenter);
QLabel* welcome_label = new QLabel(controls_widget);
welcome_label->setObjectName(QStringLiteral("welcome_label"));
welcome_label->setAlignment(Qt::AlignCenter);
welcome_label->setProperty("WelcomeTitle", QVariant(true));
//.........这里部分代码省略.........
开发者ID:4ynyky,项目名称:icqdesktop,代码行数:101,代码来源:LoginPage.cpp
示例9: UITaskMediumEnumeration
/** Constructs @a medium enumeration task. */
UITaskMediumEnumeration(const UIMedium &medium)
: UITask(UITask::Type_MediumEnumeration)
{
/* Store medium as property: */
setProperty("medium", QVariant::fromValue(medium));
}
开发者ID:pombredanne,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:7,代码来源:UIMediumEnumerator.cpp
示例10: setProperty
/**
* Remove the options menu from this screen.
* @return True if success, false otherwise ( for instance the options
* menu has no content.
*/
void Screen::removeOptionsMenu()
{
setProperty(MAW_SCREEN_REMOVE_OPTIONS_MENU,"");
}
开发者ID:kopsha,项目名称:MoSync,代码行数:9,代码来源:Screen.cpp
示例11: patchEntities
//.........这里部分代码省略.........
{
e = getEntityByStartXY(x, y);
if (e != NULL)
{
e->inUse = FALSE;
found = TRUE;
}
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %s %s %s", itemName, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
else
{
e = getEntityByObjectiveName(itemName);
}
if (e != NULL)
{
if (strcmpignorecase(value, "NULL") == 0)
{
STRNCPY(value, "", sizeof(value));
}
setProperty(e, key, value);
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY_BY_START") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %d %d %s %[^\n]s", &x, &y, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
else
{
e = getEntityByStartXY(x, y);
}
if (e != NULL)
{
setProperty(e, key, value);
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY_BY_XY") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %d %d %s %[^\n]s", &x, &y, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
开发者ID:LibreGames,项目名称:edgar,代码行数:66,代码来源:resources.c
示例12: malloc
//.........这里部分代码省略.........
}
else if (strstr(line, "INVENTORY_INDEX") != NULL)
{
sscanf(line, "%*s %d", &startX);
setInventoryIndex(startX);
}
else if (strcmpignorecase(line, "ENTITY_DATA") == 0)
{
resourceType = ENTITY_DATA;
}
else if (strcmpignorecase(line, "{") == 0)
{
i = 0;
name = type = startX = startY = -1;
e = NULL;
}
else if (strcmpignorecase(line, "}") == 0)
{
e = addEntityFromResource(value[type], value[name], startX == -1 ? 0 : atoi(value[startX]), startY == -1 ? 0 : atoi(value[startY]));
if (e != NULL)
{
for (i=0;i<MAX_PROPS_FILES;i++)
{
if (strlen(key[i]) > 0)
{
setProperty(e, key[i], value[i]);
}
}
if (resourceType == PLAYER_INVENTORY)
{
addToInventory(e);
}
}
for (i=0;i<MAX_PROPS_FILES;i++)
{
key[i][0] = '\0';
value[i][0] = '\0';
}
i = 0;
}
else
{
token = strtok_r(line, " ", &savePtr2);
STRNCPY(key[i], token, MAX_VALUE_LENGTH);
token = strtok_r(NULL, "\0", &savePtr2);
if (token != NULL)
{
STRNCPY(value[i], token, MAX_VALUE_LENGTH);
}
开发者ID:LibreGames,项目名称:edgar,代码行数:66,代码来源:resources.c
示例13: getProperty
//.........这里部分代码省略.........
//Get input workspace and offset
const MatrixWorkspace_sptr inputW = getProperty("InputWorkspace");
m_algFactor = getProperty("Factor");
m_parname = getPropertyValue("InstrumentParameter");
m_combine = getProperty("Combine");
if(m_combine && m_parname.empty())
{
throw std::invalid_argument("Combine behaviour requested but the InstrumentParameter argument is blank.");
}
const std::string op = getPropertyValue("Operation");
API::MatrixWorkspace_sptr outputW = createOutputWS(inputW);
//Get number of histograms
int histnumber = static_cast<int>(inputW->getNumberHistograms());
m_progress = new API::Progress(this, 0.0, 1.0, histnumber+1);
m_progress->report("Scaling X");
m_wi_min = 0;
m_wi_max = histnumber-1;
//check if workspace indexes have been set
int tempwi_min = getProperty("IndexMin");
int tempwi_max = getProperty("IndexMax");
if ( tempwi_max != Mantid::EMPTY_INT() )
{
if ((m_wi_min <= tempwi_min) && (tempwi_min <= tempwi_max) && (tempwi_max <= m_wi_max))
{
m_wi_min = tempwi_min;
m_wi_max = tempwi_max;
}
else
{
g_log.error("Invalid Workspace Index min/max properties");
throw std::invalid_argument("Inconsistent properties defined");
}
}
// Setup appropriate binary function
const bool multiply = (op=="Multiply");
if(multiply) m_binOp = std::multiplies<double>();
else m_binOp = std::plus<double>();
//Check if its an event workspace
EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputW);
if (eventWS != NULL)
{
this->execEvent();
return;
}
// do the shift in X
PARALLEL_FOR2(inputW, outputW)
for (int i = 0; i < histnumber; ++i)
{
PARALLEL_START_INTERUPT_REGION
//Copy y and e data
auto & outY = outputW->dataY(i);
outY = inputW->dataY(i);
auto & outE = outputW->dataE(i);
outE = inputW->dataE(i);
auto & outX = outputW->dataX(i);
const auto & inX = inputW->readX(i);
//Change bin value by offset
if ((i >= m_wi_min) && (i <= m_wi_max))
{
double factor = getScaleFactor(inputW, i);
// Do the offsetting
std::transform(inX.begin(), inX.end(), outX.begin(), std::bind2nd(m_binOp, factor));
// reverse the vector if multiplicative factor was negative
if(multiply && factor < 0.0)
{
std::reverse( outX.begin(), outX.end() );
std::reverse( outY.begin(), outY.end() );
std::reverse( outE.begin(), outE.end() );
}
}
else
{
outX = inX; //copy
}
m_progress->report("Scaling X");
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
// Copy units
if (outputW->getAxis(0)->unit().get())
outputW->getAxis(0)->unit() = inputW->getAxis(0)->unit();
try
{
if (inputW->getAxis(1)->unit().get())
outputW->getAxis(1)->unit() = inputW->getAxis(1)->unit();
}
catch(Exception::IndexError &)
{
// OK, so this isn't a Workspace2D
}
// Assign it to the output workspace property
setProperty("OutputWorkspace",outputW);
}
开发者ID:AlistairMills,项目名称:mantid,代码行数:101,代码来源:ScaleX.cpp
示例14: DataAbstractModule
RendererImage::RendererImage() : DataAbstractModule(1,0,0) {
//FIXME add DataPorts here instead of Model.cpp
setProperty("FIXME", 112); // FIXME setting properties should be done via makros
}
开发者ID:qknight,项目名称:springrts.com-random-map-generator,代码行数:4,代码来源:RendererImage.cpp
示例15: Config
Config(int port) {
setProperty("listen.port", port);
}
开发者ID:bjtj,项目名称:upnp-tools,代码行数:3,代码来源:UPnPServer.hpp
示例16: QMenu
QMenu* SeparateTabWidget::GetTabMenu (int index)
{
QMenu *menu = new QMenu ();
const auto widget = Widget (index);
const auto imtw = qobject_cast<ITabWidget*> (widget);
if (XmlSettingsManager::Instance ()->
property ("ShowPluginMenuInTabs").toBool ())
{
bool asSub = XmlSettingsManager::Instance ()->
property ("ShowPluginMenuInTabsAsSubmenu").toBool ();
if (imtw)
{
const auto& tabActions = imtw->GetTabBarContextMenuActions ();
QMenu *subMenu = asSub ?
new QMenu (TabText (index), menu) :
nullptr;
for (auto act : tabActions)
(asSub ? subMenu : menu)->addAction (act);
if (asSub)
menu->addMenu (subMenu);
if (tabActions.size ())
menu->addSeparator ();
}
}
auto rootWM = Core::Instance ().GetRootWindowsManager ();
const int windowIndex = rootWM->GetWindowIndex (Window_);
auto moveMenu = menu->addMenu (tr ("Move tab to"));
auto toNew = moveMenu->addAction (tr ("New window"),
rootWM, SLOT (moveTabToNewWindow ()));
toNew->setProperty ("TabIndex", index);
toNew->setProperty ("FromWindowIndex", windowIndex);
if (rootWM->GetWindowsCount () > 1)
{
moveMenu->addSeparator ();
for (int i = 0; i < rootWM->GetWindowsCount (); ++i)
{
auto thatWin = rootWM->GetMainWindow (i);
if (thatWin == Window_)
continue;
const auto& actTitle = tr ("To window %1 (%2)")
.arg (i + 1)
.arg (thatWin->windowTitle ());
auto toExisting = moveMenu->addAction (actTitle,
rootWM, SLOT (moveTabToExistingWindow ()));
toExisting->setProperty ("TabIndex", index);
toExisting->setProperty ("FromWindowIndex", windowIndex);
toExisting->setProperty ("ToWindowIndex", i);
}
}
const auto irt = qobject_cast<IRecoverableTab*> (widget);
if (imtw &&
irt &&
(imtw->GetTabClassInfo ().Features_ & TabFeature::TFOpenableByRequest) &&
!(imtw->GetTabClassInfo ().Features_ & TabFeature::TFSingle))
{
const auto cloneAct = menu->addAction (tr ("Clone tab"),
this, SLOT (handleCloneTab ()));
cloneAct->setProperty ("TabIndex", index);
cloneAct->setProperty ("ActionIcon", "tab-duplicate");
}
for (auto act : TabBarActions_)
{
if (!act)
{
qWarning () << Q_FUNC_INFO
<< "detected null pointer";
continue;
}
menu->addAction (act);
}
Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
emit hookTabContextMenuFill (proxy, menu, index,
Core::Instance ().GetRootWindowsManager ()->GetWindowIndex (Window_));
return menu;
}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:88,代码来源:separatetabwidget.cpp
示例17: DefaultColumnAlignment
void PlaylistView::ReloadSettings() {
QSettings s;
s.beginGroup(Playlist::kSettingsGroup);
glow_enabled_ = s.value("glow_effect", true).toBool();
if (setting_initial_header_layout_ || upgrading_from_qheaderview_) {
header_->SetStretchEnabled(s.value("stretch", true).toBool());
upgrading_from_qheaderview_ = false;
}
if (currently_glowing_ && glow_enabled_ && isVisible()) StartGlowing();
if (!glow_enabled_) StopGlowing();
if (setting_initial_header_layout_) {
header_->SetColumnWidth(Playlist::Column_Length, 0.06);
header_->SetColumnWidth(Playlist::Column_Track, 0.05);
setting_initial_header_layout_ = false;
}
if (upgrading_from_version_ != -1) {
if (upgrading_from_version_ < 4) {
header_->SetColumnWidth(Playlist::Column_Source, 0.05);
}
upgrading_from_version_ = -1;
}
column_alignment_ = s.value("column_alignments").value<ColumnAlignmentMap>();
if (column_alignment_.isEmpty()) {
column_alignment_ = DefaultColumnAlignment();
}
emit ColumnAlignmentChanged(column_alignment_);
// Background:
QVariant q_playlistview_background_type =
s.value(kSettingBackgroundImageType);
BackgroundImageType background_type(Default);
// bg_enabled should also be checked for backward compatibility (in releases
// <= 1.0, there was just a boolean to activate/deactivate the background)
QVariant bg_enabled = s.value("bg_enabled");
if (q_playlistview_background_type.isValid()) {
background_type = static_cast<BackgroundImageType>(
q_playlistview_background_type.toInt());
} else if (bg_enabled.isValid()) {
if (bg_enabled.toBool()) {
background_type = Default;
} else {
background_type = None;
}
}
QString background_image_filename =
s.value(kSettingBackgroundImageFilename).toString();
int blur_radius = s.value("blur_radius", kDefaultBlurRadius).toInt();
int opacity_level = s.value("opacity_level", kDefaultOpacityLevel).toInt();
// Check if background properties have changed.
// We change properties only if they have actually changed, to avoid to call
// set_background_image when it is not needed, as this will cause the fading
// animation to start again. This also avoid to do useless
// "force_background_redraw".
if (background_image_filename != background_image_filename_ ||
background_type != background_image_type_ ||
blur_radius_ != blur_radius || opacity_level_ != opacity_level) {
// Store background properties
background_image_type_ = background_type;
background_image_filename_ = background_image_filename;
blur_radius_ = blur_radius;
opacity_level_ = opacity_level;
if (background_image_type_ == Custom) {
set_background_image(QImage(background_image_filename));
} else if (background_image_type_ == AlbumCover) {
set_background_image(current_song_cover_art_);
} else {
// User changed background image type to something that will not be
// painted through paintEvent: reset all background images.
// This avoid to use old (deprecated) images for fading when selecting
// AlbumCover or Custom background image type later.
set_background_image(QImage());
cached_scaled_background_image_ = QPixmap();
previous_background_image_ = QPixmap();
}
setProperty("default_background_enabled",
background_image_type_ == Default);
emit BackgroundPropertyChanged();
force_background_redraw_ = true;
}
}
开发者ID:Narfinger,项目名称:Clementine,代码行数:86,代码来源:playlistview.cpp
示例18: deadValue
/**
* Apply the detector test criterion
* @param counts1 :: A workspace containing the integrated counts of the first
* white beam run
* @param counts2 :: A workspace containing the integrated counts of the first
* white beam run
* @param average :: The computed median
* @param variation :: The allowed variation in terms of number of medians, i.e
* those spectra where
* the ratio of the counts outside this range will fail the tests and will be
* masked on counts1
* @return number of detectors for which tests failed
*/
int DetectorEfficiencyVariation::doDetectorTests(
API::MatrixWorkspace_const_sptr counts1,
API::MatrixWorkspace_const_sptr counts2, const double average,
double variation) {
// DIAG in libISIS did this. A variation of less than 1 doesn't make sense in
// this algorithm
if (variation < 1) {
variation = 1.0 / variation;
}
// criterion for if the the first spectrum is larger than expected
double largest = average * variation;
// criterion for if the the first spectrum is lower than expected
double lowest = average / variation;
const int numSpec = static_cast<int>(counts1->getNumberHistograms());
const int progStep = static_cast<int>(std::ceil(numSpec / 30.0));
// Create a workspace for the output
MaskWorkspace_sptr maskWS = this->generateEmptyMask(counts1);
bool checkForMask = false;
Geometry::Instrument_const_sptr instrument = counts1->getInstrument();
if (instrument != nullptr) {
checkForMask = ((instrument->getSource() != nullptr) &&
(instrument->getSample() != nullptr));
}
const double deadValue(1.0);
int numFailed(0);
PARALLEL_FOR3(counts1, counts2, maskWS)
for (int i = 0; i < numSpec; ++i) {
PARALLEL_START_INTERUPT_REGION
// move progress bar
if (i % progStep == 0) {
advanceProgress(progStep * static_cast<double>(RTMarkDetects) / numSpec);
progress(m_fracDone);
interruption_point();
}
if (checkForMask) {
const std::set<detid_t> &detids =
counts1->getSpectrum(i).getDetectorIDs();
if (instrument->isMonitor(detids))
continue;
if (instrument->isDetectorMasked(detids)) {
// Ensure it is masked on the output
maskWS->mutableY(i)[0] = deadValue;
continue;
}
}
const double signal1 = counts1->y(i)[0];
const double signal2 = counts2->y(i)[0];
// Mask out NaN and infinite
if (boost::math::isinf(signal1) || boost::math::isnan(signal1) ||
boost::math::isinf(signal2) || boost::math::isnan(signal2)) {
maskWS->mutableY(i)[0] = deadValue;
PARALLEL_ATOMIC
++numFailed;
continue;
}
// Check the ratio is within the given range
const double ratio = signal1 / signal2;
if (ratio < lowest || ratio > largest) {
maskWS->mutableY(i)[0] = deadValue;
|
请发表评论