void PathChooser::setEnvironment(const Utils::Environment &env) { QString oldExpand = path(); d->m_environment = env; if (path() != oldExpand) emit changed(rawPath()); }
bool GiGraphics::drawPath(const GiContext* ctx, int count, const Point2d* points, const UInt8* types, bool modelUnit) { if (m_impl->drawRefcnt == 0 || count < 2 || points == NULL || types == NULL) return false; GiLock lock (&m_impl->drawRefcnt); if (count > 0x2000) count = 0x2000; Matrix2d matD(S2D(xf(), modelUnit)); const Box2d extent (count, points); // 模型坐标范围 if (!DRAW_RECT(m_impl, modelUnit).isIntersect(extent)) // 全部在显示区域外 return false; vector<Point2d> pxpoints; pxpoints.resize(count); Point2d *pxs = &pxpoints.front(); for (int i = 0; i < count; i++) pxs[i] = points[i] * matD; return rawPath(ctx, count, pxs, types); }
void System::onRawArrival( HANDLE handle ) { UINT pathLength = 0; if ( GetRawInputDeviceInfoW( handle, RIDI_DEVICENAME, NULL, &pathLength ) ) NIL_EXCEPT_WINAPI( "GetRawInputDeviceInfoW failed" ); wideString rawPath( pathLength, '\0' ); GetRawInputDeviceInfoW( handle, RIDI_DEVICENAME, &rawPath[0], &pathLength ); rawPath.resize( rawPath.length() - 1 ); for ( auto device : mDevices ) { if ( device->getHandler() != Device::Handler_RawInput ) continue; auto rawDevice = static_cast<RawInputDevice*>( device ); if ( !_wcsicmp( rawDevice->getRawPath().c_str(), rawPath.c_str() ) ) { deviceConnect( rawDevice ); return; } } auto device = new RawInputDevice( this, getNextID(), handle, rawPath ); if ( isInitializing() ) device->setStatus( Device::Status_Connected ); else deviceConnect( device ); mDevices.push_back( device ); }
void PathChooser::setEnvironment(const Environment &env) { QString oldExpand = path(); d->m_environment = env; if (path() != oldExpand) { triggerChanged(); emit rawPathChanged(rawPath()); } }
Tial::Utility::NativePath Tial::Utility:: _currentPath() { #if (BOOST_OS_UNIX || BOOST_OS_MACOS) std::unique_ptr<char, std::function<void(char*)>> rawPath( getcwd(nullptr, MAXPATHLEN), [](char *ptr) { free(ptr); } ); if(!rawPath) throw std::system_error(errno, std::system_category()); return std::string(rawPath.get()); #else #error "Platform not supported" #endif }
QString PathChooser::path() const { return d->expandedPath(rawPath()); }