Beispiel #1
0
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set),
_close(this, st::btnStickersClose),
_addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd),
_shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd),
_closeStickers(this, lang(lng_close), st::btnStickersAdd) {
	resize(st::stickersWidth, height());
	setMaxHeight(st::stickersMaxHeight);
	connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));

	init(&_inner, 0, st::boxFont->height + st::newGroupNamePadding.top() + st::newGroupNamePadding.bottom());

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers()));
	connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers()));
	connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	connect(&_inner, SIGNAL(installed(uint64)), this, SIGNAL(installed(uint64)));

	onStickersUpdated();

	onScroll();

	prepare();
}
bool BootloaderInstallMi4::uninstall(void)
{
    qDebug() << "[BootloaderInstallMi4] Uninstalling bootloader";

    // check if it's actually a Rockbox bootloader
    emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO);
    if(installed() != BootloaderRockbox) {
        emit logItem(tr("No Rockbox bootloader found"), LOGERROR);
        return false;
    }

    // check if OF file present
    emit logItem(tr("Checking for original firmware file"), LOGINFO);
    QString original = QFileInfo(Utils::resolvePathCase(m_blfile)).absolutePath()
                        + "/OF.mi4";

    if(Utils::resolvePathCase(original).isEmpty()) {
        emit logItem(tr("Error finding original firmware file"), LOGERROR);
        return false;
    }

    // finally remove RB bootloader
    QString resolved = Utils::resolvePathCase(m_blfile);
    QFile blfile(resolved);
    blfile.remove();

    QFile::rename(Utils::resolvePathCase(original), m_blfile);
    emit logItem(tr("Rockbox bootloader successful removed"), LOGINFO);
    logInstall(LogRemove);
    emit done(false);

    return true;
}
TBool CIAUpdateNodeDetails::EmbededDegrades() const
    {
    IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() begin");
    
    for ( TInt i = 0; i < iDependencies.Count(); ++i )
        {
        CIAUpdateNodeDependency* dependency( iDependencies[ i ] );
        if ( dependency->IsEmbedded() )
            {
            // Because the dependency is embedded 
            // we have to make sure that embedding does not
            // create downgrading.
            TBool installed( EFalse );
            TIAUpdateVersion installedVersion;
            TRAP_IGNORE( 
                installed = 
                    IAUpdateUtils::IsAppInstalledL( dependency->Uid(), 
                                                    installedVersion ) );    
            if ( installed && installedVersion > dependency->VersionRoof() )
                {
                IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() end: ETrue");
                return ETrue;
                }   
            }
        }
        
    IAUPDATE_TRACE("[IAUPDATE] CIAUpdateNodeDetails::EmbededDegrades() end: EFalse");
    
    return EFalse;
    }
