PreferencesDialog::PreferencesDialog( QMenuBar* menuBar, QWidget* parent )
    :unicorn::MainWindow( menuBar, parent ),
    ui( new Ui::PreferencesDialog )
{
    // Disable the minimize and maximize buttons.
    Qt::WindowFlags flags = this->windowFlags();
    flags &= ~Qt::WindowMinMaxButtonsHint;
    setWindowFlags(flags);

    ui->setupUi( this );

    setAttribute( Qt::WA_DeleteOnClose, true );

    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionGeneral ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionScrobbling ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionDevices ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAccounts ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAdvanced ) )->setAutoExclusive( true );

    connect( ui->toolBar->widgetForAction( ui->actionGeneral ), SIGNAL(toggled(bool)), ui->actionGeneral, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionScrobbling ), SIGNAL(toggled(bool)), ui->actionScrobbling, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionDevices ), SIGNAL(toggled(bool)), ui->actionDevices, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionAccounts ), SIGNAL(toggled(bool)), ui->actionAccounts, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionAdvanced ), SIGNAL(toggled(bool)), ui->actionAdvanced, SLOT(setChecked(bool)) );

    connect( this, SIGNAL( saveNeeded() ), ui->general, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->scrobbling, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->ipod, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->accounts, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->advanced, SLOT( saveSettings() ) );

    connect( ui->general, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->scrobbling, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->ipod, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->accounts, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->advanced, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );

    connect( ui->actionGeneral, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionScrobbling, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionDevices, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionAccounts, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionAdvanced, SIGNAL(triggered()), SLOT(onTabButtonClicked()));

    connect( ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(onStackCurrentChanged(int)), Qt::QueuedConnection );

#ifdef Q_OS_MAC
    ui->buttonBox->hide();
