void ScreenCloudUploader::upload(const QImage &screenshot, QString name)
{
    loadSettings();
    //Save to a buffer
    buffer->open(QIODevice::WriteOnly);
    if(format == "jpg")
    {
        if(!screenshot.save(buffer, format.toLatin1(), jpegQuality))
        {
            emit uploadingError("Failed to save screenshot to buffer. Format=" + format);
        }
    }else
    {
        if(!screenshot.save(buffer, format.toLatin1()))
        {
                emit uploadingError("Failed to save screenshot to buffer. Format=" + format);
        }
    }
    //Upload to screencloud
    QUrl url( "https://api.screencloud.net/1.0/screenshots/upload.xml" );

    // create request parameters
    url.addQueryItem( "name", QUrl::toPercentEncoding(name) );
    url.addQueryItem( "description", QUrl::toPercentEncoding("Taken on " + QDate::currentDate().toString("yyyy-MM-dd") + " at " + QTime::currentTime().toString("hh:mm") + " with the " + OPERATING_SYSTEM + " version of ScreenCloud") );
    url.addQueryItem("oauth_version", "1.0");
    url.addQueryItem("oauth_signature_method", "PLAINTEXT");
    url.addQueryItem("oauth_token", token);
    url.addQueryItem("oauth_consumer_key", CONSUMER_KEY_SCREENCLOUD);
    url.addQueryItem("oauth_signature", CONSUMER_SECRET_SCREENCLOUD + QString("&") + tokenSecret);
    url.addQueryItem("oauth_timestamp", QString::number(QDateTime::currentDateTimeUtc().toTime_t()));
    url.addQueryItem("oauth_nonce", NetworkUtils::generateNonce(15));

    QString mimetype = "image/" + format;
    if(format == "jpg")
    {
        mimetype = "image/jpeg";
    }
    //Add post file
    QString boundaryData = QVariant(qrand()).toString()+QVariant(qrand()).toString()+QVariant(qrand()).toString();
    QByteArray boundary;

    boundary="-----------------------------" + boundaryData.toLatin1();

    QByteArray body = "\r\n--" + boundary + "\r\n";

    //Name
    body += "Content-Disposition: form-data; name=\"name\"\r\n\r\n";
    body += QUrl::toPercentEncoding(name) + "\r\n";

    body += QString("--" + boundary + "\r\n").toLatin1();
    body += "Content-Disposition: form-data; name=\"description\"\r\n\r\n";
    body += QUrl::toPercentEncoding("Taken on " + QDate::currentDate().toString("yyyy-MM-dd") + " at " + QTime::currentTime().toString("hh:mm") + " with the " + OPERATING_SYSTEM + " version of ScreenCloud") + "\r\n";

    body += QString("--" + boundary + "\r\n").toLatin1();
    body += "Content-Disposition: form-data; name=\"file\"; filename=\" " + QUrl::toPercentEncoding(name + boundary + "." + format) + "\"\r\n";
    body += "Content-Type: " + mimetype + "\r\n\r\n";
    body += bufferArray;

    body += "\r\n--" + boundary + "--\r\n";

    QNetworkRequest request;
    request.setUrl(QUrl(url));
    request.setRawHeader("Content-Type","multipart/form-data; boundary=" + boundary);
    request.setHeader(QNetworkRequest::ContentLengthHeader,body.size());
    manager->post(request, body);
}
示例#2
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
  ui->setupUi(this);

  this->resize(800,600);
  imagePath = "maps/map.png";

  sizeWidth = 600;
  sizeHeight = 600;

  loadSettings();

  if (windowFrameVisible == false)
    setWindowFlags(Qt::FramelessWindowHint);

  setRotorAngle(0,90);
  targetAzimuthAngle[0] = 0;

  setRotorAngle(1,180);
  targetAzimuthAngle[1] = 0;

  setRotorAngle(2,270);
  targetAzimuthAngle[2] = 0;

  setRotorAngle(3,0);
  targetAzimuthAngle[3] = 0;

  QPalette plt;
  plt.setColor(QPalette::WindowText, Qt::CURRENT_DIR_BEAMWIDTH_A1_COLOR);
  plt.setColor(QPalette::ButtonText, Qt::CURRENT_DIR_BEAMWIDTH_A1_COLOR);
  ui->groupBoxRotor1->setPalette(plt);
  ui->pushButtonRotor1->setPalette(plt);

  plt.setColor(QPalette::WindowText, Qt::CURRENT_DIR_BEAMWIDTH_A2_COLOR);
  plt.setColor(QPalette::ButtonText, Qt::CURRENT_DIR_BEAMWIDTH_A2_COLOR);
  ui->groupBoxRotor2->setPalette(plt);
  ui->pushButtonRotor2->setPalette(plt);

  plt.setColor(QPalette::WindowText, Qt::CURRENT_DIR_BEAMWIDTH_A3_COLOR);
  plt.setColor(QPalette::ButtonText, Qt::CURRENT_DIR_BEAMWIDTH_A3_COLOR);
  ui->groupBoxRotor3->setPalette(plt);
  ui->pushButtonRotor3->setPalette(plt);

  plt.setColor(QPalette::WindowText, Qt::CURRENT_DIR_BEAMWIDTH_A4_COLOR);
  plt.setColor(QPalette::ButtonText, Qt::CURRENT_DIR_BEAMWIDTH_A4_COLOR);
  ui->groupBoxRotor4->setPalette(plt);
  ui->pushButtonRotor4->setPalette(plt);

  ui->groupBoxRotor1->setVisible(rotorExist[0]);
  ui->groupBoxRotor2->setVisible(rotorExist[1]);
  ui->groupBoxRotor3->setVisible(rotorExist[2]);
  ui->groupBoxRotor4->setVisible(rotorExist[3]);

  ui->pushButtonRotor1->setVisible(rotorExist[0]);
  ui->pushButtonRotor2->setVisible(rotorExist[1]);
  ui->pushButtonRotor3->setVisible(rotorExist[2]);
  ui->pushButtonRotor4->setVisible(rotorExist[3]);

  currRotorIndex = -1;

  ui->labelRotor1Title->setText(rotorName[0]);
  ui->labelRotor2Title->setText(rotorName[1]);
  ui->labelRotor3Title->setText(rotorName[2]);
  ui->labelRotor4Title->setText(rotorName[3]);

  if (rotorExist[0]) {
    currRotorIndex = 0;
    ui->pushButtonRotor1->setChecked(true);
  }
  else if (rotorExist[1]) {
    currRotorIndex = 1;
    ui->pushButtonRotor2->setChecked(true);
  }
  else if (rotorExist[2]) {
    currRotorIndex = 2;
    ui->pushButtonRotor3->setChecked(true);
  }
  else if (rotorExist[3]) {
    currRotorIndex = 3;
    ui->pushButtonRotor4->setChecked(true);
  }

  connect(ui->pushButtonRotor1,SIGNAL(clicked()),this,SLOT(pushButtonRotor1Clicked()));
  connect(ui->pushButtonRotor2,SIGNAL(clicked()),this,SLOT(pushButtonRotor2Clicked()));
  connect(ui->pushButtonRotor3,SIGNAL(clicked()),this,SLOT(pushButtonRotor3Clicked()));
  connect(ui->pushButtonRotor4,SIGNAL(clicked()),this,SLOT(pushButtonRotor4Clicked()));

  connect(ui->pushButtonPreset1, SIGNAL(clicked()), this, SLOT(pushButtonPreset1Clicked()));
  connect(ui->pushButtonPreset2, SIGNAL(clicked()), this, SLOT(pushButtonPreset2Clicked()));
  connect(ui->pushButtonPreset3, SIGNAL(clicked()), this, SLOT(pushButtonPreset3Clicked()));
  connect(ui->pushButtonPreset4, SIGNAL(clicked()), this, SLOT(pushButtonPreset4Clicked()));
  connect(ui->pushButtonPreset5, SIGNAL(clicked()), this, SLOT(pushButtonPreset5Clicked()));

  connect(ui->pushButtonSTOP, SIGNAL(clicked()), this, SLOT(pushButtonSTOPClicked()));

  connect(ui->pushButtonRotateCCW, SIGNAL(pressed()), this, SLOT(pushButtonRotateCCWPressed()));
  connect(ui->pushButtonRotateCW, SIGNAL(pressed()), this, SLOT(pushButtonRotateCWPressed()));
  connect(ui->pushButtonRotateCCW, SIGNAL(released()), this, SLOT(pushButtonRotateCCWReleased()));
  connect(ui->pushButtonRotateCW, SIGNAL(released()), this, SLOT(pushButtonRotateCWReleased()));


  //Setup the network access manager
  networkManager = new QNetworkAccessManager(this);
  connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkReplyFinished(QNetworkReply*)));
}
示例#3
0
SpanSettingsDialog::SpanSettingsDialog(QWidget *parent)
	: QDialog(parent)
{
	setupUi(this);
	loadSettings();
}
示例#4
0
//--------------------------------------------------------------------
void ofVideoGrabber::videoSettings(void){

	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_QUICKTIME
	//---------------------------------

		Rect curBounds, curVideoRect;
		ComponentResult	err;

		// Get our current state
		err = SGGetChannelBounds (gVideoChannel, &curBounds);
		if (err != noErr){
			ofLog(OF_LOG_ERROR, "Error in SGGetChannelBounds");
			return;
		}
		err = SGGetVideoRect (gVideoChannel, &curVideoRect);
		if (err != noErr){
			ofLog(OF_LOG_ERROR, "Error in SGGetVideoRect");
			return;
		}

		// Pause
		err = SGPause (gSeqGrabber, true);
		if (err != noErr){
			ofLog(OF_LOG_ERROR, "Error in SGPause");
			return;
		}

		#ifdef TARGET_OSX
			//load any saved camera settings from file
			loadSettings();

			static SGModalFilterUPP gSeqGrabberModalFilterUPP = NewSGModalFilterUPP(SeqGrabberModalFilterUPP);
			ComponentResult result = SGSettingsDialog(gSeqGrabber,  gVideoChannel, 0, nil, seqGrabSettingsPreviewOnly, gSeqGrabberModalFilterUPP, nil);
			if (result != noErr){
				ofLog(OF_LOG_ERROR, "error in  dialogue");
				return;
			}

			//save any changed settings to file
			saveSettings();
		#else
			SGSettingsDialog(gSeqGrabber, gVideoChannel, 0, nil, seqGrabSettingsPreviewOnly, NULL, 0);
		#endif

		SGSetChannelBounds(gVideoChannel, &videoRect);
		SGPause (gSeqGrabber, false);

	//---------------------------------
	#endif
	//---------------------------------

	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_DIRECTSHOW
	//---------------------------------

		if (bGrabberInited == true) VI.showSettingsWindow(device);

	//---------------------------------
	#endif
	//---------------------------------


	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_UNICAP
	//--------------------------------

		ucGrabber.queryUC_imageProperties();

	//---------------------------------
	#endif
	//---------------------------------

	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_V4L
	//--------------------------------

		queryV4L_imageProperties();

	//---------------------------------
	#endif
	//---------------------------------

}
示例#5
0
void AkuViewOptionWidget::applySettings()
{
    saveSettings();
    loadSettings();
}
SkinHighlighter::SkinHighlighter(QTextDocument* doc)
    :QSyntaxHighlighter(doc)
{
    loadSettings();
}
ClientSettings::ClientSettings() : port(60007), address(new QHostAddress("134.117.28.146")){
    settings = new QSettings(QString("./settings.txt"), QSettings::NativeFormat);
    loadSettings();

}
示例#8
0
SettingsManager::SettingsManager()
{
	loadSettings();
}
示例#9
0
文件: handler.cpp 项目: kuiba/qutim
Handler::Handler() : m_authorization("AuthorizationService")
{
	connect(ServiceManager::instance(), SIGNAL(serviceChanged(QByteArray,QObject*,QObject*)),
	        SLOT(onServiceChanged(QByteArray)));
	loadSettings();
}
示例#10
0
void BracketedSentenceWidget::colorChanged()
{
    loadSettings();
    updateText();
}
示例#11
0
ccRasterizeTool::ccRasterizeTool(ccGenericPointCloud* cloud, QWidget* parent/*=0*/)
	: QDialog(parent, Qt::WindowMaximizeButtonHint)
	, cc2Point5DimEditor()
	, Ui::RasterizeToolDialog()
	, m_cloud(cloud)
{
	setupUi(this);

#ifndef CC_GDAL_SUPPORT
	generateRasterPushButton->setDisabled(true);
	generateRasterPushButton->setChecked(false);
#endif

	connect(buttonBox,					SIGNAL(accepted()),					this,	SLOT(testAndAccept()));
	connect(buttonBox,					SIGNAL(rejected()),					this,	SLOT(testAndReject()));
	connect(gridStepDoubleSpinBox,		SIGNAL(valueChanged(double)),		this,	SLOT(updateGridInfo()));
	connect(gridStepDoubleSpinBox,		SIGNAL(valueChanged(double)),		this,	SLOT(gridOptionChanged()));
	connect(emptyValueDoubleSpinBox,	SIGNAL(valueChanged(double)),		this,	SLOT(gridOptionChanged()));
	connect(resampleCloudCheckBox,		SIGNAL(toggled(bool)),				this,	SLOT(gridOptionChanged()));
	connect(dimensionComboBox,			SIGNAL(currentIndexChanged(int)),	this,	SLOT(projectionDirChanged(int)));
	connect(heightProjectionComboBox,	SIGNAL(currentIndexChanged(int)),	this,	SLOT(projectionTypeChanged(int)));
	connect(scalarFieldProjection,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(sfProjectionTypeChanged(int)));
	connect(fillEmptyCellsComboBox,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(fillEmptyCellStrategyChanged(int)));
	connect(updateGridPushButton,		SIGNAL(clicked()),					this,	SLOT(updateGridAndDisplay()));
	connect(generateCloudPushButton,	SIGNAL(clicked()),					this,	SLOT(generateCloud()));
	connect(generateImagePushButton,	SIGNAL(clicked()),					this,	SLOT(generateImage()));
	connect(generateRasterPushButton,	SIGNAL(clicked()),					this,	SLOT(generateRaster()));
	connect(generateASCIIPushButton,	SIGNAL(clicked()),					this,	SLOT(generateASCIIMatrix()));
	connect(generateMeshPushButton,		SIGNAL(clicked()),					this,	SLOT(generateMesh()));
	connect(generateContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(generateContours()));
	connect(exportContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(exportContourLines()));
	connect(clearContoursPushButton,	SIGNAL(clicked()),					this,	SLOT(removeContourLines()));
	connect(activeLayerComboBox,		SIGNAL(currentIndexChanged(int)),	this,	SLOT(activeLayerChanged(int)));

	//custom bbox editor
	ccBBox gridBBox = m_cloud ? m_cloud->getOwnBB() : ccBBox(); 
	if (gridBBox.isValid())
	{
		createBoundingBoxEditor(gridBBox, this);
		connect(editGridToolButton, SIGNAL(clicked()), this, SLOT(showGridBoxEditor()));
	}
	else
	{
		editGridToolButton->setEnabled(false);
	}

	if (m_cloud)
	{
		cloudNameLabel->setText(m_cloud->getName());
		pointCountLabel->setText(QString::number(m_cloud->size()));
		interpolateSFFrame->setEnabled(cloud->hasScalarFields());

		//populate layer box
		activeLayerComboBox->addItem(GetDefaultFieldName(PER_CELL_HEIGHT));
		if (cloud->isA(CC_TYPES::POINT_CLOUD) && cloud->hasScalarFields())
		{
			ccPointCloud* pc = static_cast<ccPointCloud*>(cloud);
			for (unsigned i=0; i<pc->getNumberOfScalarFields(); ++i)
				activeLayerComboBox->addItem(pc->getScalarField(i)->getName());
		}
		else
		{
			activeLayerComboBox->setEnabled(false);
		}

		//add window
		create2DView(mapFrame);
	}

	loadSettings();

	updateGridInfo();

	gridIsUpToDate(false);
}
示例#12
0
TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window)
    : QTreeView(parent)
    , main_window(main_window)
{

    setUniformRowHeights(true);
    // Load settings
    bool column_loaded = loadSettings();

    // Create and apply delegate
    listDelegate = new TransferListDelegate(this);
    setItemDelegate(listDelegate);

    // Create transfer list model
    listModel = new TorrentModel(this);

    nameFilterModel = new TransferListSortModel();
    nameFilterModel->setDynamicSortFilter(true);
    nameFilterModel->setSourceModel(listModel);
    nameFilterModel->setFilterKeyColumn(TorrentModel::TR_NAME);
    nameFilterModel->setFilterRole(Qt::DisplayRole);
    nameFilterModel->setSortCaseSensitivity(Qt::CaseInsensitive);

    setModel(nameFilterModel);

    // Visual settings
    setRootIsDecorated(false);
    setAllColumnsShowFocus(true);
    setSortingEnabled(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setItemsExpandable(false);
    setAutoScroll(true);
    setDragDropMode(QAbstractItemView::DragOnly);
#if defined(Q_OS_MAC)
    setAttribute(Qt::WA_MacShowFocusRect, false);
#endif
    header()->setStretchLastSection(false);

    // Default hidden columns
    if (!column_loaded) {
        setColumnHidden(TorrentModel::TR_ADD_DATE, true);
        setColumnHidden(TorrentModel::TR_SEED_DATE, true);
        setColumnHidden(TorrentModel::TR_UPLIMIT, true);
        setColumnHidden(TorrentModel::TR_DLLIMIT, true);
        setColumnHidden(TorrentModel::TR_TRACKER, true);
        setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED, true);
        setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED, true);
        setColumnHidden(TorrentModel::TR_AMOUNT_DOWNLOADED_SESSION, true);
        setColumnHidden(TorrentModel::TR_AMOUNT_UPLOADED_SESSION, true);
        setColumnHidden(TorrentModel::TR_AMOUNT_LEFT, true);
        setColumnHidden(TorrentModel::TR_TIME_ELAPSED, true);
        setColumnHidden(TorrentModel::TR_SAVE_PATH, true);
        setColumnHidden(TorrentModel::TR_COMPLETED, true);
        setColumnHidden(TorrentModel::TR_RATIO_LIMIT, true);
        setColumnHidden(TorrentModel::TR_SEEN_COMPLETE_DATE, true);
        setColumnHidden(TorrentModel::TR_LAST_ACTIVITY, true);
        setColumnHidden(TorrentModel::TR_TOTAL_SIZE, true);
    }

    //Ensure that at least one column is visible at all times
    bool atLeastOne = false;
    for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++) {
        if (!isColumnHidden(i)) {
            atLeastOne = true;
            break;
        }
    }
    if (!atLeastOne)
        setColumnHidden(TorrentModel::TR_NAME, false);

    //When adding/removing columns between versions some may
    //end up being size 0 when the new version is launched with
    //a conf file from the previous version.
    for (unsigned int i = 0; i<TorrentModel::NB_COLUMNS; i++)
        if (!columnWidth(i))
            resizeColumnToContents(i);

    setContextMenuPolicy(Qt::CustomContextMenu);

    // Listen for list events
    connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(torrentDoubleClicked(QModelIndex)));
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayListMenu(const QPoint &)));
    header()->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(header(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayDLHoSMenu(const QPoint &)));
    connect(header(), SIGNAL(sectionMoved(int, int, int)), this, SLOT(saveSettings()));
    connect(header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(saveSettings()));
    connect(header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(saveSettings()));

    editHotkey = new QShortcut(QKeySequence("F2"), this, SLOT(renameSelectedTorrent()), 0, Qt::WidgetShortcut);
    deleteHotkey = new QShortcut(QKeySequence::Delete, this, SLOT(deleteSelectedTorrents()), 0, Qt::WidgetShortcut);
}
示例#13
0
PaletteDialog::PaletteDialog(QString const &savepath,
                             PaletteDialog const *const global,
                             QWidget *const parent)