Beispiel #4
0
void StickerSetInner::installDone(const MTPBool &result) {
	StickerSets &sets(cRefStickerSets());

	sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName)).value().stickers = _pack;
	int32 index = cStickerSetsOrder().indexOf(_setId);
	if (index > 0) {
		cRefStickerSetsOrder().removeAt(index);
		cRefStickerSetsOrder().push_front(_setId);
	} else if (index < 0) {
		cRefStickerSetsOrder().push_front(_setId);
	}

	StickerSets::iterator custom = sets.find(CustomStickerSetId);
	if (custom != sets.cend()) {
		for (int32 i = 0, l = _pack.size(); i < l; ++i) {
			custom->stickers.removeOne(_pack.at(i));
		}
		if (custom->stickers.isEmpty()) {
			sets.erase(custom);
		}
	}
	cSetStickersHash(QByteArray());
	Local::writeStickers();
	emit installed(_setId);
	App::wnd()->hideLayer();
}
Beispiel #5
0
EmoticonsPluginImpl::EmoticonsPluginImpl(QObject *parent)
    : ChatPlugin(parent)
{
    m_emoticons = new Emoticons(this);

    ChatCore::settings()->setDefault(LS("Emoticons"), QStringList(LS("kolobok")));
    ChatCore::extensions()->addFactory(new EmoticonsExtensionFactory());

    TokenFilter::add(LS("channel"), new EmoticonsFilter(m_emoticons));
    TokenFilter::add(LS("input"), new EmoticonsInputFilter());
    QDesktopServices::setUrlHandler(LS("emoticon"), this, "openUrl");

//  SettingsTabHook::add(new EmoticonsPageCreator(m_emoticons));

    connect(ChatCore::extensions(), SIGNAL(loaded()), SLOT(loaded()));
    connect(ChatCore::extensions(), SIGNAL(installed(QString)), SLOT(installed(QString)));

    ChatCore::translation()->addOther(LS("emoticons"));
}
Beispiel #6
0
void Config::DownloadCompletedCallback(http::Download &download) {
	if (download.ResultCode() != 200) {
		ERROR_LOG(LOADER, "Failed to download version.json");
		return;
	}
	std::string data;
	download.buffer().TakeAll(&data);
	if (data.empty()) {
		ERROR_LOG(LOADER, "Version check: Empty data from server!");
		return;
	}

	JsonReader reader(data.c_str(), data.size());
	const json_value *root = reader.root();
	if (!root) {
		ERROR_LOG(LOADER, "Failed to parse json");
		return;
	}

	std::string version = root->getString("version", "");

	const char *gitVer = PPSSPP_GIT_VERSION;
	Version installed(gitVer);
	Version upgrade(version);
	Version dismissed(g_Config.dismissedVersion);

	if (!installed.IsValid()) {
		ERROR_LOG(LOADER, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION);
		return;
	}
	if (!upgrade.IsValid()) {
		ERROR_LOG(LOADER, "Version check: Invalid server version: %s", version.c_str());
		return;
	}

	if (installed >= upgrade) {
		INFO_LOG(LOADER, "Version check: Already up to date, erasing any upgrade message");
		g_Config.upgradeMessage = "";
		g_Config.upgradeVersion = upgrade.ToString();
		g_Config.dismissedVersion = "";
		return;
	}

	if (installed < upgrade && dismissed != upgrade) {
		g_Config.upgradeMessage = "New version of PPSSPP available!";
		g_Config.upgradeVersion = upgrade.ToString();
		g_Config.dismissedVersion = "";
	}
}
Beispiel #7
0
/**
 * Uninstalls a package from KISS's directory structure
 */
