Ejemplo n.º 1
0
/* Send power messages to rootDomain */
bool Insomnia::send_event(UInt32 msg) {
    IOPMrootDomain *root = NULL;
    IOReturn        ret=kIOReturnSuccess;
    
    DLog("");
    
    root = getPMRootDomain();
    if (!root) {
        DLog("Fatal error could not get RootDomain.");
        return false;
    }

    ret = root->receivePowerNotification(msg);
    
    Log("root returns %d", ret);
    
    if(ret!=kIOReturnSuccess)
    {
        DLog("Error sending event: %d", ret);
    }
    else
        Log("Message sent to root");
    
    return true;
}
/** This function is used by the new access router and removes the mri of a
  * flow from the NSLP_AHO_Context.
  * @param the mri of a flow.
  */
void NSLP_AHO_Context::remove_flow_from_context(const ntlp::mri_pathcoupled &mri) {
  DLog("NSLP_AHO_Context", "remove_flow_from_context(): ("
      << mri.get_sourceaddress() << ", "
      << mri.get_destaddress() << ")");

  mri_new_flow_set.erase(mri);

  DLog("NSLP_AHO_Context", "END remove_flow_from_context()");
}
/** This function is used by the new access router and adds the mri of a new
  * flow to the NSLP_AHO_Context, which is needed to match RESERVE / RESPONSE
  * messages, that need to be forwarded towards the mobile node.
  * @param the mri of a new flow.
  */
void NSLP_AHO_Context::add_flow_to_context(const ntlp::mri_pathcoupled mri) {
  DLog("NSLP_AHO_Context", "add_new_flow_to_context(): ("
      << mri.get_sourceaddress() << ", "
      << mri.get_destaddress() << ")");

  mri_new_flow_set.insert(mri);

  DLog("NSLP_AHO_Context", "END add_new_flow_to_context()");
}
Ejemplo n.º 4
0
	bool CScriptModule::Load_Config( const std::string& Filename ) {
		int error;
		string errmsg;
		
		// Check if this file has been loaded already
		std::list<std::string>::iterator iFind = std::find(m_LoadedConfigs.begin(), m_LoadedConfigs.end(), Filename);
		if( iFind != m_LoadedConfigs.end() ){
			// Found it
			return true;
		}
		
	
		// Prepend Filesystem root
		std::string Fullname = m_sFS_Root + Filename;
		
		error  = luaL_loadfile(m_pConfig, Fullname.c_str());
		if( error ) {
			DLog(LOG_SCRIPT, "Could not compile: %s\n", Filename.c_str());
			
			errmsg = lua_tostring(m_pConfig, -1);
			
			// Strip the FS Root so the error msg makes sense
			size_t pos = errmsg.find( m_sFS_Root );
			if( pos != std::string::npos ) {
				errmsg.erase( pos, m_sFS_Root.length() );
			}
			Log(LOG_SCRIPT, "%s\n", errmsg.c_str());
			
			lua_pop(m_pConfig, 1);
			return false;
		}
		
		// Execute chunk
		error = lua_pcall(m_pConfig, 0, 0, 0);
		if( error ) {
			DLog(LOG_SCRIPT, "Could not execute: %s\n", Filename.c_str());
			
			errmsg = lua_tostring(m_pConfig, -1);
			size_t pos = errmsg.find( m_sFS_Root );
			if( pos != std::string::npos ) {
				errmsg.erase( pos, m_sFS_Root.length());
			}
			Log(LOG_SCRIPT, "%s\n", errmsg.c_str());
			lua_pop(m_pConfig, 1);
			return false;
		}
	
		Log( LOG_SCRIPT, "Loaded config: %s\n", Filename.c_str() );
		
		// Add it to list of loaded scripts so we prevent reloads
		m_LoadedConfigs.push_back( Filename );
		
		return true;
	}
/** This function is used by the new access router and returns TRUE if the given
  * mri is saved in the NSLP_AHO_Context.
  * @return TRUE if the given mri is saved in the NSLP_AHO_Context.
  */
