CLayoutWizard::CLayoutWizard(QWidget *parent) : QDialog(parent,Qt::Sheet), ui(new Ui::CLayoutWizard) { ui->setupUi(this); setWindowModality(Qt::WindowModal); setVisible(false); TitleElement.SetFont(QFont("Times New Roman",24)); SubtitleElement.SetFont(QFont("Times New Roman",18)); ComposerElement.SetFont(QFont("Times New Roman",12)); NamesElement.SetFont(QFont("Times New Roman",8)); connect(ui->topMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins())); connect(ui->leftMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins())); connect(ui->rightMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins())); connect(ui->bottomMargin,SIGNAL(Changed()),this,SLOT(UpdateMargins())); connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(UpdateMargins())); connect(ui->NoteSpace,SIGNAL(valueChanged(int)),this,SLOT(SpacingTooltip(int))); ui->graphicsView->setScene(&S); Printer=new QPrinter(); pageSetupButton=new QToolButton(ui->graphicsView); pageSetupButton->setProperty("transparent",true); pageSetupButton->setIcon(QIcon(":/preferences.png")); pageSetupButton->setIconSize(QSize(32,32)); pageSetupButton->setFixedSize(QSize(36,36)); connect(pageSetupButton,SIGNAL(clicked()),this,SLOT(ShowPageSetup())); UpdateMargins(); }
void MouseMove(IInputProvider* pprovider, const Point& point, bool bCaptured, bool bInside) { if (bCaptured) { ZAssert(m_bDragging && m_bCanDrag); float fScale = (m_xMax - m_xMin)/m_rectMap.XSize(); float fDeltaX = fScale * (m_pointLastDrag.X() - point.X()); float fDeltaY = fScale * (m_pointLastDrag.Y() - point.Y()); // make sure we don't drag the map off of the screen m_xDrag = max(min((m_xClusterMax - m_xClusterMin) - (m_xMax - m_xMin), m_xDrag + fDeltaX), 0); m_yDrag = max(min((m_yClusterMax - m_yClusterMin) - (m_yMax - m_yMin), m_yDrag + fDeltaY), 0); m_pointLastDrag = point; GetWindow()->SetCursor(AWF_CURSOR_DRAG); Changed(); } else { if (m_bCanDrag) { GetWindow()->SetCursor(AWF_CURSOR_DRAG); } else { GetWindow()->SetCursor(AWF_CURSOR_DEFAULT); } } Changed(); }
void ResourceWizard::on_StartStringBuilder_clicked() { disconnect(StringBuilder,SIGNAL(Changed(QString)),this,SLOT(SetRandomStringEdit(QString))); connect(StringBuilder,SIGNAL(Changed(QString)),this,SLOT(SetRandomStringEdit(QString))); StringBuilder->Show(ui->RandomStringValue->text()); disconnect(StringBuilder,SIGNAL(Changed(QString)),this,SLOT(SetRandomStringEdit(QString))); }
MainWindow::MainWindow(Scene *scene, QWidget *parent) : QMainWindow(parent), ui_(new Ui::MainWindow), scene_(scene) { ui_->setupUi(this); gl_widget_ = new GLWidget(scene_); ui_->opengl_box->layout()->addWidget(gl_widget_); // connect(gl_widget_,SIGNAL(Changed()),this,SLOT(SceneChanged())); outer_view_widget_ = new OuterViewWidget(scene_); ui_->outerview_box->layout()->addWidget(outer_view_widget_); connect(outer_view_widget_,SIGNAL(Changed()),this,SLOT(SceneChanged())); ray_tracing_widget_ = new RayTracingWidget(scene_); ui_->raytracing_box->layout()->addWidget(ray_tracing_widget_); connect(ray_tracing_widget_,SIGNAL(Changed()),this,SLOT(SceneChanged())); connect(ui_->recursion_spinBox,SIGNAL(valueChanged(int)),ray_tracing_widget_,SLOT(RayTracingLevel(int))); const int default_fov_slider = ((100*(kDefaultFov-kMinFov))/(kMaxFov-kMinFov)); ui_->fov_slider->setValue(default_fov_slider); const int default_near_slider = ((100*(kDefaultNear-kMinNear))/(kMaxNear-kMinNear)); ui_->near_slider->setValue(default_near_slider); const int default_far_slider = ((100*(kDefaultFar-kMinFar))/(kMaxFar-kMinFar)); ui_->far_slider->setValue(default_far_slider); connect(ui_->fov_slider,SIGNAL(valueChanged(int)),this,SLOT(SetFov(int))); connect(ui_->near_slider,SIGNAL(valueChanged(int)),this,SLOT(SetNear(int))); connect(ui_->far_slider,SIGNAL(valueChanged(int)),this,SLOT(SetFar(int))); connect(ui_->light_check,SIGNAL(toggled(bool)),this,SLOT(SetLight(bool))); connect(ui_->track_ray_check,SIGNAL(toggled(bool)),this,SLOT(SetTrackRay(bool))); SetTrackRay(ui_->track_ray_check->isChecked()); connect(ui_->fast_render_check,SIGNAL(toggled(bool)),ray_tracing_widget_,SLOT(ToggleFastRenderOnly(bool))); ray_tracing_widget_->ToggleFastRenderOnly(ui_->fast_render_check->isChecked()); // connect(ui_->image_size_comboBox,SIGNAL(currentIndexChanged(int)),ray_tracing_widget_,SLOT(SelectImageSize(int))); // ray_tracing_widget_->SelectImageSize(ui_->image_size_comboBox->currentIndex()); connect(ui_->scene_comboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(LoadScene(int))); // connect(ui_->load1_pushButton,SIGNAL(clicked()),this,SLOT(LoadScene1())); // connect(ui_->load2_pushButton_2,SIGNAL(clicked()),this,SLOT(LoadScene2())); // connect(gl_widget_,SIGNAL(Moving(bool)),ray_tracing_widget_,SLOT(SetMoving(bool))); connect(gl_widget_,SIGNAL(MouseMoved(QMouseEvent*)),ray_tracing_widget_,SLOT(MouseMoved(QMouseEvent*))); connect(gl_widget_,SIGNAL(MousePressed(QMouseEvent*)),ray_tracing_widget_,SLOT(MousePressed(QMouseEvent*))); connect(gl_widget_,SIGNAL(MouseReleased(QMouseEvent*)),ray_tracing_widget_,SLOT(MouseReleased(QMouseEvent*))); connect(gl_widget_,SIGNAL(Wheel(QWheelEvent*)),ray_tracing_widget_,SLOT(Wheel(QWheelEvent*))); connect(ui_->render_button,SIGNAL(clicked()),this,SLOT(FinalRender())); SceneChanged(); }
void TConfiguration::Default() { TGuard Guard(FCriticalSection); FDisablePasswordStoring = false; FForceBanners = false; FDisableAcceptingHostKeys = false; std::unique_ptr<TRegistryStorage> AdminStorage(new TRegistryStorage(GetRegistryStorageKey(), HKEY_LOCAL_MACHINE)); try__finally { if (AdminStorage->OpenRootKey(false)) { LoadAdmin(AdminStorage.get()); AdminStorage->CloseSubKey(); } } __finally { // delete AdminStorage; }; SetRandomSeedFile(FDefaultRandomSeedFile); SetPuttyRegistryStorageKey(OriginalPuttyRegistryStorageKey); FConfirmOverwriting = true; FConfirmResume = true; FAutoReadDirectoryAfterOp = true; FSessionReopenAuto = 5000; FSessionReopenBackground = 2000; FSessionReopenTimeout = 0; FSessionReopenAutoStall = 60000; FTunnelLocalPortNumberLow = 50000; FTunnelLocalPortNumberHigh = 50099; FCacheDirectoryChangesMaxSize = 100; FShowFtpWelcomeMessage = false; FExternalIpAddress.Clear(); FTryFtpWhenSshFails = true; SetCollectUsage(FDefaultCollectUsage); FSessionReopenAutoMaximumNumberOfRetries = CONST_DEFAULT_NUMBER_OF_RETRIES; FDefaultCollectUsage = false; FLogging = false; FPermanentLogging = false; FLogFileName = GetDefaultLogFileName(); FPermanentLogFileName = FLogFileName; FLogFileAppend = true; FLogSensitive = false; FPermanentLogSensitive = FLogSensitive; FLogWindowLines = 100; FLogProtocol = 0; FPermanentLogProtocol = FLogProtocol; UpdateActualLogProtocol(); FLogActions = false; FPermanentLogActions = false; FActionsLogFileName = "%TEMP%" WGOOD_SLASH "&S.xml"; FPermanentActionsLogFileName = FActionsLogFileName; FProgramIniPathWrittable = -1; Changed(); }
void TransferFunction::onColorTFChanged() { //std::cout<<"Color changed"<<std::endl; if(compositeTex) { CudaSafeCall(cudaDestroyTextureObject(compositeTex)); compositeTex = 0; } colorTF->GetTable(0.0, 1.0, TABLE_SIZE, colorTable); size_t j = 0, k = 0; for(size_t i = 0; i < TABLE_SIZE; ++i) { compositeTable[j++] = colorTable[k++]; compositeTable[j++] = colorTable[k++]; compositeTable[j++] = colorTable[k++]; j++; } //CompositeTable(); CudaSafeCall(cudaMemcpyToArray(array, 0, 0, compositeTable, sizeof(float) * TABLE_SIZE * 4, cudaMemcpyHostToDevice)); CudaSafeCall(cudaCreateTextureObject(&compositeTex, &resourceDesc, &texDesc, NULL)); Changed(); }
QTransferFunction& QTransferFunction::operator = (const QTransferFunction& Other) { QPresetXML::operator=(Other); blockSignals(true); m_Nodes = Other.m_Nodes; m_pSelectedNode = Other.m_pSelectedNode; // Notify us when the nodes change for (int i = 0; i < m_Nodes.size(); i++) connect(&m_Nodes[i], SIGNAL(NodeChanged(QNode*)), this, SLOT(OnNodeChanged(QNode*))); m_DensityScale = Other.m_DensityScale; m_ShadingType = Other.m_ShadingType; m_GradientFactor = Other.m_GradientFactor; // Update node's range UpdateNodeRanges(); blockSignals(false); // Notify others that the function has changed selection has changed emit Changed(); SetSelectedNode(NULL); return *this; }
void QTransferFunction::RemoveNode(QNode* pNode) { if (!pNode) return; // Remove the connection disconnect(pNode, SIGNAL(NodeChanged(QNode*)), this, SLOT(OnNodeChanged(QNode*))); // Node index of the to be removed node int NodeIndex = m_Nodes.indexOf(*pNode); // Remove from list and memory m_Nodes.remove(*pNode); // Update ID's for (int i = 0; i < m_Nodes.size(); i++) m_Nodes[i].m_ID = i; // Update node's range UpdateNodeRanges(); // Select the previous node NodeIndex = qMax(0, NodeIndex - 1); SetSelectedNode(NodeIndex); // Inform others that the transfer function has changed emit Changed(); Log("Removed node", "layer-select-point"); }
void nuiDecoration::SetObjectName(const nglString& rName) { DelDecoration(this); nuiObject::SetObjectName(rName); AddDecoration(this); Changed(); }
bool nuiTreeBase::SetChild(uint32 Index, nuiTreePtr pChild) { pChild->Acquire(); if (mpChildren.size() < Index+1) mpChildren.resize(Index+1); if (mpChildren[Index]) mpChildren[Index]->Release(); else if (mpChildren[Index]) { mTreeNodeEventSink.DisconnectSource(mpChildren[Index]->Changed); mpChildren[Index]->SetParent(NULL); } mpChildren[Index] = pChild; mTreeNodeEventSink.Connect(pChild->Changed, &nuiTreeBase::OnChildChanged, pChild); mTreeNodeEventSink.Connect(pChild->ChildAdded, &nuiTreeBase::OnChildAdded, pChild); mTreeNodeEventSink.Connect(pChild->ChildDeleted, &nuiTreeBase::OnChildRemoved, pChild); mTreeNodeEventSink.Connect(pChild->Deleted, &nuiTreeBase::OnChildDeleted, pChild); pChild->SetParent(this); AutoSort(); Changed(); ChildAdded(this, pChild); return true; }
bool nuiTreeBase::InsertChild(uint32 Index, nuiTreePtr pChild) { if (mpAutoSort) return AddChild(pChild); if (mpChildren.size() < Index+1) mpChildren.resize(Index+1); std::vector<nuiTreePtr>::iterator it = mpChildren.begin(); it+=Index; if (it == mpChildren.end()) { mpChildren.resize(mpChildren.size() - 1); return false; } mpChildren.insert(it, pChild); pChild->Acquire(); mTreeNodeEventSink.Connect(pChild->Changed, &nuiTreeBase::OnChildChanged, pChild); mTreeNodeEventSink.Connect(pChild->ChildAdded, &nuiTreeBase::OnChildAdded, pChild); mTreeNodeEventSink.Connect(pChild->ChildDeleted, &nuiTreeBase::OnChildRemoved, pChild); mTreeNodeEventSink.Connect(pChild->Deleted, &nuiTreeBase::OnChildDeleted, pChild); pChild->SetParent(this); AutoSort(); Changed(); ChildAdded(this, pChild); return true; }
bool nuiTreeBase::AddChild(nuiTreePtr pChild) { pChild->Acquire(); if (!mpAutoSort) { mpChildren.push_back(pChild); } else { // Sorted insert: std::vector<nuiTreePtr>::iterator it = std::upper_bound(mpChildren.begin(), mpChildren.end(), pChild, PrivateSortFunction(mpAutoSort)); mpChildren.insert(it, pChild); } mTreeNodeEventSink.Connect(pChild->Changed, &nuiTreeBase::OnChildChanged, pChild); mTreeNodeEventSink.Connect(pChild->ChildAdded, &nuiTreeBase::OnChildAdded, pChild); mTreeNodeEventSink.Connect(pChild->ChildDeleted, &nuiTreeBase::OnChildRemoved, pChild); mTreeNodeEventSink.Connect(pChild->Deleted, &nuiTreeBase::OnChildDeleted, pChild); pChild->SetParent(this); Changed(); ChildAdded(this, pChild); return false; }
bool nuiTreeBase::Clear(bool erase) { for (uint32 i = 0; i < mpChildren.size(); i++) { nuiTreeBase* pChild = mpChildren[i]; ChildDeleted(this, pChild); } if (erase) { std::vector<nuiTreePtr>::iterator it = mpChildren.begin(); for (; it != mpChildren.end();) { nuiTreeBase* pChild = (*it); it = mpChildren.erase(it); pChild->Release(); } } else { for (uint32 i = 0; i < mpChildren.size(); i++) { mpChildren[i]->SetParent(NULL); mTreeNodeEventSink.DisconnectSource(mpChildren[i]->Changed); mTreeNodeEventSink.DisconnectSource(mpChildren[i]->ChildAdded); mTreeNodeEventSink.DisconnectSource(mpChildren[i]->ChildDeleted); mTreeNodeEventSink.DisconnectSource(mpChildren[i]->Deleted); } } mpChildren.clear(); Changed(); return true; }
void nuiBorderDecoration::SetStrokeBottomColor(const nuiColor& color) { mStrokeBottomColor = color; mUseStrokeBottomColor = true; mUseStrokeGlobalColor = false; Changed(); }
void EntityRef::onEntitySeen(Entity* e) { assert(e); m_inner = e; m_inner->BeingDeleted.connect(sigc::mem_fun(this, &EntityRef::onEntityDeleted)); Changed(); }
/////////////////////////////////////////////////////////// /// Tone change /////////////////////////////////////////////////////////// void Bitmap::ToneChange(Tone tone) { if (tone.red == 0 && tone.green == 0 && tone.blue == 0 && tone.gray == 0) return; Uint8* dst_pixels = (Uint8*)&pixels[0]; if (tone.gray == 0) { for (int i = 0; i < GetHeight(); i++) { for (int j = 0; j < GetWidth(); j++) { Uint8* pixel = dst_pixels; pixel[0] = (Uint8)max(min(pixel[0] + tone.red, 255), 0); pixel[1] = (Uint8)max(min(pixel[1] + tone.green, 255), 0); pixel[2] = (Uint8)max(min(pixel[2] + tone.blue, 255), 0); dst_pixels += 4; } } } else { double factor = (255 - tone.gray) / 255.0; double gray; for (int i = 0; i < GetHeight(); i++) { for (int j = 0; j < GetWidth(); j++) { Uint8* pixel = dst_pixels; gray = pixel[0] * 0.299 + pixel[1] * 0.587 + pixel[2] * 0.114; pixel[0] = (Uint8)max(min((pixel[0] - gray) * factor + gray + tone.red + 0.5, 255), 0); pixel[1] = (Uint8)max(min((pixel[1] - gray) * factor + gray + tone.green + 0.5, 255), 0); pixel[2] = (Uint8)max(min((pixel[2] - gray) * factor + gray + tone.blue + 0.5, 255), 0); dst_pixels += 4; } } } Changed(); }
void SearchTermWidget::OpChanged(int index) { // Determine the currently selected operator SearchTerm::Operator op = static_cast<SearchTerm::Operator>( // This uses the operators’s index in the combobox to get its enum value ui_->op->itemData(ui_->op->currentIndex()).toInt() ); // We need to change the page only in the following case if ((ui_->value_stack->currentWidget() == ui_->page_text) || (ui_->value_stack->currentWidget() == ui_->page_empty)) { QWidget* page = nullptr; if (op == SearchTerm::Op_Empty || op == SearchTerm::Op_NotEmpty) { page = ui_->page_empty; } else { page = ui_->page_text; } ui_->value_stack->setCurrentWidget(page); } else if ((ui_->value_stack->currentWidget() == ui_->page_date) || (ui_->value_stack->currentWidget() == ui_->page_date_numeric) || (ui_->value_stack->currentWidget() == ui_->page_date_relative)) { QWidget* page = nullptr; if (op == SearchTerm::Op_NumericDate || op == SearchTerm::Op_NumericDateNot) { page = ui_->page_date_numeric; } else if (op == SearchTerm::Op_RelativeDate) { page = ui_->page_date_relative; } else { page = ui_->page_date; } ui_->value_stack->setCurrentWidget(page); } emit Changed(); }
virtual void MouseLeave(IInputProvider* pprovider) { if (!m_bDragging) GetWindow()->SetCursor(AWF_CURSOR_DEFAULT); Changed(); }
CWaveLayers::CWaveLayers(QWidget *parent) : QFrame(parent), ui(new Ui::CWaveLayers) { ui->setupUi(this); connect(ui->VolSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->TransposeSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->TuneSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->LowVelFullSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->HighVelFullSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->LowVelXSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->HighVelXSpin,SIGNAL(valueChanged(int)),this,SLOT(UpdateGraph())); connect(ui->ADSRWidget,SIGNAL(Changed(CADSR::ADSRParams)),this,SLOT(UpdateADSRs(CADSR::ADSRParams))); connect(ui->LayersControl,SIGNAL(CurrentLayerChanged(CLayer::LayerParams)),this,SLOT(UpdateControls(CLayer::LayerParams))); connect(ui->LayersControl,SIGNAL(LayerIndexChanged(int)),this,SLOT(SelectLayer(int))); connect(ui->LayersControl,SIGNAL(Add(int,int)),this,SLOT(AddLayer(int,int))); //connect(ui->KeyLayoutControl,SIGNAL(ReleaseLoop()),this,SLOT(ReleaseLoop())); connect(ui->FixLayerButton,SIGNAL(clicked()),this,SLOT(FixLayer())); connect(ui->FixAllButton,SIGNAL(clicked()),this,SLOT(FixAll())); connect(ui->PitchLayerButton,SIGNAL(clicked()),this,SLOT(PitchLayer())); connect(ui->PitchAllButton,SIGNAL(clicked()),this,SLOT(PitchAll())); connect(ui->DeleteLayerButton,SIGNAL(clicked()),this,SLOT(DeleteLayer())); MD=false; Working=false; //Update(); }
Device::Device(const QString &p, QObject *parent) : QObject(parent) , m_path(p) , m_type(Device::Undefined) { #ifndef NO_DBUS m_deviceInterface = new UDisksDeviceInterface("org.freedesktop.UDisks", m_path, QDBusConnection::systemBus(), this); if (!m_deviceInterface->isValid()) { m_valid = false; return; } m_valid = true; m_isPartition = m_deviceInterface->DeviceIsPartition(); m_mountPoint = m_deviceInterface->DeviceMountPath(); m_label = m_deviceInterface->IdLabel(); m_uuid = m_deviceInterface->IdUuid(); m_type = Device::UsbDrive; connect(m_deviceInterface, SIGNAL(Changed()), this, SLOT(deviceChanged())); #else // no implementation yet, so not valid m_valid = false; m_isPartition = false; #endif emit changed(); }
void QTransferFunction::AddNode(const QNode& Node) { // Add the node to the list m_Nodes.append(Node); // Cache node QNode& CacheNode = m_Nodes.back(); // Sort the transfer function nodes based on intensity qSort(m_Nodes.begin(), m_Nodes.end(), CompareNodes); // Update ID's for (int i = 0; i < m_Nodes.size(); i++) m_Nodes[i].m_ID = i; // Update ranges UpdateNodeRanges(); // Notify us when the node changes connect(&CacheNode, SIGNAL(NodeChanged(QNode*)), this, SLOT(OnNodeChanged(QNode*))); for (int i = 0; i < m_Nodes.size(); i++) { if (Node.GetIntensity() == m_Nodes[i].GetIntensity()) SetSelectedNode(&m_Nodes[i]); } // Inform others that the transfer function has changed emit Changed(); if (!signalsBlocked()) Log("Inserted node", "layer-select-point"); }
bool Category::Rename(const Category &from, const Category &to) { if (from._names.size() != to._names.size()) { return false; } unsigned num = from._names.size () < _names.size() ? from._names.size() : _names.size(); bool changed = false; for (int i=0; i<num; i++) { if (_names[i] != from._names[i]) { break; } if (_names[i] != to._names[i]) { _names[i] = to._names[i]; changed = true; } } if (changed) { emit Changed(); } return changed; }
void QTransferFunction::ReadXML(QDomElement& Parent) { QPresetXML::ReadXML(Parent); QDomElement Nodes = Parent.firstChild().toElement(); blockSignals(true); // Read child nodes for (QDomNode DomNode = Nodes.firstChild(); !DomNode.isNull(); DomNode = DomNode.nextSibling()) { // Create new node QNode Node(this); // Load preset into it Node.ReadXML(DomNode.toElement()); // Add the node to the list AddNode(Node); } UpdateNodeRanges(); m_DensityScale = Parent.firstChildElement("DensityScale").attribute("Value").toFloat(); m_ShadingType = Parent.firstChildElement("ShadingType").attribute("Value").toInt(); m_GradientFactor = Parent.firstChildElement("GradientFactor").attribute("Value").toFloat(); blockSignals(false); // Inform others that the transfer function has changed emit Changed(); }
void SetString(int row, int column, const ZString& str) { if (m_vvstr.Get(row).Get(column) != str) { m_vvstr.Get(row).Set(column, str); Changed(); } }
bool UPower::connectInterfaces() { if(m_interface==0 || !m_interface->isValid()) { m_interface = new QDBusInterface("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", QDBusConnection::systemBus()); if(!m_interface->isValid()) { m_interface->deleteLater(); m_interface = 0; if (m_interfaceProps) m_interfaceProps->deleteLater(); m_interfaceProps = 0; return false; } connect(m_interface, SIGNAL(DeviceAdded(QString)), this, SLOT(deviceAdded(QString))); connect(m_interface, SIGNAL(DeviceRemoved(QString)), this, SIGNAL(batteryDisconnected(QString))); connect(m_interface, SIGNAL(Changed()), this, SLOT(changed())); } if(m_interfaceProps==0 || !m_interfaceProps->isValid()) { m_interfaceProps = new QDBusInterface("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus()); if(!m_interfaceProps->isValid()) { if (m_interface) m_interface->deleteLater(); m_interface = 0; m_interfaceProps->deleteLater(); m_interfaceProps = 0; return false; } } emit upowerAvailable(); return true; }
void SetColor(int row, const Color& color) { if (m_vcolor.Get(row) != color) { m_vcolor.Set(row, color); Changed(); } }
void MoveEnd() { m_timeStart = GetTime()->GetValue(); m_bGotoStart = false; m_bStationary = false; Changed(); }
/////////////////////////////////////////////////////////// /// Copy /////////////////////////////////////////////////////////// void Bitmap::Copy(int x, int y, Bitmap* src_bitmap, Rect src_rect) { if (src_bitmap->GetWidth() == 0 || src_bitmap->GetHeight() == 0 || width == 0 || height == 0) return; if (x >= width || y >= height) return; if (x < 0) { src_rect.x -= x; x = 0; } if (y < 0) { src_rect.y -= y; y = 0; } src_rect.Adjust(src_bitmap->GetWidth(), src_bitmap->GetHeight()); if (src_rect.IsOutOfBounds(src_bitmap->GetWidth(), src_bitmap->GetHeight())) return; int src_width = src_rect.width; int src_height = src_rect.height; if (x + src_width > width) src_width = width - x; if (y + src_height > height) src_height = height - y; if (src_width <= 0 || src_height <= 0) return; int src_pitch = src_width * 4; int src_row = src_bitmap->GetWidth(); const Uint32* src_pixels = ((Uint32*)(&src_bitmap->pixels[0])) + src_rect.x + src_rect.y * src_bitmap->GetWidth(); Uint32* dst_pixels = ((Uint32*)(&pixels[0])) + x + y * width; for (int i = 0; i < src_height; ++i) { memcpy(dst_pixels, src_pixels, src_pitch); src_pixels += src_row; dst_pixels += width; } Changed(); }
void CFX_RGBLed::Commit() { if (Changed()) { CFX_Color newcolor; uint8_t brightness = GetBrightness(); if (brightness == 255) { newcolor = m_color; } else { float factor = (float)brightness/255; newcolor = m_color * factor; } if (m_commonAnode) { analogWrite(m_redpin, 255 - newcolor.Red()); analogWrite(m_greenpin, 255 - newcolor.Green()); analogWrite(m_bluepin, 255 - newcolor.Blue()); } else { analogWrite(m_redpin, newcolor.Red()); analogWrite(m_greenpin, newcolor.Green()); analogWrite(m_bluepin, newcolor.Blue()); } SetChanged(false); } }
/////////////////////////////////////////////////////////// /// Set pixel /////////////////////////////////////////////////////////// void Bitmap::SetPixel(int x, int y, Color color) { if (x < 0 || y < 0) return; if (x >= width || y > height) return; pixels[(y * width) + x] = color.GetUint32(); Changed(); }