KissReturn KissArchive::uninstall(const QString& name)
{
	QSettings installed(KISS_ARCHIVE_FILE, QSettings::IniFormat);
	if(!installed.childGroups().contains(name)) return KissReturn(true, QObject::tr("No such archive installed"));
	
	const QStringList& files = installed.value(name + INSTALLED_FILES_STRING).toStringList();
	foreach(const QString& file, files) {
		if(!QFile(file).remove()) qWarning() << "Failed to remove file" << file;
		const QDir& dir = QFileInfo(file).dir();
		if(dir.entryList(QDir::NoDotAndDotDot).size() == 0) dir.rmdir(dir.absolutePath());
	}
	
	const QStringList& dirs = installed.value(name + INSTALLED_DIRS_STRING).toStringList();
	foreach(const QString& dir, dirs) {
		QDir().rmdir(dir);
	}
Beispiel #8
0
bool UIAPI uiinitgmouse( int install )
{
    MouseInstalled = false;
    if( install > 0 && installed( BIOS_MOUSE ) ) {
        if( install > 1 ) {
            if( CheckEgaVga() ) {
                if( MouInit() ) {
                    UIData->mouse_yscale = _POINTS;
                    UIData->mouse_xscale = 8;
                } else {
                    install = 0;
                }
            } else if( MouseInt( 0, 0, 0, 0 ) != -1 ) {
                install = 0;
            }
        }
        if( install > 0 ) {
            setupmouse();
        }
    }
    return( MouseInstalled );
}
Beispiel #9
0
void StickerSetInner::installDone(const MTPBool &result) {
	StickerSets &sets(cRefStickerSets());

	sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)).value().stickers = _pack;

	int32 insertAtIndex = 0;
	StickerSetsOrder &order(cRefStickerSetsOrder());
	for (int32 s = order.size(); insertAtIndex < s; ++insertAtIndex) {
		StickerSets::const_iterator i = sets.constFind(order.at(insertAtIndex));
		if (i == sets.cend() || !(i->flags & MTPDstickerSet_flag_official)) {
			break;
		}
	}
	int32 currentIndex = cStickerSetsOrder().indexOf(_setId);
	if (currentIndex != insertAtIndex) {
		if (currentIndex > 0) {
			order.removeAt(currentIndex);
			if (currentIndex < insertAtIndex) {
				--insertAtIndex;
			}
		}
		order.insert(insertAtIndex, _setId);
	}

	StickerSets::iterator custom = sets.find(CustomStickerSetId);
	if (custom != sets.cend()) {
		for (int32 i = 0, l = _pack.size(); i < l; ++i) {
			custom->stickers.removeOne(_pack.at(i));
		}
		if (custom->stickers.isEmpty()) {
			sets.erase(custom);
		}
	}
	cSetStickersHash(QByteArray());
	Local::writeStickers();
	emit installed(_setId);
	App::wnd()->hideLayer();
}
Beispiel #10
0
void chrobak_payne_straight_line_drawing(const Graph& g,
        PlanarEmbedding embedding,
        ForwardIterator ordering_begin,
        ForwardIterator ordering_end,
        GridPositionMap drawing,
        VertexIndexMap vm
                                        )
{

    typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
    typedef typename graph_traits<Graph>::edge_descriptor edge_t;
    typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t;
    typedef typename PlanarEmbedding::value_type::const_iterator
    edge_permutation_iterator_t;
    typedef typename graph_traits<Graph>::vertices_size_type v_size_t;
    typedef std::vector<vertex_t> vertex_vector_t;
    typedef std::vector<v_size_t> vsize_vector_t;
    typedef std::vector<bool> bool_vector_t;
    typedef boost::iterator_property_map
    <typename vertex_vector_t::iterator, VertexIndexMap>
    vertex_to_vertex_map_t;
    typedef boost::iterator_property_map
    <typename vsize_vector_t::iterator, VertexIndexMap>
    vertex_to_vsize_map_t;
    typedef boost::iterator_property_map
    <typename bool_vector_t::iterator, VertexIndexMap>
    vertex_to_bool_map_t;

    vertex_vector_t left_vector(num_vertices(g),
                                graph_traits<Graph>::null_vertex()
                               );
    vertex_vector_t right_vector(num_vertices(g),
                                 graph_traits<Graph>::null_vertex()
                                );
    vsize_vector_t seen_as_right_vector(num_vertices(g), 0);
    vsize_vector_t seen_vector(num_vertices(g), 0);
    vsize_vector_t delta_x_vector(num_vertices(g),0);
    vsize_vector_t y_vector(num_vertices(g));
    vsize_vector_t x_vector(num_vertices(g),0);
    bool_vector_t installed_vector(num_vertices(g),false);

    vertex_to_vertex_map_t left(left_vector.begin(), vm);
    vertex_to_vertex_map_t right(right_vector.begin(), vm);
    vertex_to_vsize_map_t seen_as_right(seen_as_right_vector.begin(), vm);
    vertex_to_vsize_map_t seen(seen_vector.begin(), vm);
    vertex_to_vsize_map_t delta_x(delta_x_vector.begin(), vm);
    vertex_to_vsize_map_t y(y_vector.begin(), vm);
    vertex_to_vsize_map_t x(x_vector.begin(), vm);
    vertex_to_bool_map_t installed(installed_vector.begin(), vm);

    v_size_t timestamp = 1;
    vertex_vector_t installed_neighbors;

    ForwardIterator itr = ordering_begin;
    vertex_t v1 = *itr;
    ++itr;
    vertex_t v2 = *itr;
    ++itr;
    vertex_t v3 = *itr;
    ++itr;

    delta_x[v2] = 1;
    delta_x[v3] = 1;

    y[v1] = 0;
    y[v2] = 0;
    y[v3] = 1;

    right[v1] = v3;
    right[v3] = v2;

    installed[v1] = installed[v2] = installed[v3] = true;

    for(ForwardIterator itr_end = ordering_end; itr != itr_end; ++itr)
    {
        vertex_t v = *itr;

        // First, find the leftmost and rightmost neighbor of v on the outer
        // cycle of the embedding.
        // Note: since we're moving clockwise through the edges adjacent to v,
        // we're actually moving from right to left among v's neighbors on the
        // outer face (since v will be installed above them all) looking for
        // the leftmost and rightmost installed neigbhors

        vertex_t leftmost = graph_traits<Graph>::null_vertex();
        vertex_t rightmost = graph_traits<Graph>::null_vertex();

        installed_neighbors.clear();

        vertex_t prev_vertex = graph_traits<Graph>::null_vertex();
        edge_permutation_iterator_t pi, pi_end;
        pi_end = embedding[v].end();
        for(pi = embedding[v].begin(); pi != pi_end; ++pi)
        {
            vertex_t curr_vertex = source(*pi,g) == v ?
                                   target(*pi,g) : source(*pi,g);

            // Skip any self-loops or parallel edges
            if (curr_vertex == v || curr_vertex == prev_vertex)
                continue;

            if (installed[curr_vertex])
            {
                seen[curr_vertex] = timestamp;

                if (right[curr_vertex] != graph_traits<Graph>::null_vertex())
                {
                    seen_as_right[right[curr_vertex]] = timestamp;
                }
                installed_neighbors.push_back(curr_vertex);
            }

            prev_vertex = curr_vertex;
        }

        typename vertex_vector_t::iterator vi, vi_end;
        vi_end = installed_neighbors.end();
        for(vi = installed_neighbors.begin(); vi != vi_end; ++vi)
        {
            if (right[*vi] == graph_traits<Graph>::null_vertex() ||
                    seen[right[*vi]] != timestamp
               )
                rightmost = *vi;
            if (seen_as_right[*vi] != timestamp)
                leftmost = *vi;
        }

        ++timestamp;

        //stretch gaps
        ++delta_x[right[leftmost]];
        ++delta_x[rightmost];

        //adjust offsets
        std::size_t delta_p_q = 0;
        vertex_t stopping_vertex = right[rightmost];
        for(vertex_t temp = right[leftmost]; temp != stopping_vertex;
                temp = right[temp]
           )
        {
            delta_p_q += delta_x[temp];
        }

        delta_x[v] = ((y[rightmost] + delta_p_q) - y[leftmost])/2;
        y[v] = y[leftmost] + delta_x[v];
        delta_x[rightmost] = delta_p_q - delta_x[v];

        bool leftmost_and_rightmost_adjacent = right[leftmost] == rightmost;
        if (!leftmost_and_rightmost_adjacent)
            delta_x[right[leftmost]] -= delta_x[v];

        //install v
        if (!leftmost_and_rightmost_adjacent)
        {
            left[v] = right[leftmost];
            vertex_t next_to_rightmost;
            for(vertex_t temp = leftmost; temp != rightmost;
                    temp = right[temp]
               )
            {
                next_to_rightmost = temp;
            }

            right[next_to_rightmost] = graph_traits<Graph>::null_vertex();
        }
        else
        {
            left[v] = graph_traits<Graph>::null_vertex();
        }

        right[leftmost] = v;
        right[v] = rightmost;
        installed[v] = true;

    }

    graph::detail::accumulate_offsets
    (*ordering_begin,0,g,x,delta_x,left,right);

    vertex_iterator_t vi, vi_end;
    for(boost::tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi)
    {
        vertex_t v(*vi);
        drawing[v].x = x[v];
        drawing[v].y = y[v];
    }

}
Beispiel #11
0
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
	const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0;
	iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini");

	const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0;
	controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini");

	INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
	bSaveSettings = true;

	bShowFrameProfiler = true;

	IniFile iniFile;
	if (!iniFile.Load(iniFilename_)) {
		ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
		// Continue anyway to initialize the config.
	}

	for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
		IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
		for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
			setting->Get(section);
		}
	}

	iRunCount++;
	if (!File::Exists(currentDirectory))
		currentDirectory = "";

	IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
	recent->Get("MaxRecent", &iMaxRecent, 30);

	// Fix issue from switching from uint (hex in .ini) to int (dec)
	// -1 is okay, though. We'll just ignore recent stuff if it is.
	if (iMaxRecent == 0)
		iMaxRecent = 30;

	if (iMaxRecent > 0) {
		recentIsos.clear();
		for (int i = 0; i < iMaxRecent; i++) {
			char keyName[64];
			std::string fileName;

			snprintf(keyName, sizeof(keyName), "FileName%d", i);
			if (recent->Get(keyName, &fileName, "") && !fileName.empty()) {
				recentIsos.push_back(fileName);
			}
		}
	}

	auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
	vPinnedPaths.clear();
	for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
		vPinnedPaths.push_back(it->second);
	}

	if (iAnisotropyLevel > 4) {
		iAnisotropyLevel = 4;
	}

	// Check for an old dpad setting
	IniFile::Section *control = iniFile.GetOrCreateSection("Control");
	float f;
	control->Get("DPadRadius", &f, 0.0f);
	if (f > 0.0f) {
		ResetControlLayout();
	}

	// MIGRATION: For users who had the old static touch layout, aren't I nice?
	// We can probably kill this in 0.9.8 or something.
	if (fDpadX > 1.0 || fDpadY > 1.0) { // Likely the rest are too!
		float screen_width = dp_xres;
		float screen_height = dp_yres;

		fActionButtonCenterX /= screen_width;
		fActionButtonCenterY /= screen_height;
		fDpadX /= screen_width;
		fDpadY /= screen_height;
		fStartKeyX /= screen_width;
		fStartKeyY /= screen_height;
		fSelectKeyX /= screen_width;
		fSelectKeyY /= screen_height;
		fUnthrottleKeyX /= screen_width;
		fUnthrottleKeyY /= screen_height;
		fLKeyX /= screen_width;
		fLKeyY /= screen_height;
		fRKeyX /= screen_width;
		fRKeyY /= screen_height;
		fAnalogStickX /= screen_width;
		fAnalogStickY /= screen_height;
	}
	
	const char *gitVer = PPSSPP_GIT_VERSION;
	Version installed(gitVer);
	Version upgrade(upgradeVersion);
	const bool versionsValid = installed.IsValid() && upgrade.IsValid();

	// Do this regardless of iRunCount to prevent a silly bug where one might use an older
	// build of PPSSPP, receive an upgrade notice, then start a newer version, and still receive the upgrade notice,
	// even if said newer version is >= the upgrade found online.
	if ((dismissedVersion == upgradeVersion) || (versionsValid && (installed >= upgrade))) {
		upgradeMessage = "";
	}

	// Check for new version on every 10 runs.
	// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
	// splash screen quickly), but then we'll just show the notification next time instead, we store the
	// upgrade number in the ini.