bool NSLP_AHO_Context::is_flow_in_context(const ntlp::mri_pathcoupled &mri) const {
  DLog("NSLP_AHO_Context", "is_new_flow_in_context(): ("
      << mri.get_sourceaddress() << ", "
      << mri.get_destaddress() << ")");

  mri_new_flow_set_const_it_t it = mri_new_flow_set.find(mri);
  bool is_flow_in_context = (it != mri_new_flow_set.end());

  DLog("NSLP_AHO_Context", "END is_new_flow_in_context()");

  return is_flow_in_context;
}
void MainWindow::_startDeleteTest()
{
    DLog("-- start DELETE test: ") << _testSrcDirLineEdit->text();

    if(!PathHelper::deleteThisDirectoryAndEverythingBelow(_testSrcDirLineEdit->text())) {
        WLog("delete FAILED!");
    }
    else {
        DLog(" - delete test SUCCESS");
    }

    DLog(" -> end of DELETE test");
}
void MainWindow::_startCopyTest()
{
    DLog("-- start COPY test: ") << _testSrcDirLineEdit->text() << "|" << _testDestDirLineEdit->text();

    if(!PathHelper::copyWholeDirectory(_testSrcDirLineEdit->text(), _testDestDirLineEdit->text(), false, PathHelper::SHM_UseAsFile)) {
        WLog("Copy FAILED!");
    }
    else {
        DLog(" -> copy test SUCCESS!");
    }

    DLog(" -> end of COPY test");
}
Ejemplo n.º 8
0
 void
 RTMPSession::handleInvoke(uint8_t* p)
 {
     int buflen=0;
     std::string command = get_string(p, buflen);
     int32_t pktId = int32_t(get_double(p+11));
     
     DLog("pktId: %d\n", pktId);
     std::string trackedCommand ;
     auto it = m_trackedCommands.find(pktId) ;
     
     if(it != m_trackedCommands.end()) {
         trackedCommand = it->second;
     }
     
     DLog("received invoke %s\n", command.c_str());
     
     if (command == "_result") {
         DLog("tracked command: %s\n", trackedCommand.c_str());
         if (trackedCommand == "connect") {
             
             sendReleaseStream();
             sendFCPublish();
             sendCreateStream();
             setClientState(kClientStateFCPublish);
             
         } else if (trackedCommand == "createStream") {
             if (p[10] || p[19] != 0x05 || p[20]) {
                 DLog("RTMP: Unexpected reply on connect()\n");
             } else {
                 m_streamId = get_double(p+21);
             }
             sendPublish();
             setClientState(kClientStateReady);
         }
     } else if (command == "onStatus") {
         std::string code = parseStatusCode(p + 3 + command.length());
         DLog("code : %s\n", code.c_str());
         if (code == "NetStream.Publish.Start") {
             
             sendHeaderPacket();
             
             sendSetChunkSize(getpagesize());
             // sendSetBufferTime(0);
             setClientState(kClientStateSessionStarted);
             
             m_throughputSession.start();
         }
     }
     
 }
