예제 #1
0
bool TPKGS::TC::loadConfigEntry(const std::string &line) {
	if(loadSetting(line, "MAIN_PACKAGE_DIR", tp._mainPackageDir)) { return true; }
	if(loadSetting(line, "INSTALL_PATH_MAP", tp._installPathMap)) { return true; }
	if(loadSetting(line, "KEEP_DIRS", tp._keepDirs)) { return true; }
	if(loadSetting(line, "IGNORE_IN_SOURCE", tp._ignoreInSource)) { return true; }
	if(loadSetting(line, "IGNORE_IN_SYSTEM", tp._ignoreInSystem)) { return true; }
	return false;
}
예제 #2
0
void MainWindow::loadSettings()
{
    QSettings settings;
    restoreGeometry( settings.value( "mainWindowGeometry" ).toByteArray() );
    restoreState( settings.value( "mainWindowState" ).toByteArray() );

    m_centralWidget->restoreGeometry( settings.value( "centralWidgetGeometry" ).toByteArray() );
    m_centralWidget->restoreState( settings.value( "centralWidgetState" ).toByteArray() );

    if ( settings.contains( "lockDockTitles") )
    {
        if ( settings.value( "lockDockTitles" ).toBool() )
        {
            lockDockTitlesAct->activate( QAction::Trigger );
        }
    }
    loadSetting( settings, Fn::Global::LAST_PATH );
    loadSetting( settings, Fn::Global::SCREENSHOT_PATH );
    loadSetting( settings, Fn::Global::BACKGROUND_COLOR_MAIN );
    loadSetting( settings, Fn::Global::BACKGROUND_COLOR_COMBINED );
    loadSetting( settings, Fn::Global::BACKGROUND_COLOR_NAV1 );
    loadSetting( settings, Fn::Global::BACKGROUND_COLOR_NAV2 );
    loadSetting( settings, Fn::Global::BACKGROUND_COLOR_NAV3 );
    loadSetting( settings, Fn::Global::CROSSHAIR_COLOR );
    loadSetting( settings, Fn::Global::SHOW_NAV_SLIDERS );
}
예제 #3
0
파일: alarm_clock.c 프로젝트: lhballoti/avr
void AlarmClock_StartAdjust( uint8_t setting ) {
	is_adjusting = 1;
	curr_setting = setting;
	curr_field = FIELD_WEEKDAY;
	show_field_timer = SHOW_FIELD_DELAY;
	loadSetting( curr_setting );
}
예제 #4
0
RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* settings) :
    _parent(parent),
    _bounds(bounds),
    _windowed(false),
    _fullScreen(false)
{
    _zoomLevel = HEAD;
    _closeTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/close.svg"));

    // Disabled for now https://worklist.net/19548
    // _resetTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/reset.png"));

    _zoomHeadTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/plus.svg"));
    _zoomBodyTextureId = _parent->bindTexture(QImage(PathUtils::resourcesPath() + "images/minus.svg"));

    _shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _resetIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _bodyZoomIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE);
    _headZoomIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE);
    
    settings->beginGroup(SETTINGS_GROUP_NAME);
    _zoomLevel = loadSetting(settings, ZOOM_LEVEL_SETTINGS, 0) == HEAD ? HEAD : BODY;
    settings->endGroup();
};
예제 #5
0
void SliderGenerator::loadConfig()
{
	libconfig::Config cfg;
	try
	{
		cfg.readFile(parentWindow->modulesConfigFile().c_str());
		libconfig::Setting& root = cfg.getRoot();

		if
		(
			root.exists(configGroupName) &&
			root[configGroupName].isGroup() &&
			QMessageBox::question(this, "", "Caricare gli ultimi settaggi usati?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes
		)
			loadSetting(root[configGroupName]);
	}
	catch (libconfig::FileIOException& e) {}
	catch (libconfig::ParseException& e)
	{
		std::string message = "Parse error alla linea " + std::to_string(e.getLine()) + ":\n" + e.getError();
		QMessageBox::warning(this,"Parse error", QString::fromStdString(message), QMessageBox::Ok);
	}
	catch (libconfig::SettingNotFoundException& e)
	{
		std::string path = e.getPath();
		std::string what = e.what();
		std::string message = 	"Errore nel file di configurazione:\n" + path +
					" non e' stato trovato. (" +
					what + ")";
		QMessageBox::warning(this,"Setting error", QString::fromStdString(message), QMessageBox::Ok);
	}
}
예제 #6
0
/* 
 *  Constructs a prefDialog which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
prefDialog::prefDialog( QWidget* parent, Qt::WFlags fl )
	: QDialog( parent, fl )
{

	ui.setupUi(this);
	connectSlots();
	loadSetting();

}
ComicMetaEditorSetting::ComicMetaEditorSetting()
{
#ifdef Q_OS_MAC
    _fileDirectory = "../../../../";
#else
    _fileDirectory = "../../";
#endif
    _filterForImage = "*.bmp *.BMP *.gif *.tif *.tiff *.png *.jpg *.jpeg *.pgm *.pbm";
    loadSetting(DEFAULT_SETTING_FILE);
}
예제 #8
0
bool CovertDevice::initDevice() {
    loadSetting();
    if(!tap.init_tap())
    {
        printf("Unable to init tap");
        return false;
    }
    tap_handle = tap.get_tap_handle();

    if(!network.init_network())
    {
        printf("Unable to init network");
        return false;
    }

    network_handle = (HANDLE)network.get_sock();
}
예제 #9
0
MainDlg::MainDlg(QWidget *parent)
	: QMainWindow(parent)
{
	m_solutionIndex = 0;
	m_playing = false;
	m_displayWidget = NULL;

	ui.setupUi(this);

	connect(ui.actionNewgame, SIGNAL(triggered()), this, SLOT(onActionNewGame()));
	connect(ui.actionCalculate, SIGNAL(triggered()), this, SLOT(onActionCalculate()));
	connect(ui.actionPrev, SIGNAL(triggered()), this, SLOT(onActionPrev()));
	connect(ui.actionNext, SIGNAL(triggered()), this, SLOT(onActionNext()));
	connect(ui.actionPlay, SIGNAL(triggered(bool)), this, SLOT(onActionPlay(bool)));
	connect(ui.actionConfig, SIGNAL(triggered()), this, SLOT(onActionConfig()));
	connect(&m_gamePainter, SIGNAL(playFinish()), this, SLOT(onWidgetPlayFinish()));

	loadSetting();
}
예제 #10
0
void Widget::defaultSetting()
{ //test...2014-08-23
//    QSettings setting(QStandardPaths::writableLocation(QStandardPaths::DataLocation)+"/data/config.ini",QSettings::IniFormat);
    QSettings setting;
    setting.beginGroup("GroupData");
    for(int i = 0;i<setting.childGroups().count();i++){//TODO:test area.
        QString strip = setting.value(QString("%1/IpAdd").arg(setting.childGroups().at(i)),i>9?QString("192.168.1.1%1").arg(i):QString("192.168.1.10%1").arg(i)).toString();
        ui->combGroup->addItem(QString::number(i+1));
//        ui->combGroup->setItemText(i,strip);
        ui->combGroup->setItemData(i,strip);
    }
    setting.endGroup();

    for(int i=0;i<ui->combGroup->count();i++){
        _BarreStatus.insert(ui->combGroup->itemText(i).toInt(),
                            QPair<QPair<sendHead,sendHead>,bool>
                            (QPair<sendHead,sendHead>(sendHead(),sendHead()),true));
    }

    loadSetting();
}
예제 #11
0
RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* settings) :
    _parent(parent),
    _bounds(bounds),
    _windowed(false),
    _fullScreen(false)
{
    _zoomLevel = HEAD;
    _closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.png"));
    _resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png"));
    _zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/head.png"));
    _zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/body.png"));

    _shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _resetIconRect = QRect(_bounds.width() - ICON_SIZE - ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);
    _bodyZoomIconRect = QRect(_bounds.width() - MID_ICON_PADDING - ICON_SIZE, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE);
    _headZoomIconRect = QRect(_bounds.left() + MID_ICON_PADDING, _bounds.bottom() - ICON_PADDING - ICON_SIZE, ICON_SIZE, ICON_SIZE);
    
    settings->beginGroup(SETTINGS_GROUP_NAME);
    _zoomLevel = loadSetting(settings, ZOOM_LEVEL_SETTINGS, 0) == HEAD ? HEAD : BODY;
    settings->endGroup();
};
bool loadConfig(){
    wchar_t inipath[MAX_PATH + 1];
    if(!SUCCEEDED(SHGetFolderPath(NULL,CSIDL_COMMON_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, inipath))) return false;
    wchar_t* path = lstrcat(inipath,L"\\HashingPasswordFilter.ini");
    wchar_t buffer[MAX_PATH + 1];
    if (path==NULL)return false;
    configuration.ldapAdminBindDn = loadSetting(path,L"ldapAdminBindDn",buffer,MAX_PATH + 1);
    configuration.ldapAdminPasswd = loadSetting(path,L"ldapAdminPasswd",buffer,MAX_PATH + 1);
    configuration.ldapSearchBaseDn = loadSetting(path,L"ldapSearchBaseDn",buffer,MAX_PATH + 1);
    
	
	wchar_t* temp = loadSetting(path,L"processPath",buffer,MAX_PATH + 1);
    int cmdLineLen = _scwprintf(PROCESS_COMMAND_LINE_FORMAT_STRING,temp,PROCESS_COMMAND_LINE_PARAMETERS,
        configuration.proxyAddress, configuration.proxyUser, configuration.proxyPassword) + 1;
    configuration.processCommandLine = (wchar_t*)malloc(cmdLineLen * sizeof(wchar_t));
    swprintf(configuration.processCommandLine,cmdLineLen,PROCESS_COMMAND_LINE_FORMAT_STRING,temp,
        PROCESS_COMMAND_LINE_PARAMETERS, configuration.proxyAddress, configuration.proxyUser,
        configuration.proxyPassword);
    free(temp);
    configuration.processPasswd = loadSetting(path,L"processPasswd",buffer,MAX_PATH + 1);
    configuration.processUser = loadSetting(path,L"processUser",buffer,MAX_PATH + 1);

    return true;
}
예제 #13
0
void prefDialog::onReset()
{
	loadSetting();
}
예제 #14
0
void MainDlg::onActionConfig()
{
	ConfigDlg dlg;
	if(dlg.exec() == QDialog::Accepted)
		loadSetting();
}
예제 #15
0
ChatForm::ChatForm(User *receiver, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ChatForm),
    receiver(receiver),
    sender(UserService::getService()->getMyself()),
    mChatRecords(ChatRecordService::getService()->getChatRecordsByUserUuid(receiver->getUuid(), ChatRecord::NotRead)),
    mIconService(IconService::getService()),
    mScreenshotsWidget(new ScreenshotsWidget)
{
    ui->setupUi(this);

    /* recent friends */
    UserService::getService()->insertRecentFriend(*receiver);
    /* end of recent friends */

    setAttribute(Qt::WA_DeleteOnClose);
    this->mChatService = ChatService::getService();
    this->mFileMsgService = FileMessageService::getService();

    ui->userIcon->setIcon(this->receiver->getIcon());
    ui->userIcon->setIconSize(QSize(40, 40));

    ui->usernameLabel->setText(this->receiver->getName());
    ui->signatrueLabel->setText(this->receiver->getInfo());

    setStyleSheet("#ChatForm {background-color:#ffdbf8}");

    connect(mChatService, SIGNAL(receiveSuccess(QHostAddress,quint16,ChatMessage)), this, SLOT(receiveSuccess(QHostAddress,quint16,ChatMessage)));
    connect(mChatService, SIGNAL(sendError(QUuid, QString)), this, SLOT(sendError(QUuid, QString)));
    connect(mChatService, SIGNAL(sendSuccess(QUuid)), this, SLOT(sendSuccess(QUuid)));
    connect(mFileMsgService, SIGNAL(received(QHostAddress,quint16,ChatMessage)), this, SLOT(fileMsgReceived(QHostAddress,quint16,ChatMessage)));

    updateChatRecordView();
    loadSetting();

    sendFileModel = new QStandardItemModel;
    receiveFileModel = new QStandardItemModel;

    QStringList heads;
    heads << "filename" << "progress" << "size" << "type" << "url" << "uuid";
    sendFileModel->setHorizontalHeaderLabels(heads);
    receiveFileModel->setHorizontalHeaderLabels(heads);

    ui->sendFileTableView->setModel(sendFileModel);
    ui->receiveFileTableView->setModel(receiveFileModel);

    mFileSender = 0;
    mFileReceiver = 0;
    mFileMessage = 0;

    fileSendRow = 0;
    fileReceiveRow = 0;

    mShakeTimer = new QTimer(this);
    mShakeTimer->setInterval(30);
    mShakePosition = 0;
    shakeMaxLimitTimes = 12;
    shakeMaxLimitSpace = 5;
    connect(mShakeTimer, SIGNAL(timeout()),this, SLOT(shakeTimeOut()));

    connect(mScreenshotsWidget, SIGNAL(finishPixmap(QPixmap)), this, SLOT(screenshotsFinish(QPixmap)));

    connect(&mFacesDialog, SIGNAL(clicked(Image)), this, SLOT(facesClicked(Image)));
}
예제 #16
0
bool EvaSetting::saveSetting(const int id, const char * md5Pwd, const bool recorded, const bool hidden , 
			const int type, const Q_UINT32 server, const Q_UINT16 port, const QString username, const QCString base64Param)
{
	QString home = QDir::homeDirPath();
	
	QDir d;
	QString fullPath = home + "/.eva";
	if (!d.exists(fullPath)){
		if(!d.cd(home)){
			emit exceptionEvent(QString("can't enter user's home directory"));
			return false;		
		}
		if(!d.mkdir(QString(".eva"),false)){
			emit exceptionEvent(QString("can't create Eva directory"));
			return false;		
		}		
	}
	QString fullName = fullPath + "/" + filename;
	loadSetting();
	//if id exists, update information, otherwise add a new record
	int userIndex = findUser(id);
	Q_UINT8 flag = 0x00;
	if(recorded) flag|=0x01;
	if(hidden) flag |= 0x02;
	switch(type){
	case 0: 
		flag |= 0x10;  // udp;
		break;
	case 1: 
		flag |= 0x08;  // tcp;
		break;
	case 2: 
		flag |= 0x04;  // http proxy;
		break;
	}	
	
	QString s_username = "******";
	QCString s_param = " ";
	if( !username.isEmpty() && username.stripWhiteSpace() != "") s_username = username;
	if( !base64Param.isEmpty() && base64Param.stripWhiteSpace() != "") s_param = base64Param;
	if( userIndex == -1){
		//new record
		LoginRecord *record = new LoginRecord();
		
		record->id = (uint)id;
		
		char *pwd = (char *)malloc(16 * sizeof(char));
		memcpy(pwd, md5Pwd, 16);
		//FIXME memory leak here!!!!
		record->md5Pwd = (Q_UINT8 *)pwd;
		
		record->flag = flag;
		record->proxy = server;
		record->port = port;
		record->proxyUserName = s_username;
		record->base64param = s_param;
		
		userList.append(record);
		userIndex = userList.count()-1;
	}else{
		// update information
		memcpy(userList.at(userIndex)->md5Pwd, md5Pwd, 16);
		userList.at(userIndex)->flag = flag;
		userList.at(userIndex)->proxy = server;
		userList.at(userIndex)->port = port;
		
		userList.at(userIndex)->proxyUserName = s_username;
		userList.at(userIndex)->base64param = s_param;
	}
	QFile file(fullName);
	if(!file.open(IO_WriteOnly)){
		//QString msg = qApp->translate("QFile",file.errorString());
		emit exceptionEvent(fullName);
		return false;
	}
  
	QDataStream stream(&file);
	// save the lastest user's id
	stream<<(Q_UINT32)(userIndex);
	// saving now
	for(uint i=0; i<userList.count(); i++){
		LoginRecord *r= userList.at(i);
		stream<<r->id;
		stream.writeRawBytes((char *)(r->md5Pwd), 16);
		stream<<r->flag;
		stream<<r->proxy;
		stream<<r->port;
		Q_UINT8 len = strlen(r->proxyUserName.ascii());
		stream<<len;
		//stream<<r->proxyUserName;
		stream.writeRawBytes(r->proxyUserName.ascii(), len);
		len = strlen(r->base64param.data());
		stream<<len;
		stream.writeRawBytes(r->base64param.data(), len);
	}
	file.flush();
	file.close();
	return true;
}