#if !defined(ARMEABI)
	if (iRunCount % 10 == 0 && bCheckForNewVersion) {
		std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
			"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
		dl->SetHidden(true);
	}
#endif

	INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
	bSaveSettings = true;

	IniFile controllerIniFile;
	if (!controllerIniFile.Load(controllerIniFilename_)) {
		ERROR_LOG(LOADER, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str());
		KeyMap::RestoreDefault();
	} else {
		// Continue anyway to initialize the config. It will just restore the defaults.
		KeyMap::LoadFromIni(controllerIniFile);
	}
	
	//so this is all the way down here to overwrite the controller settings
	//sadly it won't benefit from all the "version conversion" going on up-above
	//but these configs shouldn't contain older versions anyhow
	if (bGameSpecific)
	{
		loadGameConfig(gameId_);
	}

	CleanRecent();

#ifdef _WIN32
	iTempGPUBackend = iGPUBackend;
#endif

	// Fix Wrong MAC address by old version by "Change MAC address"
	if (sMACAddress.length() != 17)
		sMACAddress = CreateRandMAC();

	if (g_Config.bAutoFrameSkip && g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) {
		g_Config.iRenderingMode = FB_BUFFERED_MODE;
	}
}
Beispiel #12
0
void ProgressPage::extractZip()
{
   wizard()->button(QWizard::BackButton)->setEnabled(false);
   //придумать случайное название 
   QString cannyFolder = randomName();
   if ((folder_.right(1) == "\\") || (folder_.right(1) == "/"))
   {
      folder_.chop(1);
   }
   fullPath_ = folder_;// + "\\" + cannyFolder;
   //QDir cannyDir(folder_);
   //cannyDir.mkdir(cannyFolder);
   if (!QDir().mkdir(folder_))
   {
      exit(1);
   }
   
   QDir fldr(folder_);
   cannyFolder = fldr.dirName();
   //разархивируем в каталог
   UnZip::ErrorCode ec;
   UnZip uz;
   ec = uz.openArchive(":/setup/setup.zip");
   
   if (ec != UnZip::Ok)
   {
      QMessageBox::critical(this, tr("Setup Error"), 
         tr("There are an error during install.\nPlease contact to software developers.")); 

      exit(3);
      return;
   }
   QList<UnZip::ZipEntry> list = uz.entryList();
   if (!list.isEmpty())
   {
      for (int i = 0; i < list.count(); i++)
      {
         while (paused_)
            qApp->processEvents();

         if (cancelled_)
         {
            uz.closeArchive();
            cancelled_ = false;
            return;
         }

         int percent = 100 * i / list.count();
         bar_->setValue(percent);
         qApp->processEvents();
         ec = uz.extractFile(list.at(i).filename, fullPath_);
         
         if (ec != UnZip::Ok)
         {
            QMessageBox::critical(this, tr("Setup Error"), 
               tr("There are an error during install.\nPlease contact to software developers.")); 
            uz.closeArchive();
            exit(4);
            return;
         }
      }
      bar_->setValue(100);
   }
   uz.closeArchive();

   //переименовать
   cannyBotName_ = fullPath_ + "\\" + cannyFolder + ".exe";
   if (!QFile::rename(fullPath_ + "\\HoldemFolder.exe", cannyBotName_))
   {
      QMessageBox::critical(this, tr("Setup Error"), 
            tr("There are an error during install.\nPlease contact to software developers.")); 
      exit(4);
      return;
   }
   
   QString agentName = fullPath_ + "\\" + randomName() + ".exe";
   if (!QFile::rename(fullPath_ + "\\HoldemAgent.exe", agentName))
   {
      QMessageBox::critical(this, tr("Setup Error"), 
            tr("There are an error during install.\nPlease contact to software developers.")); 
      exit(4);
      return;
   }

   QString uninstName = fullPath_ + "\\" + randomName() + ".exe";
   if (!QFile::rename(fullPath_ + "\\HoldemRemove.exe", uninstName))
   {
      QMessageBox::critical(this, tr("Setup Error"), 
            tr("There are an error during install.\nPlease contact to software developers.")); 
      exit(4);
      return;
   }

   QString acadName;
   if (QFile::exists(fullPath_ + "\\acad.dll"))
   {
      acadName = fullPath_ + "\\" + randomName() + ".dll";
      if (!QFile::rename(fullPath_ + "\\acad.dll", acadName))
      {
         QMessageBox::critical(this, tr("Setup Error"), 
               tr("There are an error during install.\nPlease contact to software developers.")); 
         exit(4);
         return;
      }
   }

   QString rsp1Name;
   if (QFile::exists(fullPath_ + "\\rsp1.dll"))
   {
      rsp1Name = fullPath_ + "\\" + randomName() + ".dll";
      if (!QFile::rename(fullPath_ + "\\rsp1.dll", rsp1Name))
      {
         QMessageBox::critical(this, tr("Setup Error"), 
               tr("There are an error during install.\nPlease contact to software developers.")); 
         exit(4);
         return;
      }
   }

   HoldemNames hns;
   hns.path = fullPath_;
   hns.exePath = cannyBotName_;
   hns.agent = agentName;
   hns.uninstall = uninstName;
   hns.acad = acadName;
   hns.rsp1 = rsp1Name;

   //запишем в реестр новые имена
   QSettings settings(cannyFolder, "Names");
   settings.setValue("acad", acadName);
   settings.setValue("rsp1", rsp1Name);
   settings.setValue("ag", agentName);
   
   emit installed(hns);
   //emit installed(fullPath_, cannyBotName_);
}
Beispiel #13
0
bool mixinOopDesc::is_installed() const {
  if (installed() == trueObj) return true;
  assert(installed() == falseObj, "verify installed");
  return false;
}
Beispiel #14
0
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
	const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0;
	iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini");

	INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
	bSaveSettings = true;

	bShowFrameProfiler = true;

	IniFile iniFile;
	if (!iniFile.Load(iniFilename_)) {
		ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
		// Continue anyway to initialize the config.
	}

	for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
		IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
		for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
			setting->Get(section);
		}
	}

	if (!File::Exists(currentDirectory))
		currentDirectory = "";

	IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
	recent->Get("MaxRecent", &iMaxRecent, 30);

	// Fix issue from switching from uint (hex in .ini) to int (dec)
	// -1 is okay, though. We'll just ignore recent stuff if it is.
	 if (iMaxRecent == 0)
		iMaxRecent = 30;

	 if (iMaxRecent > 0) {
		 recentIsos.clear();
		 for (int i = 0; i < iMaxRecent; i++) {
			 char keyName[64];
			 std::string fileName;

			 snprintf(keyName, sizeof(keyName), "FileName%d", i);
			 if (recent->Get(keyName, &fileName, "") && !fileName.empty()) {
				 recentIsos.push_back(fileName);
			 }
		 }
	 }

	auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
	vPinnedPaths.clear();
	for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
		vPinnedPaths.push_back(it->second);
	}

	if (iAnisotropyLevel > 4) {
		iAnisotropyLevel = 4;
	}

	// Check for an old dpad setting
	IniFile::Section *control = iniFile.GetOrCreateSection("Control");
	float f;
	control->Get("DPadRadius", &f, 0.0f);
	if (f > 0.0f) {
		ResetControlLayout();
	}

	const char *gitVer = PPSSPP_GIT_VERSION;
	Version installed(gitVer);
	Version upgrade(upgradeVersion);
	const bool versionsValid = installed.IsValid() && upgrade.IsValid();

	// Do this regardless of iRunCount to prevent a silly bug where one might use an older
	// build of PPSSPP, receive an upgrade notice, then start a newer version, and still receive the upgrade notice,
	// even if said newer version is >= the upgrade found online.
	if ((dismissedVersion == upgradeVersion) || (versionsValid && (installed >= upgrade))) {
		upgradeMessage = "";
	}

	bSaveSettings = true;

	//so this is all the way down here to overwrite the controller settings
	//sadly it won't benefit from all the "version conversion" going on up-above
	//but these configs shouldn't contain older versions anyhow
	if (bGameSpecific)
	{
		loadGameConfig(gameId_);
	}

	CleanRecent();