Ejemplo n.º 9
0
bool Insomnia::init(OSDictionary* properties) {
    DLog("");
    
    if (super::init(properties) == false) {
        DLog("super::init failed");
        return false;
    }

    myinstance = this;

    sysctl_register();

    return true;
}
bool Background_ClientInstaller::tryToBackup()
{
    // remove the previous backup
    if(!PathHelper::deleteThisDirectoryAndEverythingBelow(AppSpecificPathHelper::getTmp_ClientSelfUpdate_OldVersionBackupFolder())) {
        WLog("Failed to clear the backup folder.");
        return false;
    }
    else {
        DLog("Backup folder cleared.");
    }

#ifdef Q_OS_WIN
    // do the new backup
    if(!PathHelper::copyWholeDirectory(this->_clientRootPath, AppSpecificPathHelper::getTmp_ClientSelfUpdate_OldVersionBackupFolder(), true, PathHelper::SHM_UseAsFile)) {
        WLog("Failed to do the backup.");
        return false;
    }
    else {
        DLog("Backup finished.");
    }
#endif

#ifdef Q_OS_MAC
   // Get apps with *.appwhirr.bitfall bundle identifier and delete them
    QDir root(this->_clientRootPath);

    QStringList dirs = root.entryList(QDir::NoDotAndDotDot | QDir::Dirs);

    QString dir;
    Q_FOREACH(dir, dirs) {
        if (dir.endsWith(".app", Qt::CaseInsensitive)) {
            QString path = PathHelper::combineAndCleanPathes(this->_clientRootPath, dir);
            if (PathHelper::getBundleIdentifier(path).endsWith(".appwhirr.bitfall")) {
                // do the new backup
                if(!PathHelper::copyWholeDirectory(path, AppSpecificPathHelper::getTmp_ClientSelfUpdate_OldVersionBackupFolder(), false, PathHelper::SHM_UseAsFile)) {
                    WLog("Failed to do the backup.");
                    return false;
                }
                else {
                    DLog("Backup finished.");
                }
            }
        }
    }
#endif

    return true;
}
Ejemplo n.º 11
0
bool Insomnia::start(IOService* provider) {
    DLog("");

    if (!super::start(provider)) {
        DLog("super::start failed");
        return false;
    }

    _last_lid_state = true; // Technically it could be closed...

    startPM(provider);

    Insomnia::send_event(kIOPMDisableClamshell);// | kIOPMPreventSleep);

    return true;
}
Ejemplo n.º 12
0
	CUser* CAuthModule::Load_User( const std::string& Name ) {
		std::string Filename = "";
		
		// User /driver/auth/X -> X = first letter of username
		Filename = "/Driver/Auth/Users";
		Filename += Name.substr(0,1);
		Filename += "/";
		Filename += Name;
		Filename += ".sav";
		
		CByteStream ByteStream;
		
		if( !m_pFSModule->Read_ByteStream( Filename, ByteStream ) ) {
			DLog(LOG_AUTH, "Unable to read bytestream in CAuthModule::Load_User()\n");
			return NULL;
		}
		
		CUser* pUser = NULL;

		// First byte of ByteStream is the UserType
		uint8_t UserType = *ByteStream.Get_Data_Ptr();
		pUser = Create_New_User( UserType );
		
		// Serialize user obj from bytestream
		pUser->Serialize_From( ByteStream );

		return pUser;
	}
