Exemplo n.º 1
0
FlatPassCodeEdit::FlatPassCodeEdit(const QString &pholder, QWidget *parent) : FlatInput(pholder, parent) {
	setAlign(Align::Cen);
	setEchoMode(QLineEdit::Password);
	setAcceptDrops(false);
	setContextMenuPolicy(Qt::CustomContextMenu);
	QObject::connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint)));
}
Exemplo n.º 2
0
CLSValueEditor::CLSValueEditor(QWidget *parent) :
	QGroupBox(parent)
{
	// Initialize class variables.

	editStatus_ = NotEditing;

	value_ = AMNumber(AMNumber::InvalidError);
	minimumValue_ = - DBL_MAX;
	maximumValue_ = DBL_MAX;
	format_ = 'g';
	precision_ = 3;
	readOnly_ = false;
	progressValueMinimum_ = 0;
	progressValueMaximum_ = 100;
	progressValue_ = 0;
	displayProgress_ = true;

	editAction_ = new QAction("Edit", this);

	// Create UI elements.

	valueLabel_ = new CLSValueProgressLabel();
	valueLabel_->setAlignment(Qt::AlignCenter);
	valueLabel_->setStyleSheet("color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);");

	// Create and set layouts.

	QVBoxLayout *layout = new QVBoxLayout();
	layout->addWidget(valueLabel_);

	setLayout(layout);

	// Make connections.

	connect( editAction_, SIGNAL(triggered(bool)), this, SLOT(onEditActionTriggered()) );
	connect( this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint)) );

	// Current settings.

	setContextMenuPolicy(Qt::CustomContextMenu);
	setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);

	refresh();
}
Exemplo n.º 3
0
SinglePlaylistView::SinglePlaylistView(QWidget *parent, MafwRegistryAdapter *mafwRegistry) :
    BrowserWindow(parent, mafwRegistry),
    mafwRegistry(mafwRegistry),
    mafwRenderer(mafwRegistry->renderer()),
    mafwTrackerSource(mafwRegistry->source(MafwRegistryAdapter::Tracker)),
    playlist(mafwRegistry->playlist())
{
    browsePlaylistId = MAFW_SOURCE_INVALID_BROWSE_ID;

    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);

    permanentDelete = QSettings().value("main/permanentDelete").toBool();

    ui->objectList->setItemDelegate(new SongListItemDelegate(ui->objectList));
    ui->objectList->setItemDelegateForRow(0, new ShuffleButtonDelegate(ui->objectList));

    objectProxyModel->setFilterRole(UserRoleFilterString);

    ui->objectList->setDragDropMode(QAbstractItemView::InternalMove);
    ui->objectList->viewport()->setAcceptDrops(true);
    ui->objectList->setAutoScrollMargin(70);
    QApplication::setStartDragDistance(20);
    ui->objectList->setDragEnabled(false);

    playlistModified = false;
    pendingActivation = Nothing;

    clickedIndex = QModelIndex();
    clickTimer = new QTimer(this);
    clickTimer->setInterval(QApplication::doubleClickInterval());
    clickTimer->setSingleShot(true);

    ui->windowMenu->addAction(tr("Add to now playing"), this, SLOT(addAllToNowPlaying()));
    ui->windowMenu->addAction(tr("Add to a playlist" ), this, SLOT(addAllToPlaylist()));
    ui->windowMenu->addAction(tr("Delete playlist"   ), this, SLOT(deletePlaylist()));

    connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Enter), this), SIGNAL(activated()), this, SLOT(onContextMenuRequested()));

    connect(ui->objectList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint)));

    connect(ui->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(updateSongCount()));

    connect(clickTimer, SIGNAL(timeout()), this, SLOT(forgetClick()));
}
Exemplo n.º 4
0
SingleGenreView::SingleGenreView(QWidget *parent, MafwRegistryAdapter *mafwRegistry) :
    BrowserWindow(parent, mafwRegistry),
    mafwRegistry(mafwRegistry),
    mafwRenderer(mafwRegistry->renderer()),
    mafwTrackerSource(mafwRegistry->source(MafwRegistryAdapter::Tracker)),
    playlist(mafwRegistry->playlist())
{
    ui->objectList->setItemDelegate(new ArtistListItemDelegate(ui->objectList));
    ui->objectList->setItemDelegateForRow(0, new ShuffleButtonDelegate(ui->objectList));

    ui->windowMenu->addAction(tr("Add to now playing"), this, SLOT(addAllToNowPlaying()));

    shuffleRequested = false;

    connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Enter), this), SIGNAL(activated()), this, SLOT(onContextMenuRequested()));

    connect(ui->objectList, SIGNAL(activated(QModelIndex)), this, SLOT(onItemActivated(QModelIndex)));
    connect(ui->objectList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint)));
}
Exemplo n.º 5
0
void BaseViewer::setupViewContextMenu()
{
    _ui->_view->setContextMenuPolicy(Qt::CustomContextMenu);
    // Zoom in :
    _zoomIn = new QAction(tr("Zoom in"), _ui->_view);
    _zoomIn->setEnabled(_settings.enableZoom);
    connect(_zoomIn, SIGNAL(triggered()), this, SLOT(onZoomActionTriggered()));
    _ui->_view->addAction(_zoomIn);

    // Zoom out :
    _zoomOut = new QAction(tr("Zoom out"), _ui->_view);
    _zoomOut->setEnabled(_settings.enableZoom);
    connect(_zoomOut, SIGNAL(triggered()), this, SLOT(onZoomActionTriggered()));
    _ui->_view->addAction(_zoomOut);

    // menu
    _menu.addActions(_ui->_view->actions());
    connect(_ui->_view, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(onContextMenuRequested(QPoint)));
}
Exemplo n.º 6
0
VideosWindow::VideosWindow(QWidget *parent, MafwRegistryAdapter *mafwRegistry) :
    BrowserWindow(parent, mafwRegistry),
    mafwRegistry(mafwRegistry),
    mafwRenderer(mafwRegistry->renderer()),
    mafwTrackerSource(mafwRegistry->source(MafwRegistryAdapter::Tracker)),
    playlist(mafwRegistry->playlist())
{
    ui->objectList->setIconSize(QSize(64, 64));
    ui->objectList->setDragDropMode(QAbstractItemView::NoDragDrop);
    ui->objectList->setMovement(QListView::Static);

    ui->objectList->setItemDelegate(new ThumbnailItemDelegate(ui->objectList));

    objectProxyModel->setDynamicSortFilter(true);
    objectProxyModel->setFilterRole(UserRoleTitle);

    QActionGroup *sortByActionGroup = new QActionGroup(this);
    sortByDate = new QAction(tr("Date"), sortByActionGroup);
    sortByDate->setCheckable(true);
    sortByCategory = new QAction(tr("Category"), sortByActionGroup);
    sortByCategory->setCheckable(true);
    ui->windowMenu->addActions(sortByActionGroup->actions());

    connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Enter), this), SIGNAL(activated()), this, SLOT(onContextMenuRequested()));

    connect(ui->windowMenu, SIGNAL(triggered(QAction*)), this, SLOT(onSortingChanged(QAction*)));

    connect(ui->objectList, SIGNAL(activated(QModelIndex)), this, SLOT(onVideoSelected(QModelIndex)));
    connect(ui->objectList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint)));

    if (mafwTrackerSource->isReady()) {
        onSourceReady();
    } else {
        connect(mafwTrackerSource, SIGNAL(containerChanged(QString)), this, SLOT(onSourceReady()));
    }
}
Exemplo n.º 7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    _ui( new Ui::MainWindow)
{
    _ui->setupUi( this);

    _isConnect          = false;
    _wasContact         = false;
    _wasConnect         = false;
    _isLoginCancel      = false;
    _runPostLoginCancel = false;
    _isLoginDialog      = false;
    _loginContextCode   = 0;

    QLabel*  curItemPathLabel = new QLabel;
    curItemPathLabel->setText("Path:");
    _curItemPathStatus = new QLineEdit;
    _curItemPathStatus->setReadOnly( true);
    _curItemPathStatus->setStyleSheet("QLineEdit{background: lightgrey;}");
    _ui->statusBar->addPermanentWidget( curItemPathLabel);
    _ui->statusBar->addPermanentWidget( _curItemPathStatus);

    _timerChatButEff = new QTimer( this);
    _timerChatButEff->setInterval(20);
    connect( _timerChatButEff, SIGNAL(timeout()), this, SLOT(doChatButtonEffect()));
    _countChatButEff = 0;
    _chatButEff = new QGraphicsColorizeEffect;
    _chatButEff->setColor( QColor(254,89,6));
    _ui->chatButton->setGraphicsEffect( _chatButEff);
    setChatButEff( false);

    _appSettings = new QSettings("MicTron", "ArnBrowser");
    _settings    = new SettingsHandler( _appSettings);
    _settings->readSettings();

    //// Error log from Arn system
    ArnM::setConsoleError( false);
    connect( &ArnM::instance(), SIGNAL(errorLogSig(QString,uint,void*)),
             this, SLOT(errorLog(QString)));

    //// Prepare connect to Arn server
    _connector = new Connector( this);
    _arnClient = new ArnClient( this);
    _arnClient->setDemandLogin( false);
    // _arnClient->setReceiveTimeout(5);  // Base time for receiver timeout
    connect( _arnClient, SIGNAL(connectionStatusChanged(int,int)), this, SLOT(doClientStateChanged(int)));
    connect( _arnClient, SIGNAL(loginRequired(int)), this, SLOT(doStartLogin(int)));
    connect( _arnClient, SIGNAL(replyInfo(int,QByteArray)), SLOT(doRinfo(int,QByteArray)));
    connect( _arnClient, SIGNAL(killRequested()), this, SLOT(onKillRequest()));
    connect( _arnClient, SIGNAL(chatReceived(QString,int)), this, SLOT(onChatReceived(QString,int)));

    //// Setup model
    _arnModel = new ArnModel( _connector, this);
    _arnModel->setClient( _arnClient);
    _arnModel->start();
    connect( _arnModel, SIGNAL(hiddenRow(int,QModelIndex,bool)),
             this, SLOT(updateHidden(int,QModelIndex,bool)));

    setWindowTitle(tr("Arn Browser  ") + ver);
    _ui->arnView->setEnabled( false);

    readSettings();
    QString  host = _appSettings->value("connect/host").toString();
    int      port = _appSettings->value("connect/port").toInt();
    if (host.isNull())
        host = "localhost";  // Default host
    if (port == 0)
        port = Arn::defaultTcpPort;
    _ui->hostEdit->setText( host);    // Default host
    _ui->portEdit->setValue( port);
    _ui->connectStat->hide();

    _chatServWin = new ChatServWindow( _appSettings, this);
    connect( _chatServWin, SIGNAL(txtOutput(QString)), this, SLOT(doChatAdd(QString)));
    connect( _chatServWin, SIGNAL(abortKillRequest()), this , SLOT(doAbortKillRequest()));

#if QT_VERSION >= 0x050000 && QT_VERSION < 0x050300
    _ui->portEdit->setRange( 1, 1065535);  // Fix early Qt5 layout bug giving to little space
#endif

    connect( _ui->arnView, SIGNAL(clicked(QModelIndex)), this, SLOT(onItemClick(QModelIndex)));
    connect( _ui->arnView, SIGNAL(customContextMenuRequested(QPoint)),
             this, SLOT(onContextMenuRequested(QPoint)));

    setConnectOffGui();
    // Test chat button
    //_ui->chatButton->setVisible(true);
    //setChatButEff( true);
}