#if defined (_WIN32) && !defined (__LIBRETRO__)
	iTempGPUBackend = iGPUBackend;
#endif

	// Fix Wrong MAC address by old version by "Change MAC address"
	if (sMACAddress.length() != 17)
		sMACAddress = CreateRandMAC();

	if (g_Config.bAutoFrameSkip && g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) {
		g_Config.iRenderingMode = FB_BUFFERED_MODE;
	}
}
Beispiel #15
0
int
main(int argc, char **argv)
{
    unsigned packages_found = 0;
    pkg_t **packages = NULL;
    int i, sflag;

#if defined MTRACE
    mtrace();
#endif

    if (parse_options(argc, argv))
	 usage(*argv);

    parse_config ();

	putchar ('\n');
	
    xstrstr = (opt.case_insensitive) ? strcasestr : strstr;
	xstrcmp = (opt.case_insensitive) ? strcasecmp : strcmp;

    /* Load packages installed and split all folds.
	 * Save in a global installed_t struct because
	 * too many function they need.
	 */
	 nginst = installed (&ginst);

    /* update */
    if (opt.update)
	 update();

    /* upgrade all packages */
    if (opt.upgrade)
     upgrade (opt.package);

    /* search */
    if (opt.search || opt.get || opt.view || opt.getsrc || opt.buildsrc)
    {

    packages_list_check (true, PKGLIST_CHECK_QUIT_ON_ALL);
    	
	fprintf (stdout, "Searching %s: ", (opt.package) ? opt.package : "all");
	fflush (stdout);
	
	sflag = (!opt.package || !opt.use_regex) ? MATCH_ALL_NAME : MATCH_USING_REGEX;

	packages = pkgl2pkgt (search (sflag, opt.package), &packages_found);

	if (packages_found == 0)
	 fprintf (stdout, "nothing found.");
    else
     fprintf (stdout, "found %u package%s.\n", packages_found, (packages_found > 1) ? "s" : "");
        
    if (packages_found > 1000)
     fprintf (stdout, "Sorting packages: ");
	fflush (stdout);
	sort_pkg (&packages, &packages_found);
	if (packages_found > 1000)
     fprintf (stdout, "done.\n");
	putchar ('\n');
	show_pkg_found (packages, packages_found);

	}

    /* get */
    if (opt.get)
	 get (&packages, &packages_found);
   
    /* get build sources */
    if (opt.getsrc || opt.buildsrc)
	 pkgsrc_get (&packages, &packages_found);
    
    /* check for missing shared libraries */
    if (opt.shared_dep)
     check_shared_dep (opt.package);

    /* check for missing packager-indicated library */
    if (opt.packager_dep)
     search_packager_lib (opt.package);

    /* view */
    if (opt.view)
	 show_package_info (packages, packages_found);


    /* show packages installed */
    if (opt.installed)
	 installed_packages (opt.package);

    /* show non-slackware packages installed */
    if (opt.nslack_installed)
	 unofficial_packages (opt.package);

    /* show obsolete packages, installed but missing from repositories */
    if (opt.obsolete)
     obsolete_packages (opt.package);
     
    /* show blacklisted packages available */
    if (opt.show_blacklisted)
	 blacklisted_packages (opt.package);

    if (opt.replaceable)
     replaceable_packages (opt.package);

    /* show repositoies stat */
    if (opt.rstat)
     rstat();

    /* clean slackyd directory */
    if (opt.purge_all)
    {
        fprintf (stdout, "Cleaning cache...\n");
        purge (PURGE_ALL);
    }
    if (opt.purge)
    {
        fprintf (stdout, "Removing packages and sources...\n");
        purge (PURGE_PKG);
    }
    
    putchar ('\n');
    
    /* cleanup */
	free_installed_t (&ginst, nginst);
    pkg_t_free_all (&packages, packages_found);

    for (i = (signed)N_REPOS - 1; i >= 0; i--)
	{
		free (REPOS[i].name);
		free (REPOS[i].hostname);
		free (REPOS[i].path);
	}
	free (REPOS);

	free (opt.package);
	free (opt.config);
    free (opt.cache);
    
	while ((opt.nblacklisted--) > 0)
	{
	    regfree (&opt.blacklisted[opt.nblacklisted]);
	}
    free (opt.blacklisted);

	return EXIT_SUCCESS;
}
Beispiel #16
0
/**
 * Install a package given from a QIODevice
 */