Ejemplo n.º 13
0
void NotificationManager::addNotification(NotificationWidget *notificationWidget, int timeoutMilliseconds, bool isShowItImmediatelly)
{
    DLog("New notification added: ") << notificationWidget->getPrintableExplanationOfNotification();
    // TMP - debug
    notificationWidget->setObjectName(notificationWidget->getNotificationItemId());

    this->_notificationWidgets << notificationWidget;

    notificationWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    notificationWidget->setFixedHeight(GlobalObjectRegistry::sharedGlobalObjectRegistry()->getGuiConfigurationManager()->getIntForId("Notification/Widget/fixedHeight"));
    QWidget *notifContentWidget = notificationWidget->getContentWidget();
    if(notifContentWidget != NULL) {
        notifContentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
        notifContentWidget->setFixedHeight(GlobalObjectRegistry::sharedGlobalObjectRegistry()->getGuiConfigurationManager()->getIntForId("Notification/Widget/fixedHeight"));
    }

    this->_notificationLayout->addWidget(notificationWidget);
    notificationWidget->hide(); // hide it, and allow the delegates to manage it's visibility

    notificationWidget->activateTheNotification(timeoutMilliseconds);


    if(isShowItImmediatelly) {
        this->spinNotificationsToEnsureThisIndexIsVisible(this->_notificationWidgets.size() - 1); // ensure it will be visible

        // stop the timer
        this->_updateTimer->stop();
        // fire the update
        this->updateManager();
        // restart the timer
        this->_updateTimer->start();
    }

    this->activateManager();
}
bool PathManager::copyOnlyFilesOfDirectory(QString sourceDirPath, QString destDirPath)
{
    FLAG_FOR_REVIEW_WITH_HINT("Should copy symlink / shortcut files as well?? Temporarily removed / turned off.");

    QDir sourceDir(sourceDirPath);

    QStringList files = sourceDir.entryList(QDir::NoDotAndDotDot | QDir::Files | QDir::NoSymLinks);
    for(int i = 0; i < files.count(); i++)
    {
        QString srcName = PathManager::combineAndCleanPathes(sourceDirPath, files[i]);
        QString destName = PathManager::combineAndCleanPathes(destDirPath, files[i]);

        // QFile cannot copy the file, when destName exists
        if(QFileInfo(srcName).isSymLink()) {
            // tmp, do nothing
            WLog(QString("The file [%1] is a symlink to file [%2]").arg(srcName).arg( QFileInfo(srcName).symLinkTarget() ));
        }
        else {
            if(!QFile::copy(srcName, destName)) {
                WLogS << " ! Cannot copy the file from: " << srcName << " to: " << destName;
                WLog(QString(" ! Cannot copy file from [%1] to [%2]").arg(srcName).arg(destName));
                return false;
            }
            else {
#ifdef ENABLE_PATH_MANAGER_LOGGING
                DLog(QString("Copy succeeded - file from [%1] to [%2]").arg(srcName).arg(destName));
#endif
            }
        }
    }
    files.clear();

    return true;
}
Ejemplo n.º 15
0
void AppUninstaller::_backupFolderClearFinished()
{
    DLog("--- do backup");

    // step 2: do backup
    if(!QDir(this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath()).exists()) {
        WLog("Application is not installed - it's installed root path does not exists here: ") << this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath();

        // will emit success to allow the GUI to refresh as not-installed
        this->_currentUninstallFinishedWithSuccess();
        return;
    }
    QString appId = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getAppId();
    Q_EMIT progressStateMessage(appId, tr("Performing app backup"));

#if 0
    QString appIntalledDirPath = this->_uninstallQueue.head().getDynamicDescription_ReadOnly()->getInstalledRootPath();
    Runnable_CopyDirectory *backupWorker = new Runnable_CopyDirectory(appIntalledDirPath, AppSpecificPathHelper::getTmp_UninstallBackupDirectoryPath(), true, PathHelper::SHM_UseAsFile, true);
    connect(backupWorker, SIGNAL(failedWithError(QString)), this, SLOT(_backupFailedWithError(QString)));
    connect(backupWorker, SIGNAL(finishedWithSuccess()), this, SLOT(_backupFinished()));
    QThreadPool::globalInstance()->start(backupWorker);
#endif

    if( !PathHelper::renameFileOrFolder(this->getCurrentAppInstalledRootDirFileInfo(),
                                        this->getCurrentAppTargetBackupDirName()) )
    {
        this->_backupFailedWithError(tr("Cannot backup the app"));
    }
    else {
        this->_backupFinished();
    }
}
Ejemplo n.º 16
0
	// State control funcs
	void CStateModule::Switch_State( DC_ID StateID ) {
		if( StateID <= DC_INVALID_ID ) {
			Log(LOG_STATE, "Invalid State ID to Switch_State(): %d\n", StateID);
			return;
		}
		
		// Get the State obj
		CState* pNewState = Create_State( StateID );
		
		if( !pNewState ) {
			Log(LOG_STATE, "Could not create State: %d\n", StateID);
			return;
		}
		
		DLog(LOG_STATE, "Switching to State: %d\n", StateID);
		
		// If we have a current State, stop it
		CState* pCurState = Get_Current_State();
		if( pCurState ) {
			pCurState->Stop();
			
			// Pop it from the stack
			m_StateStack.pop_back();
			
			// Delete the State obj
			delete pCurState;
		}
		
		// Push the new State on top
		m_StateStack.push_back( pNewState );
		
		// Start the new State
		pNewState->Start();
	}
Ejemplo n.º 17
0
	void CStateModule::Push_State( DC_ID StateID ) {
		if( StateID <= DC_INVALID_ID ) {
			Log(LOG_STATE, "Invalid State ID to Push_State(): %d\n", StateID);
			return;
		}
		
		// Get the State obj
		CState* pNewState = Create_State( StateID );
		
		if( !pNewState ) {
			Log(LOG_STATE, "Could not create State: %d\n", StateID);
			return;
		}
		
		DLog(LOG_STATE, "Pushing State %d\n", StateID);
		
		// If we have a current State, pause it
		CState* pCurState = Get_Current_State();
		if( pCurState ) {
			pCurState->Pause();
		}
		
		// Push the new State on top
		m_StateStack.push_back( pNewState );
		
		// Start the new State
		pNewState->Start();
	}
