Beispiel #1
0
	AccountsManager::AccountsManager (QObject *parent)
	: QObject { parent }
	, AccountsModel_ { new QStandardItemModel { this } }
	{
		AccountsModel_->setHorizontalHeaderLabels ({ tr ("Name"), tr ("Server") });
		LoadAccounts ();
	}
Beispiel #2
0
	ToxProtocol::ToxProtocol (const ICoreProxy_ptr& proxy, QObject* parentPlugin)
	: QObject { parentPlugin }
	, CoreProxy_ { proxy }
	, ParentProtocol_ { parentPlugin }
	{
		qRegisterMetaType<int32_t> ("int32_t");
		qRegisterMetaType<uint8_t> ("uint8_t");
		qRegisterMetaType<uint16_t> ("uint16_t");
		qRegisterMetaType<uint32_t> ("uint32_t");
		qRegisterMetaType<uint64_t> ("uint64_t");

		LoadAccounts ();
	}
/*!
\brief Check the account file status
\remarks Reload Account if modified
*/
void cAccounts::CheckAccountFile()
{

	struct stat filestatus;
	static time_t lastchecked;

	stat("config/accounts.adm", &filestatus);

	if (difftime(filestatus.st_mtime, lastchecked) > 0.0)
		LoadAccounts();

	lastchecked = filestatus.st_mtime;
	lasttimecheck = uiCurrentTime;

}
Beispiel #4
0
void TDBAccountsPrivate::Load() noexcept
   {
      Q_Q(TDBAccounts);
      VerifyConsistency();
      ASSERT(!Accounts)

      const TAccounts::TStrAccHash &StrAccAccounts = LoadAccounts();
      Accounts = std::unique_ptr<TAccounts>(new TAccounts(StrAccAccounts));

      Connect(ad, Accounts.get(), &TAccounts::on_AccountAdded, [this](const TAccount &Acc) { _q_on_AccountAdded(Acc);});
      Connect(ad, Accounts.get(), &TAccounts::on_AccountDeleted, [this](const QString &Str) { _q_on_AccountDeleted(Str);});
      Connect(ad, Accounts->AccountsWatcher(), &TAccountsWatcher::PasswordChanged,
              [this](const QString &User, const QString &Pass) { _q_on_PasswordChanged(User, Pass); });
      Connect(ad, Accounts->AccountsWatcher(), &TAccountsWatcher::SinceChanged,
              [this](const QString &User, const QDateTime &Since) { _q_on_SinceChanged(User, Since); });
      Connect(ad, Accounts->AccountsWatcher(), &TAccountsWatcher::FriendshipStatusChanged,
                           [this](const QString &User, const Core::TUserHostPort &Friend, const TFriendshipStatus &Status)
                                                                { _q_on_FriendshipStatusChanged(User, Friend, Status); });

      emit q->LoadingFinished();
   }