: QDialog(parent)
, savedir_(savepath + '/')
, global_(global)
, listView_(new QListView(this))
, rmSchemeButton_(new QPushButton(tr("Remove Scheme"), this))
, quads_()
, currentColors_()
, defaultScheme_(global ? tr("Global Palette") : tr("Default Gray"))
, schemeString_(defaultScheme_)
{
	setWindowTitle(global ? tr("Current ROM Palette") : tr("Global Palette"));
	QDir::root().mkpath(savedir_ + "stored/");
	listView_->setModel(new ImmutableStringListModel(this));
	setSchemeList();

	QVBoxLayout *const mainLayout = new QVBoxLayout(this);

	{
		QHBoxLayout *const topLayout = addLayout(mainLayout, new QHBoxLayout);
		QGroupBox *const lframe = addWidget(topLayout, new QGroupBox(tr("Scheme")));
		QVBoxLayout *const frameLayout = new QVBoxLayout(lframe);
		frameLayout->addWidget(listView_);

		QPushButton *const saveButton =
			addWidget(frameLayout, new QPushButton(tr("Save Scheme...")));
		rmSchemeButton_->setParent(0); // tab order reparent
		frameLayout->addWidget(rmSchemeButton_);
		connect(saveButton, SIGNAL(clicked()), this, SLOT(saveScheme()));
		connect(rmSchemeButton_, SIGNAL(clicked()), this, SLOT(rmScheme()));

		QVBoxLayout *vLayout = addLayout(topLayout, new QVBoxLayout);
		quads_[0] = addWidget(vLayout, new ColorQuad(tr("Background")));
		quads_[1] = addWidget(vLayout, new ColorQuad(tr("Sprite 1")));
		quads_[2] = addWidget(vLayout, new ColorQuad(tr("Sprite 2")));
	}

	{
		QHBoxLayout *hLayout = addLayout(mainLayout, new QHBoxLayout,
		                                 Qt::AlignBottom | Qt::AlignRight);
		QPushButton *okButton     = addWidget(hLayout, new QPushButton(tr("OK")));
		QPushButton *cancelButton = addWidget(hLayout, new QPushButton(tr("Cancel")));
		okButton->setDefault(true);
		connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
		connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
	}

	for (std::size_t i = 0; i < sizeof quads_ / sizeof *quads_; ++i) {
		connect(quads_[i], SIGNAL(colorChanged()),
		        listView_->selectionModel(), SLOT(clear()));
	}

	connect(listView_->selectionModel(),
	        SIGNAL(currentChanged(QModelIndex const &, QModelIndex const &)),
	        this, SLOT(schemeChanged(QModelIndex const &)));

	if (global) {
		restore();
		store();
	} else {
		QSettings settings;
		settings.beginGroup("palette");
		loadSettings(settings);
		settings.endGroup();
	}
}
示例#14
0
LocationBar::LocationBar(BrowserWindow* window)
    : LineEdit(window)
    , m_window(window)
    , m_webView(0)
    , m_holdingAlt(false)
    , m_oldTextLength(0)
    , m_currentTextLength(0)
    , m_loadProgress(0)
    , m_progressVisible(false)
{
    setObjectName("locationbar");
    setDragEnabled(true);

    // Disable Oxygen QLineEdit transitions, it breaks with setText() && home()
    setProperty("_kde_no_animations", QVariant(true));

    m_bookmarkIcon = new BookmarksIcon(this);
    m_goIcon = new GoIcon(this);
    m_siteIcon = new SiteIcon(m_window, this);
    m_autofillIcon = new AutoFillIcon(this);
    DownIcon* down = new DownIcon(this);

    addWidget(m_siteIcon, LineEdit::LeftSide);
    addWidget(m_autofillIcon, LineEdit::RightSide);
    addWidget(m_bookmarkIcon, LineEdit::RightSide);
    addWidget(m_goIcon, LineEdit::RightSide);
    addWidget(down, LineEdit::RightSide);

    m_completer = new LocationCompleter(this);
    m_completer->setMainWindow(m_window);
    m_completer->setLocationBar(this);
    connect(m_completer, SIGNAL(showCompletion(QString)), this, SLOT(showCompletion(QString)));
    connect(m_completer, SIGNAL(showDomainCompletion(QString)), this, SLOT(showDomainCompletion(QString)));
    connect(m_completer, SIGNAL(loadCompletion()), this, SLOT(requestLoadUrl()));
    connect(m_completer, SIGNAL(clearCompletion()), this, SLOT(clearCompletion()));

    m_domainCompleterModel = new QStringListModel(this);
    QCompleter* domainCompleter = new QCompleter(this);
    domainCompleter->setCompletionMode(QCompleter::InlineCompletion);
    domainCompleter->setModel(m_domainCompleterModel);
    setCompleter(domainCompleter);

    editAction(PasteAndGo)->setText(tr("Paste And &Go"));
    editAction(PasteAndGo)->setIcon(QIcon::fromTheme(QSL("edit-paste")));
    connect(editAction(PasteAndGo), SIGNAL(triggered()), this, SLOT(pasteAndGo()));

    connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdited(QString)));
    connect(m_goIcon, SIGNAL(clicked(QPoint)), this, SLOT(requestLoadUrl()));
    connect(down, SIGNAL(clicked(QPoint)), m_completer, SLOT(showMostVisited()));
    connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
    connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
    connect(mApp, SIGNAL(settingsReloaded()), SLOT(loadSettings()));

    loadSettings();

    updateSiteIcon();

    // Hide icons by default
    m_goIcon->setVisible(qzSettings->alwaysShowGoIcon);
    m_autofillIcon->hide();

    QTimer::singleShot(0, this, SLOT(updatePlaceHolderText()));
}
示例#15
0
int main() {
    startup();
    updateUsers();
    loadSettings();
    while(!vars::accepted) {
        getmaxyx(stdscr, vars::maxY, vars::maxX);
        erase();
        firstNotice();
        if(!vars::running)
            break;
        refresh();
    }
    vars::noticeText.scroll = 0;
    while(vars::running) {//Main loop
        updateColors();
        updateUsers();
        if((vars::userList.at(vars::yourself).stat == 0) || ((!vars::chatting) && (!vars::banning)) || ((vars::about) && (!vars::settingsChangingDescription) && (!vars::settingsChangingNickname)))
            curs_set(0);
        else
            curs_set(1);
        getmaxyx(stdscr, vars::maxY, vars::maxX);
        erase();
        if((vars::maxX < 80) || (vars::maxY < 20)) {
            printw("The console window size is too small.\nPlease resize it to at least 80 * 20 width and height respectively.\nPress [Esc] or [Ctrl]+[C] to quit if resizing is not possible.");
            if(getch() == 27)
                vars::running = false;
        }
        else {
            printMainframe();
            if(vars::about)
                about();
            else {
                if(vars::menu == 0) {
                    notifications();
                    askUser();
                }
                else if(vars::menu == 1)
                    chatFrame();
            }
		}

        if((vars::previousState != 4) && (vars::previousState != vars::userList.at(vars::yourself).stat)) { //Check if your user stat changed
            curs_set(0);
            unsigned char thisState = vars::userList.at(vars::yourself).stat;
            if((vars::previousState > 0) && (thisState == 0)) {
                broadcast(std::vector < std::string >(1, "You have been banned!"), 6);
                vars::input.clear();
                vars::chattingWith.clear();
                vars::yourStr.clear();
                vars::menu = 0;
                vars::chatting = true;
                vars::chatScroll = -1;
                flushinp();
            }
            else if((vars::previousState == 0) && (thisState == 1))
                broadcast(std::vector < std::string >(1, "You have been unbanned!"), 8);
            else if((vars::previousState == 2) && (thisState == 1))
                broadcast(std::vector < std::string >(1, "You have been demoted!"), 6);
            else if((vars::previousState < 2) && (thisState == 2))
                broadcast(std::vector < std::string >(1, "You have been promoted to moderator!"), 8);
            broadcastWait(10);
        }
        else if(vars::broadcast.size() > 0) { //Or just draw a broadcast to the screen if there is one being sent.
            curs_set(0);
            broadcast(vars::broadcast, 6);
            vars::broadcast.clear();
            broadcastWait(10);
        }
        else {
            parseInput();
            refresh();
        }
        vars::previousState = vars::userList.at(vars::yourself).stat;
    }
    endwin();
    return 0;
}
示例#16
0
FTNoIR_Filter::FTNoIR_Filter()
{
    first_run = true;
    alpha_smoothing = 0.02f;  // this is a constant for now, might be a parameter later
    loadSettings();  // Load the Settings
}
示例#17
0
void Application::createQmlApp()
{
    loadSettings();

    engine.addImportPath("qrc:/qml/");

    connect(HardwareUtils::Instance(), SIGNAL(networkStatusChanged()),
            this, SLOT(networkStatusChanged()));
    connect(HardwareUtils::Instance(), SIGNAL(calaosServerDetected()),
            this, SLOT(calaosServerDetected()));

    connect(HardwareUtils::Instance(), &HardwareUtils::applicationWillResignActive, [=]()
    {
        qDebug() << "Application is in background, logout";
        startedWithOptHandled = false;
        logout();
    });

    connect(HardwareUtils::Instance(), &HardwareUtils::applicationBecomeActive, [=]()
    {
        qDebug() << "Application is in foreground, login again";
        QTimer::singleShot(0, [=]()
        {
            login(get_username(), get_password(), get_hostname());
        });
    });

    Common::registerQml();

#ifdef Q_OS_ANDROID
    QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
    QAndroidJniObject resource = activity.callObjectMethod("getResources","()Landroid/content/res/Resources;");
    QAndroidJniObject metrics = resource.callObjectMethod("getDisplayMetrics","()Landroid/util/DisplayMetrics;");
    update_density(metrics.getField<float>("density"));

    update_needBackButton(false);
    // Need to fix a bug on Android where text is scratched at runtime on some devices
    qputenv("QML_USE_GLYPHCACHE_WORKAROUND", QByteArray("1"));

    update_isAndroid(true);
    update_isIOS(false);
    update_isDesktop(false);
#else
    if (arguments().contains("--force-hdpi"))
        update_density(2.0);
    else
        update_density(1.0);

    update_needBackButton(true);

#ifdef Q_OS_IOS
    update_isAndroid(false);
    update_isIOS(true);
    update_isDesktop(false);
#else
    update_isAndroid(false);
    update_isIOS(false);
    update_isDesktop(true);
#endif
#endif

    update_applicationStatus(Common::NotConnected);

    calaosConnect = new CalaosConnection(this);
    connect(calaosConnect, SIGNAL(homeLoaded(QVariantMap)),
            this, SLOT(homeLoaded(QVariantMap)));
    connect(calaosConnect, SIGNAL(loginFailed()),
            this, SLOT(loginFailed()));
    connect(calaosConnect, &CalaosConnection::disconnected, [=]()
    {
        update_applicationStatus(Common::NotConnected);

#ifdef CALAOS_DESKTOP
        HardwareUtils::Instance()->showAlertMessage(tr("Network error"),
                                                    tr("The connection to calaos_server was lost."
                                                       "It will reconnect automatically when calaos_server"
                                                       "is available again."),
                                                    tr("Close"));

        //restart autologin, only on desktop to continually try to connect
        QTimer::singleShot(1000, [=]()
        {
            //reload settings in case it was changed
            loadSettings();
            login(get_username(), get_password(), get_hostname());
        });
#endif
    });

    scenarioModel = new ScenarioModel(&engine, calaosConnect, this);
    scenarioSortModel = new ScenarioSortModel(&engine, this);
    scenarioSortModel->setSourceModel(scenarioModel);
    engine.rootContext()->setContextProperty("scenarioModel", scenarioSortModel);
    lightOnModel = new LightOnModel(&engine, calaosConnect, this);
    engine.rootContext()->setContextProperty("lightOnModel", lightOnModel);
    homeModel = new HomeModel(&engine, calaosConnect, scenarioModel, lightOnModel, this);
    engine.rootContext()->setContextProperty("homeModel", homeModel);
    audioModel = new AudioModel(&engine, calaosConnect, this);
    engine.rootContext()->setContextProperty("audioModel", audioModel);
    favModel = new FavoritesModel(&engine, calaosConnect, this);
    engine.rootContext()->setContextProperty("favoritesModel", favModel);
    favHomeModel = new HomeFavModel(&engine, calaosConnect, this);
    engine.rootContext()->setContextProperty("favoritesHomeModel", favHomeModel);
    cameraModel = new CameraModel(&engine, calaosConnect);
    engine.rootContext()->setContextProperty("cameraModel", cameraModel);

#ifdef CALAOS_DESKTOP
    CalaosWidgetModel::Instance()->loadFromDisk();
    engine.rootContext()->setContextProperty("widgetsModel", CalaosWidgetModel::Instance());
#endif

    engine.rootContext()->setContextProperty("calaosApp", this);

    //Register Units singleton
    //qmlRegisterSingletonType(QUrl("qrc:/qml/Units.qml"), "Units", 1, 0, "Units");

    qmlRegisterType<RoomFilterModel>("Calaos", 1, 0, "RoomFilterModel");

#if defined(CALAOS_MOBILE)
    engine.load(QUrl(QStringLiteral("qrc:///qml/mobile/main.qml")));
#elif defined(CALAOS_DESKTOP)
    engine.load(QUrl(QStringLiteral("qrc:///qml/desktop/main.qml")));
#else
#error "Unknown UI type!"
#endif

#ifndef CALAOS_DESKTOP
    //Start autologin, only on mobile. On desktop we wait for calaos_server detection
    QTimer::singleShot(100, [=]()
    {
        login(get_username(), get_password(), get_hostname());
    });
#endif
}
/** constructor **/
FTNoIR_Protocol::FTNoIR_Protocol()
{
	blnConnectionActive = false;
	hMainWindow = NULL;
	loadSettings();
}
示例#19
0
SettingsWindow::SettingsWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::SettingsWindow)
{
    ui->setupUi(this);

#ifdef Q_OS_MAC
    QFont smallFont = ui->labelGlobal->font();
    smallFont.setPointSize(smallFont.pointSize()-1);
    ui->labelGlobal->setFont(smallFont);
    ui->label_44->setFont(smallFont);
    ui->label_45->setFont(smallFont);
    ui->label_46->setFont(smallFont);
    ui->label_47->setFont(smallFont);
    ui->label_48->setFont(smallFont);
    ui->label_49->setFont(smallFont);
    ui->label_7->setFont(smallFont);
    ui->label_18->setFont(smallFont);
#endif

    ui->customScraperTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
    ui->customScraperTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
    ui->customScraperTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    ui->actionGlobal->setIcon(ui->actionGlobal->property("iconActive").value<QIcon>());
    ui->stackedWidget->setCurrentIndex(0);
    ui->stackedWidget->setAnimation(QEasingCurve::Linear);
    ui->stackedWidget->setSpeed(200);

    m_settings = Settings::instance(this);

    ui->xbmcPort->setValidator(new QIntValidator(0, 99999, ui->xbmcPort));
    ui->dirs->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->dirs->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
    ui->exportTemplates->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    int scraperCounter = 0;
    foreach (ScraperInterface *scraper, Manager::instance()->scrapers()) {
        if (scraper->hasSettings()) {
            QLabel *name = new QLabel("<b>" + scraper->name() + "</b>");
            name->setAlignment(Qt::AlignRight);
            name->setStyleSheet("margin-top: 3px;");
            ui->gridLayoutScrapers->addWidget(name, scraperCounter, 0);
            ui->gridLayoutScrapers->addWidget(scraper->settingsWidget(), scraperCounter, 1);
            m_scraperRows.insert(scraper, scraperCounter);
            scraperCounter++;
        }
    }
    foreach (TvScraperInterface *scraper, Manager::instance()->tvScrapers()) {
        if (scraper->hasSettings()) {
            QLabel *name = new QLabel("<b>" + scraper->name() + "</b>");
            name->setAlignment(Qt::AlignRight);
            name->setStyleSheet("margin-top: 3px;");
            ui->gridLayoutScrapers->addWidget(name, scraperCounter, 0);
            ui->gridLayoutScrapers->addWidget(scraper->settingsWidget(), scraperCounter, 1);
            scraperCounter++;
        }
    }
    foreach (ConcertScraperInterface *scraper, Manager::instance()->concertScrapers()) {
        if (scraper->hasSettings()) {
            QLabel *name = new QLabel("<b>" + scraper->name() + "</b>");
            name->setAlignment(Qt::AlignRight);
            name->setStyleSheet("margin-top: 3px;");
            ui->gridLayoutScrapers->addWidget(name, scraperCounter, 0);
            ui->gridLayoutScrapers->addWidget(scraper->settingsWidget(), scraperCounter, 1);
            scraperCounter++;
        }
    }

    foreach (ImageProviderInterface *scraper, Manager::instance()->imageProviders()) {
        if (scraper->hasSettings()) {
            QLabel *name = new QLabel("<b>" + scraper->name() + "</b>");
            name->setAlignment(Qt::AlignRight);
            name->setStyleSheet("margin-top: 3px;");
            ui->gridLayoutScrapers->addWidget(name, scraperCounter, 0);
            ui->gridLayoutScrapers->addWidget(scraper->settingsWidget(), scraperCounter, 1);
            scraperCounter++;
        }
    }

    ui->comboMovieSetArtwork->setItemData(0, MovieSetArtworkSingleSetFolder);
    ui->comboMovieSetArtwork->setItemData(1, MovieSetArtworkSingleArtworkFolder);

    connect(ui->buttonAddDir, SIGNAL(clicked()), this, SLOT(chooseDirToAdd()));
    connect(ui->buttonRemoveDir, SIGNAL(clicked()), this, SLOT(removeDir()));
    connect(ui->buttonMovieFilesToDirs, SIGNAL(clicked()), this, SLOT(organize()));
    connect(ui->dirs, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(dirListRowChanged(int)));
    connect(ui->comboMovieSetArtwork, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboMovieSetArtworkChanged()));
    connect(ui->btnMovieSetArtworkDir, SIGNAL(clicked()), this, SLOT(onChooseMovieSetArtworkDir()));
    connect(ui->chkUseProxy, SIGNAL(clicked()), this, SLOT(onUseProxy()));
    connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(onCancel()));
    connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(onSave()));
    connect(ExportTemplateLoader::instance(this), SIGNAL(sigTemplatesLoaded(QList<ExportTemplate*>)), this, SLOT(onTemplatesLoaded(QList<ExportTemplate*>)));
    connect(ExportTemplateLoader::instance(this), SIGNAL(sigTemplateInstalled(ExportTemplate*,bool)), this, SLOT(onTemplateInstalled(ExportTemplate*,bool)));
    connect(ExportTemplateLoader::instance(this), SIGNAL(sigTemplateUninstalled(ExportTemplate*,bool)), this, SLOT(onTemplateUninstalled(ExportTemplate*,bool)));
    connect(ui->btnChooseUnrar, SIGNAL(clicked()), this, SLOT(onChooseUnrar()));
    connect(ui->btnChooseMakemkvcon, SIGNAL(clicked()), this, SLOT(onChooseMakeMkvCon()));
    connect(ui->chkEnableAdultScrapers, SIGNAL(clicked()), this, SLOT(onShowAdultScrapers()));

    ui->movieNfo->setProperty("dataFileType", DataFileType::MovieNfo);
    ui->moviePoster->setProperty("dataFileType", DataFileType::MoviePoster);
    ui->movieBackdrop->setProperty("dataFileType", DataFileType::MovieBackdrop);
    ui->movieCdArt->setProperty("dataFileType", DataFileType::MovieCdArt);
    ui->movieClearArt->setProperty("dataFileType", DataFileType::MovieClearArt);
    ui->movieLogo->setProperty("dataFileType", DataFileType::MovieLogo);
    ui->movieBanner->setProperty("dataFileType", DataFileType::MovieBanner);
    ui->movieThumb->setProperty("dataFileType", DataFileType::MovieThumb);
    ui->movieSetPosterFileName->setProperty("dataFileType", DataFileType::MovieSetPoster);
    ui->movieSetFanartFileName->setProperty("dataFileType", DataFileType::MovieSetBackdrop);
    ui->showBackdrop->setProperty("dataFileType", DataFileType::TvShowBackdrop);
    ui->showBanner->setProperty("dataFileType", DataFileType::TvShowBanner);
    ui->showCharacterArt->setProperty("dataFileType", DataFileType::TvShowCharacterArt);
    ui->showClearArt->setProperty("dataFileType", DataFileType::TvShowClearArt);
    ui->showEpisodeNfo->setProperty("dataFileType", DataFileType::TvShowEpisodeNfo);
    ui->showEpisodeThumbnail->setProperty("dataFileType", DataFileType::TvShowEpisodeThumb);
    ui->showLogo->setProperty("dataFileType", DataFileType::TvShowLogo);
    ui->showThumb->setProperty("dataFileType", DataFileType::TvShowThumb);
    ui->showNfo->setProperty("dataFileType", DataFileType::TvShowNfo);
    ui->showPoster->setProperty("dataFileType", DataFileType::TvShowPoster);
    ui->showSeasonBackdrop->setProperty("dataFileType", DataFileType::TvShowSeasonBackdrop);
    ui->showSeasonBanner->setProperty("dataFileType", DataFileType::TvShowSeasonBanner);
    ui->showSeasonPoster->setProperty("dataFileType", DataFileType::TvShowSeasonPoster);
    ui->showSeasonThumb->setProperty("dataFileType", DataFileType::TvShowSeasonThumb);
    ui->concertNfo->setProperty("dataFileType", DataFileType::ConcertNfo);
    ui->concertPoster->setProperty("dataFileType", DataFileType::ConcertPoster);
    ui->concertBackdrop->setProperty("dataFileType", DataFileType::ConcertBackdrop);
    ui->concertLogo->setProperty("dataFileType", DataFileType::ConcertLogo);
    ui->concertClearArt->setProperty("dataFileType", DataFileType::ConcertClearArt);
    ui->concertDiscArt->setProperty("dataFileType", DataFileType::ConcertCdArt);