Ejemplo n.º 18
0
void AppUninstaller::_tryToStartNextUninstallInQueue()
{
    if(this->_isInUninstallProcess) {
        DLog("Still uninstalling.");
        return;
    }

    if(this->_uninstallQueue.isEmpty()) {
        DLog("Empty queue");
        return;
    }

    this->_isInUninstallProcess = true;

    this->_checkWhetherAppRunning();
}
Ejemplo n.º 19
0
	bool CFile::Flush() {
		if( !Cache_Loaded() ) {
			DLog(LOG_FS, "Calling CFile::Flush() with cache unloaded\n");
			return false;
		}
		
		int fd = open( m_sFullPath.c_str(), O_WRONLY | O_TRUNC);
		
		if( fd == -1) {
			return false;
		}
		
		int Write = write(fd, (void*)m_pData, m_Size);
		
		if( Write < (int)m_Size ) {
			Log(LOG_FS, "Did not write entire ByteStream in CFile::Write()\n");
			close(fd);
			return false;
		}
		
		close(fd);
		
		// No longer modified
		m_Modified = false;
		
		return false;
	};
void AWUninstallPerformerTask::removeAppWhirrClient()
{
    Q_EMIT uninstallStateMessage(tr("Removing AppWhirr app..."));

    QFileInfo clientAppFolderFileInfo(_uninstallConfigs->getAppWhirrClientAppFolderPath());

#ifdef Q_OS_MAC
    QString clientAppFolderDirName( QDir(clientAppFolderFileInfo.absoluteFilePath()).dirName() );
    if( clientAppFolderDirName != "AppWhirrData" ) {
        // fail for security reasons (don't delete any other folder, especially not the Applications folder)
        WLog("Because of security reasons the AppWhirr client have to be in the 'AppWhirrData' folder - and it's not. Won't delete the client. => Detected dir-name: ") << clientAppFolderDirName;
        _uninstallConfigs->addFailedUninstallStep(UninstallDeleteSteps::RemoveAppWhirrClientFiles);
        Q_EMIT uninstallStateMessage(tr("Failed to remove the AppWhirr app..."));
        this->finishedWithRemoveAppWhirrClient();
        return;
    }
    else {
        DLog("AppWhirr is in the 'AppWhirrData' folder - uninstall can be performed");
    }
#endif

    if(clientAppFolderFileInfo.exists()) {
        if( !this->deleteFileOrFolderWithBackup(QFileInfo(_uninstallConfigs->getAppWhirrClientAppFolderPath())) ) {
            _uninstallConfigs->addFailedUninstallStep(UninstallDeleteSteps::RemoveAppWhirrClientFiles);
            Q_EMIT uninstallStateMessage(tr("Failed to remove the AppWhirr app..."));
        }
    }

    this->finishedWithRemoveAppWhirrClient();
}
bool StreamToFileManager::startStreamingToFile(QString targetFilePath, bool isRemoveTargetFileIfExists)
{
    if(isRemoveTargetFileIfExists)
    {
        // check whether the target-file exists
        QFile resourceTargetFile(targetFilePath);
        if(resourceTargetFile.exists()) {
            if( !resourceTargetFile.remove() ) {
                WLog("Cannot remove the file:") << targetFilePath;
                _isStreamingAborted = true;
    //            Q_EMIT streamingFinishedWithError(targetFilePath, "File cannot be removed.");
                return false;
            }
        }
    }

    AW_QOBJECT_SAFE_DELETE(_targetFile);
    _targetFile = new QFile(targetFilePath, this);
    if(!_targetFile->open(QIODevice::WriteOnly | QIODevice::Append)) {
        WLog("Cannot open the file: ") << _targetFile->errorString();
        _isStreamingAborted = true;
//        Q_EMIT streamingFinishedWithError(targetFilePath, "File cannot be opened.");
        return false;
    }

    DLog("File opened");
    _isStreamingAborted = false;
    _isStreamClosing = false;
    _targetFilePath = targetFilePath;

    return true;
}
Ejemplo n.º 22
0
char * get_preferred_ip(const char * domainName) {
    // The host address and file we wish to GET, e.g. http://127.0.0.1/blah.txt
    const char *addr_start = domainName;
    // Skip past http:// if it's there
    if (strncasecmp(addr_start, "http://", strlen("http://")) == 0) {
        addr_start += strlen("http://"); // 如果有http开头的,则使指针跳过开头
    }

    // Split the host address into a web address and a file name/path, 
    // e.g. 127.0.0.1/blah.txt into 127.0.0.1 and /blah.txt
    char *file_name;
    char *server_address = split_path(addr_start, &file_name);
    int port = split_port(server_address);

    struct hostent *host_entity;    
    if ((host_entity = gethostbyname(server_address)) == NULL) {
        DLog("gethostbyname failed on '%s'\n", domainName);
        return NULL;
    }

    int i = 0;
    char * fast_ip = NULL;
    int fast_speed = -1;
    while (host_entity->h_addr_list[i] != NULL) {
        struct sockaddr_in address;
        address.sin_family = AF_INET;
        memcpy(&address.sin_addr, host_entity->h_addr_list[i], host_entity->h_length);
        address.sin_port = htons(port);

        int speed = get_http_speed(1024*100, server_address, port, file_name, address);
        if (speed > fast_speed && speed > 0) {
            if (fast_ip != NULL){
                free(fast_ip);
                fast_ip = NULL;
            }
            fast_speed = speed;
            char * tmp = inet_ntoa(address.sin_addr);
            fast_ip = malloc(sizeof(char) * strlen(tmp));
            strcpy(fast_ip, tmp);
        }

        DLog("ip: %s, speed: %d\n\n", inet_ntoa(address.sin_addr), speed);
        i ++;
    }
    return fast_ip;
}
Ejemplo n.º 23
0
 AudioMixer::AudioMixer(int outChannelCount,
                        int outFrequencyInHz,
                        int outBitsPerChannel,
                        double frameDuration)
 : GenericAudioMixer(outChannelCount, outFrequencyInHz, outBitsPerChannel, frameDuration)
 {
     DLog("Apple::AudioMixer");
 }