#endif
    connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( onAccepted() ) );
    connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( onRejected() ) );

    QAbstractButton* applyButton = ui->buttonBox->button( QDialogButtonBox::Apply );
    applyButton->setEnabled( false );
    connect( applyButton, SIGNAL( clicked() ), SLOT( onApplyButtonClicked() ) );

    setFixedWidth( 550 );

    ui->stackedWidget->setCurrentWidget( ui->accounts );
    ui->actionGeneral->trigger();
}
Example #2
0
Kludget::Kludget(KClient *parent) :
        QObject(parent),
        client(parent),
        window(new KWindow),
        settings(new KSettings(this)),
        system(new KSystem(this)),
        prefWindow(0),
        aboutWindow(0),
        firstShow(true)
{
    setObjectName("Kludget");
    settings->setRootKey("kludget");

    connect(system, SIGNAL(execUpdate(long)), this, SLOT(onSystemExecUpdate(long)));
    connect(system, SIGNAL(execFinish(long)), this, SLOT(onSystemExecFinish(long)));

    connect(window, SIGNAL(destroyed()), this, SLOT(onWindowDestroyed()));
    connect(window, SIGNAL(onShow()), this, SLOT(onShow()));
    connect(window, SIGNAL(onHide()), this, SLOT(onHide()));
    connect(window, SIGNAL(onStartDrag()), this, SLOT(onStartDrag()));
    connect(window, SIGNAL(onEndDrag()), this, SLOT(onEndDrag()));
    connect(window, SIGNAL(onSettingsChanged()), this, SLOT(onSettingsChanged()));

    connect(window->view(), SIGNAL(contextMenuRequested()), this, SLOT(onContextMenu()));
    connect(window->view(), SIGNAL(urlReceived(const QUrl*)), this, SLOT(onUrlReceived(const QUrl*)));
    connect(window->view()->page(), SIGNAL(loadFinished(bool)), this, SLOT(show()));
    connect(window->view()->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared()));
    connect(window->view()->page(), SIGNAL(frameCreated(QWebFrame*)), this, SLOT(onFrameCreated(QWebFrame*)));

    connect(this, SIGNAL(evaluate(const QString &)), this, SLOT(onEvaluate(const QString &)));
    connect(&customMenuMapper, SIGNAL(mapped(const QString &)), this, SIGNAL(evaluate(const QString &)));

    connect(&ipcClient, SIGNAL(messageReceived(QString,QString,QString)), this, SLOT(messageReceived(QString,QString,QString)));
    KLog::log("Kludget::created");
}
Example #3
0
void Maemo5Settings::loadImpl()
{
	ui->ledPattern->addItem(QLatin1String("PatternError"));
	ui->ledPattern->addItem(QLatin1String("PatternDeviceOn"));
	ui->ledPattern->addItem(QLatin1String("PatternDeviceSoftOff"));
	ui->ledPattern->addItem(QLatin1String("PatternPowerOn"));
	ui->ledPattern->addItem(QLatin1String("PatternPowerOff"));
	ui->ledPattern->addItem(QLatin1String("PatternCommunicationCall"));
	ui->ledPattern->addItem(QLatin1String("PatternCommunicationIM"));
	ui->ledPattern->addItem(QLatin1String("PatternCommunicationSMS"));
	ui->ledPattern->addItem(QLatin1String("PatternCommunicationEmail"));
	ui->ledPattern->addItem(QLatin1String("PatternCommonNotification"));
	ui->ledPattern->addItem(QLatin1String("PatternWebcamActive"));
	ui->ledPattern->addItem(QLatin1String("PatternBatteryCharging"));
	ui->ledPattern->addItem(QLatin1String("PatternBatteryFull"));

	Config config = Config().group(QLatin1String("Maemo5"));

	int orientation = config.value(QLatin1String("orientation"),0);
	switch (orientation)
	{
	case 0:
		ui->autoOrientation->setChecked(true);
		break;
	case 1:
		ui->portrait->setChecked(true);
		break;
	case 2:
		ui->landscape->setChecked(true);
		break;
	}

	ui->displayOnLed->setChecked(config.value(QLatin1String("showLedWhenDisplayOn"),false));
	ui->displayOnVibration->setChecked(config.value(QLatin1String("vibrationWhenDisplayOn"),false));

	currentPattern = config.value(QLatin1String("ledPattern"),QLatin1String("PatternCommunicationIM"));
	int index = ui->ledPattern->findText(QLatin1String("PatternCommunicationIM"));
	ui->ledPattern->setCurrentIndex(index);

	ui->vibtarionTime->setValue(config.value(QLatin1String("vibrationTime"),50));
	ui->popupShowTime->setValue(config.value(QLatin1String("showPopupTime"),50));


	connect(ui->ledPattern,SIGNAL(currentIndexChanged(int)),SLOT(onSettingsChanged(int)));
	connect(ui->displayOnLed,SIGNAL(stateChanged(int)),SLOT(onSettingsChanged(int)));
	connect(ui->displayOnVibration,SIGNAL(stateChanged(int)),SLOT(onSettingsChanged(int)));
	connect(ui->vibtarionTime,SIGNAL(valueChanged(int)),SLOT(onSettingsChanged(int)));
	connect(ui->popupShowTime,SIGNAL(valueChanged(int)),SLOT(onSettingsChanged(int)));
	connect(ui->autoOrientation,SIGNAL(clicked()),SLOT(onSettingsChanged()));
	connect(ui->portrait,SIGNAL(clicked()),SLOT(onSettingsChanged()));
	connect(ui->landscape,SIGNAL(clicked()),SLOT(onSettingsChanged()));

}
Example #4
0
ScanManager::ScanManager( QObject* parent )
    : QObject( parent )
    , m_musicScannerThreadController( 0 )
    , m_currScannerPaths()
    , m_cachedScannerDirs()
    , m_queuedScanType( None )
    , m_updateGUI( true )
{
    s_instance = this;

    m_scanTimer = new QTimer( this );
    m_scanTimer->setSingleShot( false );
    m_scanTimer->setInterval( TomahawkSettings::instance()->scannerTime() * 1000 );

    connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( onSettingsChanged() ) );
    connect( m_scanTimer, SIGNAL( timeout() ), SLOT( scanTimerTimeout() ) );

    if ( TomahawkSettings::instance()->hasScannerPaths() )
    {
        m_cachedScannerDirs = TomahawkSettings::instance()->scannerPaths();
        m_scanTimer->start();
        if ( TomahawkSettings::instance()->watchForChanges() )
            QTimer::singleShot( 1000, this, SLOT( runStartupScan() ) );
    }
}
Harness::Harness(QObject *parent) : QObject(parent)
{
	settingsManager.loadSavedSettings();

	gui = new MainWindow;
	serialManager = new SerialManager;
	packetReceiver = new PacketReceiver;
	windDataAnalyzer = new WindDataAnalyzer;
	dataLogger = new DataLogger;
	systemTimer = new QTimer;
	batteryChargeCalculator = new BatteryChargeCalculator;
	loggingData = false;

	connect(serialManager, SIGNAL(onNewDataReady(QByteArray)), packetReceiver, SLOT(onNewDataReceived(QByteArray)));
	connect(serialManager, SIGNAL(serialPortError(QString)), this, SLOT(onSerialPortError(QString)));
	connect(packetReceiver, SIGNAL(validPacketReceived()), this, SLOT(onValidPacketReceived()));
	connect(packetReceiver, SIGNAL(invalidPacketReceived()), this, SLOT(onInvalidPacketReceived()));
	connect(gui, SIGNAL(connectSerialButtonClicked(QString)), this, SLOT(onConnectSerialButtonClicked(QString)));
	connect(gui, SIGNAL(saveDataLogButtonClicked()), this, SLOT(onSaveDataLogButtonClicked()));
	connect(gui, SIGNAL(startLoggingButtonClicked()), this, SLOT(onStartLoggingButtonClicked()));
	connect(gui, SIGNAL(clearLogButtonClicked()), this, SLOT(onClearLogButtonClicked()));
	connect(gui, SIGNAL(settingsChanged()), this, SLOT(onSettingsChanged()));
	connect(systemTimer, SIGNAL(timeout()), this, SLOT(onSystemTimerTimeout()));

	compassOffset = settingsManager.getSettings().compassOffset;
	loadGUIDefaultValues();
	gui->show();
	systemTimer->start(SYSTEM_TIMER_INTERVAL_MS);
}
Example #6
0
void Kludget::configure(QString cat)
{
    saveSettings();

    if (prefWindow)
    {
        prefWindow->raise();
        prefWindow->show();
        return ;
    }

    prefWindow = new PreferenceWindow(settings);
    prefWindow->setAttribute(Qt::WA_DeleteOnClose);
    prefWindow->setWindowTitle("Preferences - " + info.name);
    prefWindow->buildPreferenceMap(info.configFile);
    prefWindow->buildPreferenceMap(info.path + "/" + PREFERENCE_FILE);
#if defined(WIN32)

    prefWindow->buildPreferenceMap(":resources/xml/widgetPreferences.xml");
#else

    prefWindow->buildPreferenceMap(":resources/xml/widgetPreferences_linux.xml");
#endif

    prefWindow->setupUI();
    prefWindow->show();

    connect(prefWindow, SIGNAL(settingsChanged()), this, SLOT(onSettingsChanged()));
    connect(prefWindow, SIGNAL(destroyed()), this, SLOT(onPreferencesClosed()));
}
Example #7
0
ScanManager::ScanManager( QObject* parent )
    : QObject( parent )
    , m_musicScannerThreadController( 0 )
    , m_currScannerPaths()
    , m_dirWatcher( 0 )
    , m_queuedScanTimer( 0 )
    , m_deferredScanTimer( 0 )
    , m_queuedChangedDirs()
    , m_deferredDirs()
{
    s_instance = this;

    m_queuedScanTimer = new QTimer( this );
    m_queuedScanTimer->setSingleShot( true );
    m_deferredScanTimer = new QTimer( this );
    m_deferredScanTimer->setSingleShot( false );
    m_deferredScanTimer->setInterval( 1000 );
    m_dirWatcher = new QFileSystemWatcher( this );

    connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( onSettingsChanged() ) );
    connect( m_queuedScanTimer, SIGNAL( timeout() ), SLOT( queuedScanTimeout() ) );
    connect( m_deferredScanTimer, SIGNAL( timeout() ), SLOT( deferredScanTimeout() ) );
    connect( m_dirWatcher, SIGNAL( directoryChanged( const QString & ) ), SLOT( handleChangedDir( const QString & ) ) );

    if ( TomahawkSettings::instance()->hasScannerPaths() )
    {
        m_currScannerPaths = TomahawkSettings::instance()->scannerPaths();
        if ( TomahawkSettings::instance()->watchForChanges() )
            QTimer::singleShot( 1000, this, SLOT( runStartupScan() ) );
    }
    
    m_deferredScanTimer->start();
}
ByteArraySourceCodeStreamEncoderConfigEditor::ByteArraySourceCodeStreamEncoderConfigEditor( ByteArraySourceCodeStreamEncoder* encoder, QWidget* parent )
 : AbstractModelStreamEncoderConfigEditor( parent ),
   mEncoder( encoder )
{
    mSettings = mEncoder->settings();

    QFormLayout* pageLayout = new QFormLayout( this );
    pageLayout->setMargin( 0 );

    // variable name
    const QString variableNameLabel =
        i18nc( "@label:textbox name of the created variable",
               "Name of variable:" );

    mVariableNameEdit = new KLineEdit( this );
    mVariableNameEdit->setText( mSettings.variableName );
    connect( mVariableNameEdit, SIGNAL(textChanged(QString)), SLOT(onSettingsChanged()) );
    pageLayout->addRow( variableNameLabel, mVariableNameEdit );

    // items per line
    const QString itemsPerLineLabel =
        i18nc( "@label:textbox to define after how many items the list is wrapped",
               "Items per line:" );

    mItemsPerLineEdit = new KIntNumInput( this );
    mItemsPerLineEdit->setMinimum( 1 );
    mItemsPerLineEdit->setValue( mSettings.elementsPerLine );
    connect( mItemsPerLineEdit, SIGNAL(valueChanged(int)), SLOT(onSettingsChanged()) );
    pageLayout->addRow( itemsPerLineLabel, mItemsPerLineEdit );

    // data type
    const QString dataTypeLabel =
        i18nc( "@label:listbox the type of the data: char, integer, etc.",
               "Data type:" );

    mDataTypeSelect = new KComboBox( this );
    const char* const* dataTypeNames = mEncoder->dataTypeNames();
    const int dataTypesCount = mEncoder->dataTypesCount();
    QStringList dataTypeNameStrings;
    for( int i=0; i<dataTypesCount; ++i )
        dataTypeNameStrings << QLatin1String(dataTypeNames[i]);
    mDataTypeSelect->addItems( dataTypeNameStrings );
    mDataTypeSelect->setCurrentIndex( mSettings.dataType );
    connect( mDataTypeSelect, SIGNAL(activated(int)), SLOT(onSettingsChanged()) );
    pageLayout->addRow( dataTypeLabel, mDataTypeSelect );

    // unsigned as hexadezimal
    const QString unsignedAsHexadecimalLabel =
        i18nc( "@option:check Encode the values in hexadecimal instead of decimal, "
               "if the datatype has the property Unsigned",
               "Unsigned as hexadecimal:" );

    mUnsignedAsHexadecimalCheck = new QCheckBox( this );
    mUnsignedAsHexadecimalCheck->setChecked( mSettings.unsignedAsHexadecimal );
    connect( mUnsignedAsHexadecimalCheck, SIGNAL(toggled(bool)), SLOT(onSettingsChanged()) );
    pageLayout->addRow( unsignedAsHexadecimalLabel, mUnsignedAsHexadecimalCheck );
}
Example #9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
//    SettingsStorage::init();

    ui->setupUi(this);

    m_map = new MapScene(this);

    connect(m_map, SIGNAL(mapDoubleClick(QGraphicsSceneMouseEvent *)),
                          this, SLOT(onMapDoubleClick(QGraphicsSceneMouseEvent*)));
    connect(m_map, SIGNAL(mapMiddleButtonPressed(QGraphicsSceneMouseEvent *)),
                          this, SLOT(onMapMiddleButtonPressed(QGraphicsSceneMouseEvent*)));

    ui->graphicsView->setScene(m_map);

    m_map->setCenter(60.,30.);

    ui->graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    ui->graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    initQueries();



    connect(ui->registerCheckbox,SIGNAL(stateChanged (int)),this, SLOT(onRegisterCheckboxChanged(int)));
    connect(ui->userActionButton,SIGNAL(pressed()),this,SLOT(onUserActionButtonPressed()));
    connect(ui->tagActionButton,SIGNAL(pressed()),this,SLOT(onTagActionButtonPressed()));

    connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
    connect(ui->channelActionButton, SIGNAL(pressed()), this, SLOT(onChannelButtonPressed()));
    connect(ui->channelsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(onChannelsListChanged(int)));

    connect(ui->addChannelButton, SIGNAL(pressed()), this, SLOT(onAddChannelButtonPressed()));

    connect(ui->serverEdit,SIGNAL(textChanged(QString)), this, SLOT(onSettingsChanged()));
    connect(ui->portEdit, SIGNAL(textChanged(QString)), this, SLOT(onSettingsChanged()));

    connect(ui->writeTagButton, SIGNAL(pressed()), this ,SLOT(onWriteTagButtonPressed()));
}
Example #10
0
IconLoaderImpl::IconLoaderImpl()
{
	onSettingsChanged();
	m_settings.reset(new GeneralSettingsItem<IconLoaderSettings>(
	                     Settings::Appearance, loadIcon("preferences-desktop-icons"),
	                     QT_TRANSLATE_NOOP("Settings", "Icons theme")));
//	item->setConfig(QString(), QLatin1String("appearance"));
//	AutoSettingsItem::Entry *entry = item->addEntry<ThemeBox>(QT_TRANSLATE_NOOP("Settings", "Current theme"));
//	entry->setName(QLatin1String("theme"));
//	entry->setProperty("items", iconManager()->themeIds(false));
//	debug() << "ICONS:" << iconManager()->themeIds(true);
//	debug() << "ICONS:" << iconManager()->themeIds(false);
	Settings::registerItem(m_settings.data());
}
Example #11
0
void Kludget::about()
{
    if (aboutWindow)
    {
        aboutWindow->raise();
        aboutWindow->show();
        return ;
    }

    aboutWindow = new AboutWindow(info);
    aboutWindow->setAttribute(Qt::WA_DeleteOnClose);
    aboutWindow->setWindowTitle("About - " + info.name);
    aboutWindow->buildPreferenceMap(":resources/xml/accessPreferences.xml", false);
    aboutWindow->setupUI();
    aboutWindow->show();

    connect(aboutWindow, SIGNAL(settingsChanged()), this, SLOT(onSettingsChanged()));
    connect(aboutWindow, SIGNAL(destroyed()), this, SLOT(onPreferencesClosed()));
}
ScrobbleSettingsWidget::ScrobbleSettingsWidget( QWidget* parent )
    : SettingsWidget( parent ),
      ui( new Ui::ScrobbleSettingsWidget )
{
    ui->setupUi( this );

    unicorn::UserSettings userSettings;

    double scrobblePointValue = userSettings.scrobblePoint();
    ui->scrobblePoint->setValue( scrobblePointValue );
    ui->percentText->setText( QString::number(scrobblePointValue) );
    ui->percentText->setFixedWidth( ui->percentText->fontMetrics().width( "100" ) );
    m_initialScrobblePercentage = scrobblePointValue;

#ifdef FFMPEG_FINGERPRINTING
    ui->allowFingerprint->setChecked( userSettings.fingerprinting() );
#else
    ui->allowFingerprint->setEnabled( false );
    ui->allowFingerprint->setChecked( false );
#endif

    ui->enfocreScrobbleTimeMax->setChecked( userSettings.enforceScrobbleTimeMax() );
    ui->scrobblingOn->setChecked( userSettings.scrobblingOn() );
    ui->podcasts->setChecked( userSettings.podcasts() );

    QStringList exclusionDirs = userSettings.exclusionDirs();
    exclusionDirs.removeAll( "" );
    ui->exclusionDirs->setExclusions( exclusionDirs );

    connect( ui->scrobblePoint, SIGNAL(sliderMoved(int)), SLOT(onSliderMoved(int)) );
    connect( ui->scrobblePoint, SIGNAL(valueChanged(int)), SLOT(onSliderMoved(int)) );
    connect( ui->scrobblePoint, SIGNAL(valueChanged(int)), SLOT(onSettingsChanged()) );
    connect( ui->allowFingerprint, SIGNAL(stateChanged(int)), SLOT(onSettingsChanged()) );

    connect( aApp, SIGNAL(scrobbleToggled(bool)), ui->scrobblingOn, SLOT(setChecked(bool)));
    connect( ui->scrobblingOn, SIGNAL(clicked(bool)), SLOT(onSettingsChanged()) );
    connect( ui->podcasts, SIGNAL(stateChanged(int)), SLOT(onSettingsChanged()) );
    connect( ui->enfocreScrobbleTimeMax, SIGNAL(stateChanged(int)), SLOT(onSettingsChanged()) );

    connect( ui->exclusionDirs, SIGNAL(dataChanged()), SLOT(onSettingsChanged()) );
}
Example #13
0
void SyncConnector::checkAndSpawnINotifyProcess(bool isRequestedExternal)
{
  if (isRequestedExternal)
  {
    onSettingsChanged();
    if (mpSyncthingNotifierProcess)
    {
      mpSyncthingNotifierProcess->terminate();
    }
  }
  if (mShouldLaunchINotify)
  {
    if (!checkIfFileExists(mINotifyFilePath) && isRequestedExternal)
    {
      QMessageBox msgBox;
      msgBox.setText("Could not find iNotify.");
      msgBox.setInformativeText("Are you sure the path is correct?");
      msgBox.setStandardButtons(QMessageBox::Ok);
      msgBox.setDefaultButton(QMessageBox::Ok);
      msgBox.exec();
    }
    if (!systemUtil.isBinaryRunning(std::string("syncthing-inotify")))
    {
      mpSyncthingNotifierProcess = std::unique_ptr<QProcess>(new QProcess(this));
      QString processPath = QDir::toNativeSeparators(mINotifyFilePath);
      connect(mpSyncthingNotifierProcess.get(), SIGNAL(stateChanged(QProcess::ProcessState)),
        this, SLOT(notifyProcessSpawned(QProcess::ProcessState)));
      mpSyncthingNotifierProcess->start(processPath, QStringList(), QIODevice::Unbuffered);
    }
    else
    {
      emit(onProcessSpawned({{kNotifyIdentifier, ProcessState::ALREADY_RUNNING}}));
    }
  }
  else
  {
    shutdownINotifyProcess();
  }
}
Example #14
0
HexySerial::HexySerial(QObject *parent)
	: QObject(parent)
	, settings(nullptr)
	, lastPos{0}
	, dirtyMoveFlags(0xFFFFFFFF)
{
	serial = new QSerialPort(this);
	settings = new SerialSettingsWidget;

	if(!connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this, SLOT(handleError(QSerialPort::SerialPortError)), OC_CONTYPE)) {
		qWarning()<<"ERROR: Could not connect";
	}
	if(!connect(serial, SIGNAL(readyRead()), this, SLOT(readData()), OC_CONTYPE)) {
		qWarning()<<"ERROR: Could not connect";
	}
	if(!connect(serial, SIGNAL(bytesWritten(qint64)), this, SLOT(dataWritten(qint64)), OC_CONTYPE)) {
		qWarning()<<"ERROR: Could not connect";
	}
	if(!connect(settings,SIGNAL(settingsChanged()), this, SLOT(onSettingsChanged()), OC_CONTYPE)) {
		qWarning()<<"ERROR: Could not connect";
	}
}
Example #15
0
Playlist::Playlist(PlaylistWidget::ListTypes listType, QString title, quint64 hash, QObject *parent) :
    QObject(parent)
{
    m_listType = listType;
    m_sTitle = title;
    m_bCustomTitle = false;

    m_Settings = Settings::instance();
    connect(m_Settings, SIGNAL(changed()), SLOT(onSettingsChanged()));

    m_bLoadingState = false;
    m_bShuffleList = m_Settings->getValue("player/shuffle").toInt() > 1 ? true : false;

    m_LastTrack = 0;

    m_bLoadMeta = false;
    m_bUseMeta = false;

    m_bTitleByContent = m_Settings->getValue("playlist/tabs_by_content").toBool();

    m_Auth = Auth::instance();
    connect(m_Auth, SIGNAL(authComplete()), SLOT(update()));


    // Set hash
    if(hash == 0) {
        QDateTime *time = new QDateTime(QDateTime::currentDateTime());
        m_Hash = time->toMSecsSinceEpoch();
        m_bNewly = true;
    } else {
        m_Hash = hash;
        m_bNewly = false;
    }

    // Create playlist widget
    m_listWidget = new PlaylistWidget(m_listType);
    connect(this, SIGNAL(trackAdded()), m_listWidget, SLOT(trackAdded()));
    connect(m_listWidget, SIGNAL(trackActivate(Track*)), SLOT(trackActivate(Track*)));

    // Connect key events
    connect(m_listWidget, SIGNAL(skQueue()), SLOT(addToQueue()));
    connect(m_listWidget, SIGNAL(skRemove()), SLOT(removeTrack()));
    connect(m_listWidget, SIGNAL(skDownload()), SLOT(downloadTrack()));

    // Create object of parser
    m_Parser = new Parser(this);
    connect(m_Parser, SIGNAL(newTrack(Track*)), SLOT(addTrack(Track*)));
    connect(m_Parser, SIGNAL(busy()), SLOT(parserBusy()));
    connect(m_Parser, SIGNAL(free()), SLOT(parserFree()));
    connect(m_Parser, SIGNAL(savePlaylist()), SLOT(save()));
    connect(m_Parser, SIGNAL(busy()), m_listWidget, SLOT(showLoading()));
    connect(m_Parser, SIGNAL(free()), m_listWidget, SLOT(hideLoading()));

    // Create actions parser
    m_vkActions = VkActions::instance();
    connect(m_vkActions, SIGNAL(message(QString,QString)), SIGNAL(message(QString,QString)));

    switch(m_listType) {
        case PlaylistWidget::Search:
            connect(m_listWidget, SIGNAL(searchChanged(QString)), SLOT(searchChanged(QString)));
            connect(m_listWidget, SIGNAL(loadMore()), m_Parser, SLOT(loadMoreResults()));
        break;
        case PlaylistWidget::AudioLib:
            connect(m_listWidget->friendsList(), SIGNAL(friendSelected(QString,QString,QString)), SLOT(librarySelected(QString,QString,QString)));
            connect(m_listWidget, SIGNAL(refresh()), SLOT(refresh()));
        break;
        case PlaylistWidget::Suggestions:
            connect(m_listWidget, SIGNAL(loadMore()), m_Parser, SLOT(loadMoreResults()));
            connect(m_listWidget, SIGNAL(refresh()), SLOT(refresh()));
        break;
        case PlaylistWidget::DbSearch:
            connect(m_listWidget, SIGNAL(searchChanged(QString)), SLOT(searchChanged(QString)));
            connect(m_listWidget, SIGNAL(newTrack(Track*)), SLOT(addTrack(Track*)));
            connect(m_listWidget, SIGNAL(clearList()), SLOT(clearList()));
        break;
    }

    m_Model = new QStandardItemModel(this);

    m_ProxyModel = new QSortFilterProxyModel(this);
    m_ProxyModel->setSourceModel(m_Model);
    m_ProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_ProxyModel->setFilterKeyColumn(2);

    m_listWidget->setModel(m_ProxyModel);

    connect(m_listWidget, SIGNAL(listSearchChanged(QString)), SLOT(setListSearch(QString)));

    createMenus();

    load();

    if(type() == PlaylistWidget::AudioLib &&
       m_bNewly &&
       m_Settings->getValue("playlist/autoload_library").toBool()
       )
        librarySelected(m_Auth->vkId(), "0", tr("My Library"));

    // Actions on newly created plalylists
    if(m_bNewly) {
        switch(m_listType) {
            case PlaylistWidget::Search:
                m_listWidget->focusOnSearch();
            break;
            case PlaylistWidget::AudioLib:
            if(m_Settings->getValue("playlist/autoload_library").toBool())
                librarySelected(m_Auth->vkId(), "0", tr("My Library"));
            break;
            case PlaylistWidget::Suggestions:
                refresh();
            break;
            case PlaylistWidget::DbSearch:
                // Unused
            break;
        }
    }
}
Example #16
0
void Kludget::messageReceived(QString message, QString id, QString instance)
{
	if (instance != "") {
		if (info.instance != instance)
			return;
	}

    if (message == "ping") {
        ipcClient.sendMessage("pong", info.id, info.instance);
        return;
    }

    KLog::log(QString("kludget messageReceived: %1").arg(message));
    
    int messageId = message.toUInt();
    switch (messageId)
    {
    case KIPC::ShowHUD:
    {
        window->moveToTop();
        //window->updateMouseIgnore(false);
        break;
    }
    case KIPC::HideHUD:
    {
		//window->applySettings();
        window->moveToBottom();
        break;
    }
    case KIPC::ShowWindow:
    {
        show();
		window->moveToTop();
		window->applySettings();
        break;
    }
    case KIPC::HideWindow:
    {
        hide();
        break;
    }
    case KIPC::LowerWindow:
    {
        window->lower();
        break;
    }
    case KIPC::SettingsChanged:
    {
        onSettingsChanged();
        break;
    }
	case KIPC::ShowOptions:
	{
		onContextMenu();
		break;
	}
	case KIPC::Configure:
    {
        configure();
        break;
    }
    default:

        evaluate(message);
        break;
    }
}