#ifdef Q_OS_MAC
    ui->btnCancel->setVisible(false);
    ui->btnSave->setVisible(false);
    ui->horizontalSpacerButtons->setGeometry(QRect(0, 0, 1, 1));
#endif

    ui->comboStartupSection->addItem(tr("Movies"), "movies");
    ui->comboStartupSection->addItem(tr("TV Shows"), "tvshows");
    ui->comboStartupSection->addItem(tr("Concerts"), "concerts");
    ui->comboStartupSection->addItem(tr("Import"), "import");

    loadSettings();
}
示例#20
0
//--------------------------------------------------------------
bool Global::setup(const int numOutChannels, const int numInChannels,
				    const int sampleRate, const int ticksPerBuffer) {
	
	// set dataPath here since it will change a scene is loaded
	dataPath = ofToDataPath("", true);
	
	// settings path: ~/.robotcowboy
	#ifndef TARGET_OF_IPHONE
		ofDirectory settingsDir(ofFilePath::join(ofFilePath::getUserHomeDir(), ".robotcowboy"));
	#else
		ofDirectory settingsDir("Documents"); // should be relative to app root
	#endif
	if(!settingsDir.exists()) {
		ofLogNotice() << "Global: settings directory dosen't exist, creating ...";
		if(!settingsDir.create()) {
			ofLogError() << "Global: couldn't create settings directory";
			return false;
		}
	}
	else if(!settingsDir.isDirectory()) {
		ofLogError() << "Global: settings location is not a directory";
		return false;
	}
	settingsPath = settingsDir.path();
	
	// settings file: ~/.robotcowboy/settings.lua
	ofFile settingsFile(ofFilePath::join(settingsDir.path(), "settings.lua"));
	if(!settingsFile.exists()) {
		// copy defaults file
		if(!ofFile::copyFromTo(ofFilePath::join(dataPath, "defaults.lua"), // src
						   settingsFile.path(), // dest
						   false, false)) { // not relative to data, don't overwrite
			ofLogError() << "Global: couldn't copy default settings file";
			return false;
		}
	}
	
	// load settings
	if(!loadSettings(settingsFile.path())) {
		// bail if problem loading settings
		return false;
	}
	
	// documents & scene paths
	#ifndef TARGET_OF_IPHONE
		// set absolute paths from given realitve paths
		if(!ofFilePath::isAbsolute(docsPath)) {
			docsPath = ofFilePath::join(ofFilePath::getUserHomeDir(), docsPath); 
		}
		if(!ofFilePath::isAbsolute(scenePath)) {
			scenePath = ofFilePath::join(docsPath, scenePath);
		}
	#else
		// these are hardcoded on iOS since the dirs will not change
		docsPath = "Documents";
		scenePath = "Documents/scenes";
	#endif
	ofDirectory docsDir(docsPath);
	if(!docsDir.exists()) {
		ofLogNotice() << "Global: document directory doesn't exist, creating ...";
		if(!docsDir.create()) {
			ofLogError() << "Global: couldn't create documents directory";
			return false;
		}
	}
	ofDirectory sceneDir(scenePath);
	if(!sceneDir.exists()) {
		ofLogNotice() << "Global: scene directory doesn't exist, creating ...";
		if(!sceneDir.create()) {
			ofLogError() << "Global: couldn't create scene directory";
			return false;
		}
	}
	
	print();
	
	// setup modules
	audioEngine.setup(numOutChannels, numInChannels,
					  sampleRate, ticksPerBuffer);
	
	scriptEngine.setup();
	scriptEngine.bootScript = ofFilePath::join(dataPath, "boot.lua");
	
	osc.setup();
	midi.setup();
	physics.setup();
	gui.setup();
	
	return true;
}
示例#21
0
MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent)
    : QMainWindow(parent),
    ui(new Ui::MainWindow),
    fetcher(new Fetcher),
    local(new LocalFetcher),
    source(IMAGE_SOURCE_UNKNOWN)
{
    ui->setupUi(this);

    QStringList  sources;
    sources.append("Google");
    sources.append("Local file");
//    sources.append("Picsearch");
    ui->cbSource->addItems(sources);
    ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE);

    fetcher->hide();
    local->hide();

    ui->menuFile->addAction(actionNewTab);
    ui->menuFile->addAction(actionLoadSession);
    ui->menuFile->addAction(actionSaveSession);
    ui->menuFile->addAction(actionQuit);
    ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen);

    ui->tbFullScreen->setDefaultAction(actionFullscreen);
    ui->tbNewTab->setDefaultAction(actionNewTab);
    ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms);
    ui->tbSave->setDefaultAction(actionSaveSession);

    ui->glTools->addWidget(fetcher,0,6,2,1);
    ui->glTools->addWidget(local,0,6,2,1);

    updateSource();

    connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource()));

    ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab);
    QList<QKeySequence> keys;
    keys << Qt::Key_Delete << Qt::Key_Backspace;
    ui->actionDeleteSelected->setShortcuts(keys);
    // These are necessary if the actions are to remain accessible when the menubar is hidden:
    this->addAction(ui->actionViewOnlyMode);
    this->addAction(ui->actionResetTransforms);
    this->addAction(ui->actionZoomToFit);
    this->addAction(ui->actionIntroduction);
    this->addAction(ui->actionTips);
    this->addAction(ui->actionOpenDirectory);
    this->addAction(ui->actionOpenFile);

    this->addAction(ui->actionDeleteSelected);
    this->addAction(ui->actionUncropSelected);
    this->addAction(ui->actionCentreInView);
    this->addAction(ui->actionResetRotation);
    this->addAction(ui->actionResetScale);
    this->addAction(ui->actionScaleToFit);

    this->addAction(actionFullscreen);
    this->addAction(actionLoadSession);
    this->addAction(actionSaveSession);
    this->addAction(actionNewTab);
    this->addAction(actionQuit);

    connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp()));
    connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips()));
    connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool)));
    connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences()));

    connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));
    connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));

    initBlacklistDocker();
    initInfoDocker();

    initView(parent);
    dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY);
    dlMgr = new QNetworkAccessManager(this);


    connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms()));
    connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit()));
    connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory()));
    connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile()));

    connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected()));
    connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected()));
    connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection()));
    connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation()));
    connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale()));
    connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit()));

    ui->verticalLayout->removeWidget(ui->toolWidget);
    ui->toolBar->addWidget(ui->toolWidget);
    setCentralWidget(gvMain);
    ui->thumbBar->addWidget(gvCarousel);

    ui->statusBar->addWidget(fetcher->getStatusText(),0);
    ui->statusBar->addWidget(fetcher->getProgressBar(),1);

    connect(this,SIGNAL(settingsChanged()),this,SLOT(loadSettings()));
    loadSettings();
}
示例#22
0
PeerListWidget::PeerListWidget(PropertiesWidget *parent):
  QTreeView(parent), m_properties(parent), m_displayFlags(false)
{
  // Load settings
  loadSettings();
  // Visual settings
  setUniformRowHeights(true);
  setRootIsDecorated(false);
  setItemsExpandable(false);
  setAllColumnsShowFocus(true);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  // List Model
  m_listModel = new QStandardItemModel(0, PeerListDelegate::COL_COUNT);
  m_listModel->setHeaderData(PeerListDelegate::COUNTRY, Qt::Horizontal, QVariant()); // Country flag column
  m_listModel->setHeaderData(PeerListDelegate::IP, Qt::Horizontal, tr("IP"));
  m_listModel->setHeaderData(PeerListDelegate::PORT, Qt::Horizontal, tr("Port"));
  m_listModel->setHeaderData(PeerListDelegate::FLAGS, Qt::Horizontal, tr("Flags"));
  m_listModel->setHeaderData(PeerListDelegate::CONNECTION, Qt::Horizontal, tr("Connection"));
  m_listModel->setHeaderData(PeerListDelegate::CLIENT, Qt::Horizontal, tr("Client", "i.e.: Client application"));
  m_listModel->setHeaderData(PeerListDelegate::PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
  m_listModel->setHeaderData(PeerListDelegate::DOWN_SPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed"));
  m_listModel->setHeaderData(PeerListDelegate::UP_SPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed"));
  m_listModel->setHeaderData(PeerListDelegate::TOT_DOWN, Qt::Horizontal, tr("Downloaded", "i.e: total data downloaded"));
  m_listModel->setHeaderData(PeerListDelegate::TOT_UP, Qt::Horizontal, tr("Uploaded", "i.e: total data uploaded"));
  m_listModel->setHeaderData(PeerListDelegate::RELEVANCE, Qt::Horizontal, tr("Relevance", "i.e: How relevant this peer is to us. How many pieces it has that we don't."));
  // Proxy model to support sorting without actually altering the underlying model
  m_proxyModel = new PeerListSortModel();
  m_proxyModel->setDynamicSortFilter(true);
  m_proxyModel->setSourceModel(m_listModel);
  m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
  setModel(m_proxyModel);
  //Explicitly set the column visibility. When columns are added/removed
  //between versions this prevents some of them being hidden due to
  //incorrect restoreState() being used.
  for (unsigned int i=0; i<PeerListDelegate::IP_HIDDEN; i++)
    showColumn(i);
  hideColumn(PeerListDelegate::IP_HIDDEN);
  hideColumn(PeerListDelegate::COL_COUNT);
  if (!Preferences::instance()->resolvePeerCountries())
    hideColumn(PeerListDelegate::COUNTRY);
  //To also mitigate the above issue, we have to resize each column when
  //its size is 0, because explicitly 'showing' the column isn't enough
  //in the above scenario.
  for (unsigned int i=0; i<PeerListDelegate::IP_HIDDEN; i++)
    if (!columnWidth(i))
      resizeColumnToContents(i);
  // Context menu
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showPeerListMenu(QPoint)));
  // List delegate
  m_listDelegate = new PeerListDelegate(this);
  setItemDelegate(m_listDelegate);
  // Enable sorting
  setSortingEnabled(true);
  // IP to Hostname resolver
  updatePeerHostNameResolutionState();
  // SIGNAL/SLOT
  connect(header(), SIGNAL(sectionClicked(int)), SLOT(handleSortColumnChanged(int)));
  handleSortColumnChanged(header()->sortIndicatorSection());
  copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copySelectedPeers()), 0, Qt::WidgetShortcut);
}
示例#23
0
//--------------------------------------------------------------------
bool ofVideoGrabber::initGrabber(int w, int h, bool setUseTexture){

	bUseTexture = setUseTexture;

	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_QUICKTIME
	//---------------------------------

		//---------------------------------- 1 - open the sequence grabber
		if( !qtInitSeqGrabber() ){
			ofLog(OF_LOG_ERROR, "error: unable to initialize the seq grabber");
			return false;
		}

		//---------------------------------- 2 - set the dimensions
		width 		= w;
		height 		= h;

		MacSetRect(&videoRect, 0, 0, width, height);

		//---------------------------------- 3 - buffer allocation
		// Create a buffer big enough to hold the video data,
		// make sure the pointer is 32-byte aligned.
		// also the rgb image that people will grab

		offscreenGWorldPixels 	= (unsigned char*)malloc(4 * width * height + 32);
		pixels					= new unsigned char[width*height*3];
		QTNewGWorldFromPtr (&videogworld, k32ARGBPixelFormat, &videoRect, NULL, NULL, 0, offscreenGWorldPixels, 4 * width);
		LockPixels(GetGWorldPixMap(videogworld));
		SetGWorld (videogworld, NULL);
		SGSetGWorld(gSeqGrabber, videogworld, nil);


		//---------------------------------- 4 - device selection
		bool didWeChooseADevice = bChooseDevice;
		bool deviceIsSelected	=  false;

		//if we have a device selected then try first to setup
		//that device
		if(didWeChooseADevice){
			deviceIsSelected = qtSelectDevice(deviceID, true);
			if(!deviceIsSelected && bVerbose) ofLog(OF_LOG_WARNING, "unable to open device[%i] - will attempt other devices", deviceID);
		}

		//if we couldn't select our required device
		//or we aren't specifiying a device to setup
		//then lets try to setup ANY device!
		if(deviceIsSelected == false){
			//lets list available devices
			listDevices();

			setDeviceID(0);
			deviceIsSelected = qtSelectDevice(deviceID, false);
		}

		//if we still haven't been able to setup a device
		//we should error and stop!
		if( deviceIsSelected == false){
			goto bail;
		}

		//---------------------------------- 5 - final initialization steps
		OSStatus err;

	 	err = SGSetChannelUsage(gVideoChannel,seqGrabPreview);
		if ( err != noErr ) goto bail;

		err = SGSetChannelBounds(gVideoChannel, &videoRect);
		if ( err != noErr ) goto bail;

		err = SGPrepare(gSeqGrabber,  true, false); //theo swapped so preview is true and capture is false
		if ( err != noErr ) goto bail;

		err = SGStartPreview(gSeqGrabber);
		if ( err != noErr ) goto bail;

		bGrabberInited = true;
		loadSettings();

		ofLog(OF_LOG_NOTICE,"end setup ofVideoGrabber");
		ofLog(OF_LOG_NOTICE,"-------------------------------------\n");


		//---------------------------------- 6 - setup texture if needed

		if (bUseTexture){
			// create the texture, set the pixels to black and
			// upload them to the texture (so at least we see nothing black the callback)
			tex.allocate(width,height,GL_RGB);
			memset(pixels, 0, width*height*3);
			tex.loadData(pixels, width, height, GL_RGB);
		}

		// we are done
		return true;


		//--------------------- (bail) something's wrong -----
		bail:

			ofLog(OF_LOG_ERROR, "***** ofVideoGrabber error *****");
			ofLog(OF_LOG_ERROR, "-------------------------------------\n");

			//if we don't close this - it messes up the next device!
			if(bSgInited) qtCloseSeqGrabber();

			bGrabberInited = false;
			return false;

	//---------------------------------
	#endif
	//---------------------------------


	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_DIRECTSHOW
	//---------------------------------
			//printf("ofVideoGrabber.bChooseDevice: %s",bChooseDevice ? "true" : "false");
		if (bChooseDevice){
			device = deviceID;
			ofLog(OF_LOG_NOTICE, "choosing %i", deviceID);
		} else {
			device = 0;
		}

		width = w;
		height = h;
		bGrabberInited = false;

		bool bOk = VI.setupDevice(device, width, height);

		int ourRequestedWidth = width;
		int ourRequestedHeight = height;
		std::cout << "ourRequestedWidth :"<< width<<std::endl;
		std::cout << "bOk :"<< bOk<<std::endl;
		

		if (bOk == true){
			bGrabberInited = true;
			width 	= VI.getWidth(device);
			height 	= VI.getHeight(device);

			if (width == ourRequestedWidth && height == ourRequestedHeight){
				bDoWeNeedToResize = false;
			} else {
				bDoWeNeedToResize = true;
				width = ourRequestedWidth;
				height = ourRequestedHeight;
			}

			std::cout << "ourRequestedWidth :"<< width<<std::endl;

			pixels	= new unsigned char[width * height * 3];

			if (bUseTexture){
				// create the texture, set the pixels to black and
				// upload them to the texture (so at least we see nothing black the callback)
				tex.allocate(width,height,GL_RGB);
				memset(pixels, 0, width*height*3);
				tex.loadData(pixels, width, height, GL_RGB);
			}

			return true;
		} else {
			ofLog(OF_LOG_ERROR, "error allocating a video device");
			ofLog(OF_LOG_ERROR, "please check your camera with AMCAP or other software");
			bGrabberInited = false;
			return false;
		}

	//---------------------------------
	#endif
	//---------------------------------



	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_UNICAP
	//--------------------------------
		if( !bGrabberInited ){
			if ( !bChooseDevice ){
				deviceID = 0;
			}

			width 	= w;
			height 	= h;
			pixels	= new unsigned char[width * height * 3];

			if (bUseTexture){
				// create the texture, set the pixels to black and
				// upload them to the texture (so at least we see nothing black the callback)
				tex.allocate(width,height,GL_RGB);
				memset(pixels, 0, width*height*3);
				tex.loadData(pixels, width, height, GL_RGB);
			}

			bGrabberInited = ucGrabber.open_device (deviceID);
			if( bGrabberInited ){
			ofLog(OF_LOG_NOTICE, "choosing device %i: %s", deviceID,ucGrabber.device_identifier());
				ucGrabber.set_format(w,h);
				ucGrabber.start_capture();
			}

		}
			return bGrabberInited;
	//---------------------------------
	#endif
	//---------------------------------


	//---------------------------------
	#ifdef OF_VIDEO_CAPTURE_V4L
	//--------------------------------
		if (bChooseDevice){
			device = deviceID;
		} else {
			device = 0;
		}
		sprintf(dev_name, "/dev/video%i", device);
		ofLog(OF_LOG_NOTICE, "choosing device "+dev_name+"");

		bool bOk = initV4L(w, h, dev_name);

		if (bOk == true){
			bV4LGrabberInited = true;
			width 	= getV4L_Width();
			height 	= getV4L_Height();
			pixels	= new unsigned char[width * height * 3];

			if (bUseTexture){
				// create the texture, set the pixels to black and
				// upload them to the texture (so at least we see nothing black the callback)
				tex.allocate(width,height,GL_RGB);
				//memset(pixels, 0, width*height*3);
				//tex.loadData(pixels, width, height, GL_RGB);
			}

			ofLog(OF_LOG_NOTICE, "success allocating a video device ");
			return true;
		} else {
			ofLog(OF_LOG_ERROR, "error allocating a video device");
			ofLog(OF_LOG_ERROR, "please check your camera and verify that your driver is correctly installed.");
			return false;
		}	//---------------------------------


	//---------------------------------
	#endif
	//---------------------------------



}
示例#24
0
/*
 * a cancel button has been pressed on the preference pages  
 */