Ejemplo n.º 24
0
void MagnetWidget::showTargetWidget()
{
    DLog("-- magnet widget: SHOW");
    _magnetTargetWidget->show();
    _magnetTargetWidget->raise();
    _magnetTargetWidget->repaint();
    _magnetTargetWidget->update();
}
void SameSizeLayoutSnapshotChangeDelegateBase::changeSnapshot(WidgetListSnapshot sourceSnapshot, WidgetListSnapshot targetSnapshot)
{
    // check whether a change is currently in progress so we should only store (and compress)
    //  this change or we should make it right now (if we are not busy right now)
    if(isProcessingSnapshotChangeFlag)
    {
#ifdef ENABLE_SNAPSHOT_HANDLING_LOGGING
        DLog("isProcessingSnapshotChangeFlag = true");
        DLogS << "sourceSnapshot cnt: " << sourceSnapshot.getOrderedItemCount();
        DLogS << "targetSnapshot cnt: " << targetSnapshot.getOrderedItemCount();
#endif
        //snapshotQueue.enqueue(SnapshotQueueItem(sourceSnapshot, targetSnapshot));

        isCompactSnapshotChangeAvailable = true;
        if(isCompactSnapshotSourceNotYetDefined)
        {
            isCompactSnapshotSourceNotYetDefined = false;
            compactSnapshotChange.setSourceSnapshot(sourceSnapshot);
        }

        compactSnapshotChange.setTargetSnapshot(targetSnapshot);

        return;
    }

    DynamicDelegateBasedHighPerformanceSameSizeLayoutBase *castedParent = this->getCastedParentLayout();
    if(castedParent == NULL)
    {
        WLog("Parent is not the type we need.");
        return;
    }

    QSize currentOptimalSize = castedParent->getCalculatedOptimalSize();

    isProcessingSnapshotChangeFlag = true; // block until it finished - queue the requests
    SameSizeHorizontalLayoutingInformations layoutInformations = castedParent->getLayoutingInformations();

    // force-recalculate the sizes before layout-blocking
    // -> the layout has the required informations about the new-state (new item cound, size, ...)
//    castedParent->recalculateMinimalAndOptimalSizesByTotalLayoutWidth(castedParent->getCachedLastReceivedRect().width());
    castedParent->_recalculateOptimalSizeByLastReceivedWidth();

    QSize predictedOptimalSizeAfterLayoutChange = castedParent->getCalculatedOptimalSize();

    Q_EMIT layoutChangeStarted(currentOptimalSize, predictedOptimalSizeAfterLayoutChange);
    castedParent->setLayoutUpdateBlocked(true, false);

    // clear the current animation set - it's allowed here, we are not in a change-progress (animation)
    this->clearCurrentAnimationGroup();

    //
    // calculate and create the change-animations
    this->_changeSnapshotImplementation(sourceSnapshot, targetSnapshot, layoutInformations);

    //
    // and start the change-animations
    this->startCurrentAnimationGroup();
}
void CommunicationDescriptionGateway::requestFinished() {
#ifdef ENABLE_COMMUNICATION_LOGGING
    DLog("Finished");
#endif

    AW_QOBJECT_SAFE_DELETE(networkRequest);

    this->_finishedWithCommunicationStep();
}
Ejemplo n.º 27
0
void AppUninstaller::_currentUninstallFinishedWithSuccess()
{
    ApplicationDescriptionModel appDescr = this->_uninstallQueue.dequeue();
    DLog(" -- Uninstall finished for item: ") << appDescr.getDynamicDescription_ReadOnly()->getAppId() << appDescr.getDynamicDescription_ReadOnly()->getAppName();
    Q_EMIT finishedWithSuccess(appDescr);

    _isInUninstallProcess = false;
    this->_tryToStartNextUninstallInQueue();
}
Ejemplo n.º 28
0
void print_current_time() {
    char time_buffer[512];
    time_t raw_time;
    struct tm *current_time;
    time(&raw_time);
    current_time = localtime(&raw_time);
    strftime(time_buffer, 512, "%a, %d %b %Y %T %Z", current_time);
    DLog("[%s] Response received from server\n", time_buffer);
}
void StreamToFileManager::_bufferTransmitterFlush(QByteArray bufferedData)
{
    DLog("Buffer flush");
    StreamToFile *worker = new StreamToFile(_targetFile, bufferedData);
    connect(worker, SIGNAL(finishedWithSuccess()), this, SLOT(_chunkWrittenToFile()));
    connect(worker, SIGNAL(failedWithError(QString)), this, SLOT(_chunkWriteToFileFailedWithError(QString)));
//    QThreadPool::globalInstance()->start(worker);
    _backgroundWorkerQueue->addItemToQueue(worker);
}
void Background_ClientInstaller::run()
{
    Q_EMIT installPercentage(0);
    // first: get admin rights and set required permissions (it's an issue with the AppWhirr v0.9.15's installer)
#ifdef Q_OS_MAC
    DLog("Client root path: ") << _clientRootPath;
    QString asToExecute = QString("do shell script \"chmod -R 777 %1\" with administrator privileges").arg(_clientRootPath);
    Mac_AppleScriptExecutor::executeAppleScript(asToExecute);
#endif

    Q_EMIT installPercentage(10);
    if(this->_lastStepDone == DoFromTheBeginning) {
        if(!this->tryToBackup()) {
            Q_EMIT failedWithErrorMessage(tr("Cannot backup the old version"), DoFromTheBeginning);
            return;
        }
        else {
            this->_lastStepDone = BackupFinished;
        }
    }

    Q_EMIT installPercentage(25);
    if(this->_lastStepDone == BackupFinished) {
        if(!this->tryToRemoveOldVersion()) {
            Q_EMIT failedWithErrorMessage(tr("Cannot remove the old version. Probably it's still running"), BackupFinished);
            return;
        }
        else {
            this->_lastStepDone = OldVersionRemoved;
        }
    }

    Q_EMIT installPercentage(50);
    if(this->_lastStepDone == OldVersionRemoved) {
        if(!this->copyNewVersion()) {
            // try to restore from backup - but if the copy of the new version failed this one will as well...
            PathHelper::copyWholeDirectory(AppSpecificPathHelper::getTmp_ClientSelfUpdate_OldVersionBackupFolder(), this->_clientRootPath, true, PathHelper::SHM_UseAsFile);
            Q_EMIT failedWithErrorMessage(tr("Cannot install the new version"), OldVersionRemoved);
            return;
        }
        else {
            this->_lastStepDone = NewVersionCopiedToItsFinalPlace;
        }
    }

    Q_EMIT installPercentage(75);
    if(this->_lastStepDone == NewVersionCopiedToItsFinalPlace) {
        if(!this->setRequiredPermissionsForTheNewVersion()) {
            Q_EMIT failedWithErrorMessage(tr("Cannot set required permissions for the new version"), NewVersionCopiedToItsFinalPlace);
            return;
        }
        else {
            Q_EMIT installPercentage(100);
            Q_EMIT succeeded();
        }
    }
}