KissReturn KissArchive::install(QIODevice* in)
{
	QStringList files;
	QStringList dirs;
	
	// Reads the file's "magic" to make sure we have a Kiss Archive
	char magic[2];
	in->read(magic, 2);
	if(magic[0] != kissMagic[0] || magic[1] != kissMagic[1]) {
		qWarning() << "Bad Magic";
		return KissReturn(true, QObject::tr("Bad Magic. Probably not a KISS Archive"));
	}
	
	// Read platforms, halt if current platform not detected
	unsigned numPlatforms = 0;
	in->read((char*)&numPlatforms, sizeof(unsigned));
	bool match = false;
	for(unsigned i = 0; i < numPlatforms; ++i) {
		if(QString(in->read(3).data()) == OS_NAME) {
			match = true;
		}
	}
	if(!match) {
		qWarning() << "Incorrect OS";
		return KissReturn(true, QObject::tr("This OS is not supported by the archive"));
	}
	
	// Checks the Kiss Archive Specification version, so we know how to extract
	unsigned version = 0;
	in->read((char*)&version, sizeof(unsigned));
	if(kissVersion != version) {
		return KissReturn(true, QObject::tr("Version mismatch. Expected: ")  + kissVersion + QObject::tr(", got ") + version);
	}
	
	// Reads archive name and internal version
	unsigned nameSize = 0;
	in->read((char*)&nameSize, sizeof(unsigned));
	QString name(in->read(nameSize).data());
	unsigned pVersion = 0;
	in->read((char*)&pVersion, sizeof(unsigned));
	
	if(KissArchive::version(name) >= pVersion) {
		qWarning() << "Higher version already installed. Skipping.";
		return KissReturn(true, QObject::tr("Higher version of same archive already installed"));
	} else if(KissArchive::version(name) < pVersion) {
		uninstall(name);
	}
	
	// Recursively extract files and dirs
	unsigned numFiles = 0;
	in->read((char*)&numFiles, sizeof(unsigned));
	for(unsigned i = 0; i < numFiles; ++i) {
		unsigned strLength = 0;
		in->read((char*)&strLength, sizeof(unsigned));
		QString str = QString(in->read(strLength).data());
		
		files << str;
		
		unsigned dataLength = 0;
		in->read((char*)&dataLength, sizeof(unsigned));
		const QByteArray& data = qUncompress(in->read(dataLength));
		
		if(str.isEmpty()) continue;
		
		QFile f(str);
		const QString& filePath = QFileInfo(str).path();
		QDir dir;
		if(!dir.exists(filePath)) {
			dir.mkpath(filePath);
			dirs.prepend(filePath);
		}
		if(!f.open(QIODevice::WriteOnly)) {
			qWarning() << "Unable to open" << str << "for writing.";
		}
		f.write(data);
	}
	qWarning() << files;
	
	QSettings installed(KISS_ARCHIVE_FILE, QSettings::IniFormat);
	installed.setValue(name + INSTALLED_VERSION_STRING, pVersion);
	installed.setValue(name + INSTALLED_FILES_STRING, files);
	installed.setValue(name + INSTALLED_DIRS_STRING, dirs);
	installed.sync();
	
	return KissReturn(false);
}