Beispiel #5
0
bool CSettings::LoadSettings(std::string szDir, std::string fileName, bool LoadFromRegistry ) {
	fileName_ = !szDir.empty() ? szDir + ( (!fileName .empty())? fileName : "Settings.xml") 
		: SettingsFolder + ( !fileName.empty() ? fileName : "Settings.xml");
	//std::cout<< fileName_;
	//MessageBoxA(0,fileName_.c_str(),0,0);
	if ( !IuCoreUtils::FileExists( fileName_)  ) {
		return true;
	}
	SimpleXml xml;
	xml.LoadFromFile( fileName_ );
	mgr_.loadFromXmlNode( xml.getRoot("ImageUploader").GetChild("Settings") );

	SimpleXmlNode settingsNode = xml.getRoot( "ImageUploader" ).GetChild( "Settings" );

#if !defined(IU_CLI) && !defined( IU_SHELLEXT) && !defined(IU_SERVERLISTTOOL)
	std::string temp;
	if ( !settingsNode["Image"]["Format"].IsNull() ) {
		// for compatibility with old version configuration file
		LoadConvertProfile( "Old profile", settingsNode );
	}

	if ( CmdLine.IsOption(_T("afterinstall") )) {
		if ( CmdLine.IsOption(_T("usenewicon") )) {
			UseNewIcon = true;
		} else {
			UseNewIcon = false;
		}
		SaveSettings();
	}
	
	// Migrating from 1.3.0 to 1.3.1 (added ImageEditor has been addded)
	if (settingsNode["ImageEditor"].IsNull() ) {
		if ( Settings.TrayIconSettings.TrayScreenshotAction == TRAY_SCREENSHOT_UPLOAD ) {
			TrayIconSettings.TrayScreenshotAction = TRAY_SCREENSHOT_OPENINEDITOR;
		}
		
	}
	LoadConvertProfiles( settingsNode.GetChild("Image").GetChild("Profiles") );
	LoadServerProfiles( settingsNode.GetChild("Uploading").GetChild("ServerProfiles") );
#endif
	LoadAccounts( xml.getRoot( "ImageUploader" ).GetChild( "Settings" ).GetChild( "ServersParams" ) );
#if !defined(IU_CLI) && !defined( IU_SHELLEXT) && !defined(IU_SERVERLISTTOOL)
	// Fixing profies
	if ( !imageServer.profileName().IsEmpty() &&  ServersSettings[WCstringToUtf8(imageServer.serverName())].find(WCstringToUtf8(imageServer.profileName())) == ServersSettings[WCstringToUtf8(imageServer.serverName())].end() ) {
		imageServer.setProfileName("");
	}

	if ( !fileServer.profileName().IsEmpty() &&  ServersSettings[WCstringToUtf8(fileServer.serverName())].find(WCstringToUtf8(fileServer.profileName())) == ServersSettings[WCstringToUtf8(fileServer.serverName())].end() ) {
		fileServer.setProfileName("");
	}
	if ( !contextMenuServer.profileName().IsEmpty() &&  ServersSettings[WCstringToUtf8(contextMenuServer.serverName())].find(WCstringToUtf8(contextMenuServer.profileName())) == ServersSettings[WCstringToUtf8(contextMenuServer.serverName())].end() ) {
		contextMenuServer.setProfileName("");
	}

	if ( !quickScreenshotServer.profileName().IsEmpty() &&  ServersSettings[WCstringToUtf8(quickScreenshotServer.serverName())].find(WCstringToUtf8(quickScreenshotServer.profileName())) == ServersSettings[WCstringToUtf8(quickScreenshotServer.serverName())].end() ) {
		quickScreenshotServer.setProfileName("");
	}

	if ( !urlShorteningServer.profileName().IsEmpty() &&  ServersSettings[WCstringToUtf8(urlShorteningServer.serverName())].find(WCstringToUtf8(urlShorteningServer.profileName())) == ServersSettings[WCstringToUtf8(urlShorteningServer.serverName())].end() ) {
		urlShorteningServer.setProfileName("");
	}
	if ( UploadBufferSize == 65536) {
		UploadBufferSize = 1024 * 1024;
	}
#endif
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	// Loading some settings from registry
	if ( LoadFromRegistry ) {
		CRegistry Reg;
		Reg.SetRootKey( HKEY_LOCAL_MACHINE );
		if ( Reg.SetKey("Software\\Zenden.ws\\Image Uploader", false ) ) {
			ExplorerContextMenu = Reg.ReadBool("ExplorerContextMenu", false);

		} else {
			ExplorerContextMenu = false;
		}
	}
	CRegistry Reg;
	Reg.SetRootKey( HKEY_CURRENT_USER );
	if ( Reg.SetKey("Software\\Zenden.ws\\Image Uploader", false ) ) {
		ExplorerCascadedMenu = Reg.ReadBool( "ExplorerCascadedMenu", true);
		ExplorerVideoContextMenu = Reg.ReadBool( "ExplorerVideoContextMenu", true);
	} 
	CRegistry Reg2;
	Reg2.SetRootKey(HKEY_CURRENT_USER);
	if ( Reg2.SetKey("Software\\Zenden.ws\\Image Uploader", false ) ) {
		AutoStartup = Reg2.ReadBool("AutoStartup", false);
	}

	if ( VideoSettings.Engine != VideoEngineDirectshow &&  VideoSettings.Engine != VideoEngineFFmpeg && VideoSettings.Engine != VideoEngineAuto   ){
		VideoSettings.Engine = VideoEngineAuto;
	}
	if ( !IsFFmpegAvailable() ){
		VideoSettings.Engine = VideoEngineDirectshow;
	}
#endif
	return true;
}