void MainWindow::slot_cancelPressed()
{
	loadSettings();
}
示例#25
0
SettingsDialog::SettingsDialog(QWidget *parent = 0) : QDialog(parent)
{
    ui.setupUi(this);
    
    loadSettings();
}
// override show event
void TrackerControls::showEvent ( QShowEvent * event ) {
	prev_state = -1;
	loadSettings();
}
示例#27
0
QzSettings::QzSettings()
{
    loadSettings();
}
示例#28
0
int main(int argc, char *argv[])
{
	#ifdef PSPSDK
		pspDebugScreenInit();
		SetupCallbacks();
	#else
		// Shut down the server if we get a kill signal.
		signal( SIGINT, (sighandler_t) shutdownServer );
		signal( SIGTERM, (sighandler_t) shutdownServer );
	#endif

	/* Setup Data-Directory */
	dataDir = CBuffer(argv[0]).replaceAll("\\", "/");
	dataDir = dataDir.copy(0, dataDir.findl('/') + 1);
	programDir = dataDir;
	dataDir << "world/";

	/* Main Initiating */
	adminNames.load( __admin, sizeof(__admin) / sizeof(const char*) );
	colourNames.load( __colours, sizeof(__colours) / sizeof(const char*) );
	clothCommands.load( __cloths, sizeof(__cloths) / sizeof(const char*) );
	defaultGaniNames.load( __defaultgani, sizeof(__defaultgani) / sizeof(const char*) );
	defaultSwordNames.load( __defaultsword, sizeof(__defaultsword) / sizeof(const char*) );
	defaultShieldNames.load( __defaultshield, sizeof(__defaultshield) / sizeof(const char*) );
	playerIds.add(0);
	playerIds.add(0);
	npcIds.add(0);
	srand((int)time(NULL));

	/* Load Important Files */
	updateFile("rchelp.txt");
	updateFile("rcmessage.txt");
	updateFile("rules.txt");
	updateFile("serverflags.txt");
	updateFile("servermessage.html");
	updateFile("foldersconfig.txt");

	/* Load Settings */
	if (!loadSettings("serveroptions.txt"))
	{
		errorOut("errorlog.txt", "Unable to load server settings..");
		return 1;
	}

	/* Load Weapons */
	if (!loadWeapons("weapons.txt"))
	{
		errorOut("errorlog.txt", "Unable to load weapons from weapons.txt..");
		return 1;
	}

	/* Initialize Sockets */
	if (CSocket::sockStart() != 0)
		return 1;

	if(!serverSock.listenSock(serverPort, 20))
	{
		errorOut("errorlog.txt", CString() << "SOCK ERROR: Unable to listen on port: " << toString(serverPort));
		return 1;
	}
	serverSock.setSync(false);

	/* Server Finished Loading */
	printf("GServer 2 by 39ster\nSpecial thanks to Marlon, Agret, Pac300, 39ster and others for porting the \noriginal 1.39 gserver to 2.1\nServer listening on port: %i\nServer version: Build %s\n\n", serverPort, listServerFields[3].text());
	errorOut("serverlog.txt", "Server started");

	if ( listServerFields[5] == "localhost" )
        errorOut("serverlog.txt", "[DEBUG_LOCALHOSTMODE] Localhost mode is activated.\nListserver communication & account authentication are disabled.", true);

	serverRunning = true;

	if ( !(listServerFields[5] == "localhost") )
		if (!lsConnected)
			ListServer_Connect();

	while (serverRunning)
	{
		long long second = time(NULL);

		while (second == time(NULL))
		{
			acceptNewPlayers(serverSock);
			for (int i = 0; i < newPlayers.count(); i ++)
			{
				CPlayer* player = (CPlayer*)newPlayers[i];
				player->main();
				if (player->deleteMe)
				{
					delete player;
					i--;
				}
			}

			for(int i = 0; i < playerList.count(); i++)
			{
				CPlayer* player = (CPlayer*)playerList[i];
				player->main();
				if(player->deleteMe)
				{
					delete player;
					i--;
				}
			}

			// Was moved so it can process faster. - Joey
			ListServer_Main();
			wait(100);
		}

		doTimer();
		gameTime ++;
		NOLEVEL->reset();

		// Every 30 seconds
		if (gameTime % 30 == 0)
		{
			ListServer_Send(CPacket() << (char)SLSPING);
		}

		// Every 10 seconds
		if (gameTime % 10 == 0)
		{
			CPacket pPacket;
			CString file;

			for (int i = 0; i < playerList.count(); i++)
			{
				CPlayer *player = (CPlayer *)playerList[i];
				file << player->accountName << "," << player->nickName << "," << player->levelName << "," << toString(player->x) << "," << toString(player->y) << "," << toString(player->ap) << "\n";
			}

			file.save("logs/playerlist.txt");
			serverFlags.save("serverflags.txt");
		}

		//Every 5 seconds?
		int current = getNWTime();
		if (nwTime != current)
		{
			nwTime = current;
			for (int i = 0; i < playerList.count(); i++)
			{
				CPacket out;
				out << (char)NEWWORLDTIME;
				out.writeByte4(current);
				((CPlayer*)playerList[i])->sendPacket(out);
			}
		}
	}
}
示例#29
0
文件: history.cpp 项目: Afreeca/qt
void HistoryManager::load()
{
    loadSettings();

    QFile historyFile(QDesktopServices::storageLocation(QDesktopServices::DataLocation)
        + QLatin1String("/history"));
    if (!historyFile.exists())
        return;
    if (!historyFile.open(QFile::ReadOnly)) {
        qWarning() << "Unable to open history file" << historyFile.fileName();
        return;
    }

    QList<HistoryItem> list;
    QDataStream in(&historyFile);
    // Double check that the history file is sorted as it is read in
    bool needToSort = false;
    HistoryItem lastInsertedItem;
    QByteArray data;
    QDataStream stream;
    QBuffer buffer;
    stream.setDevice(&buffer);
    while (!historyFile.atEnd()) {
        in >> data;
        buffer.close();
        buffer.setBuffer(&data);
        buffer.open(QIODevice::ReadOnly);
        quint32 ver;
        stream >> ver;
        if (ver != HISTORY_VERSION)
            continue;
        HistoryItem item;
        stream >> item.url;
        stream >> item.dateTime;
        stream >> item.title;

        if (!item.dateTime.isValid())
            continue;

        if (item == lastInsertedItem) {
            if (lastInsertedItem.title.isEmpty() && !list.isEmpty())
                list[0].title = item.title;
            continue;
        }

        if (!needToSort && !list.isEmpty() && lastInsertedItem < item)
            needToSort = true;

        list.prepend(item);
        lastInsertedItem = item;
    }
    if (needToSort)
        qSort(list.begin(), list.end());

    setHistory(list, true);

    // If we had to sort re-write the whole history sorted
    if (needToSort) {
        m_lastSavedUrl = QString();
        m_saveTimer->changeOccurred();
    }
}
示例#30
0
文件: fppd.c 项目: dkulp/fpp
int main(int argc, char *argv[])
{
#ifdef USECURL
	curl_global_init(CURL_GLOBAL_ALL);
#endif

	initSettings(argc, argv);
	initMediaDetails();

	if (DirectoryExists("/home/fpp"))
		loadSettings("/home/fpp/media/settings");
	else
		loadSettings("/home/pi/media/settings");

	// Parse our arguments first, override any defaults
	parseArguments(argc, argv);

	if (loggingToFile())
		logVersionInfo();

	printVersionInfo();

	// Start functioning
	if (getDaemonize())
		CreateDaemon();

	player = new Player();
	channelTester = new ChannelTester();

#ifndef NOROOT
	struct sched_param param;
	param.sched_priority = 99;
	if (sched_setscheduler(0, SCHED_FIFO, &param) != 0)
	{
		perror("sched_setscheduler");
		exit(EXIT_FAILURE);
	}
#endif

	player->MainLoop();

	if (getFPPmode() != BRIDGE_MODE)
	{
		CleanupMediaOutput();
	}

	if (getFPPmode() & PLAYER_MODE)
	{
		if (getFPPmode() == MASTER_MODE)
			ShutdownSync();

		CloseChannelDataMemoryMap();
		CloseEffects();
	}

	CloseChannelOutputs();

	delete channelTester;
	delete player;

	player = NULL;

	return 0;
}