示例#1
0
/*
********************************************************************************
*                                                                              *
*    Class ShortcutDialog                                                      *
*                                                                              *
********************************************************************************
*/
ShortcutDialog::ShortcutDialog(QString key, QString shortcut, QWidget *parent) : DialogBase(parent)
{
    m_key          = key;
    m_old_shortcut = shortcut;

    //! ui
    this->setTitle(tr("Change shortcut"));
    this->resize(400, 170);


    QLabel * label= new QLabel(this);
    label->setAlignment(Qt::AlignCenter);
    label->setWordWrap(false);
    label->setText(tr("Press a keys that you want to set as a shortcut"));

    m_currentShortcut = new QLabel(this);
    m_currentShortcut->setAlignment(Qt::AlignCenter);
    m_currentShortcut->setText(m_old_shortcut);


    QVBoxLayout * layout = new QVBoxLayout();
    layout->addWidget(label);
    layout->addWidget(m_currentShortcut);

    setContentLayout(layout);
    
    //! connection
    connect(buttonBox(), SIGNAL(rejected()),this, SLOT(close()));
    connect(buttonBox(), SIGNAL(accepted()),this, SLOT(accept()));

    //! List legal modifiers
    m_modifier_keys << Qt::ControlModifier << Qt::AltModifier << Qt::MetaModifier << Qt::ShiftModifier;
}
示例#2
0
/*
********************************************************************************
*                                                                              *
*    Class AddStreamDialog                                                     *
*                                                                              *
********************************************************************************
*/
AddStreamDialog::AddStreamDialog(QWidget *parent,bool active_category) : DialogBase(parent, tr("Add Stream"))
{
    //create ui
    this->setFixedSize(480,160);

    ui_edit_url   = new QLineEdit();
    ui_edit_url->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    ui_edit_url->setText("http://");

    ui_edit_name  = new QLineEdit();
    ui_edit_name->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    QGridLayout *ui_grid_layout = new QGridLayout();
    ui_grid_layout->setContentsMargins(0, 0, 0, 0);

    ui_grid_layout->addWidget(new QLabel(tr("url")), 0, 0, 1, 1);
    ui_grid_layout->addWidget(ui_edit_url, 0, 1, 1, 1);
    ui_grid_layout->addWidget(new QLabel(tr("name")), 1, 0, 1, 1);
    ui_grid_layout->addWidget(ui_edit_name, 1, 1, 1, 1);

    ui_edit_category = 0;
    
    if(active_category) 
    {
      ui_edit_category  = new QLineEdit();
      ui_grid_layout->addWidget(new QLabel(tr("category")), 2, 0, 1, 1);
      ui_grid_layout->addWidget(ui_edit_category, 2, 1, 1, 1);
    }

     /* layout content */
     setContentLayout(ui_grid_layout);

     QObject::connect(buttonBox(), SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
     QObject::connect(buttonBox(), SIGNAL(rejected()), this, SLOT(on_buttonBox_rejected()));
}
示例#3
0
MetadataDialog::MetadataDialog( AttributeType type, QWidget* parent ) : CommandDialog( parent ),
    m_type( type )
{
    AttributeHelper helper;

    setWindowTitle( tr( "Attribute Details" ) );
    setPromptPixmap( IconLoader::pixmap( "status-info", 22 ) );
    setPrompt( tr( "Specify details of <b>%1</b> attribute:" ).arg( helper.typeName( type ) ) );

    QVBoxLayout* layout = new QVBoxLayout();

    m_editor = MetadataEditorFactory::createMetadataEditor( type, this, this );

    layout->addWidget( m_editor->widget() );

    setContentLayout( layout, m_editor->isFixedHeight() );
}
示例#4
0
MembersDialog::MembersDialog( int projectId ) : InformationDialog( NULL, Qt::Window ),
    m_projectId( projectId )
{
    ProjectEntity project = ProjectEntity::find( projectId );

    QAction* action;

    action = new QAction( IconLoader::icon( "user-new" ), tr( "&Add Members..." ), this );
    action->setShortcut( QKeySequence::New );
    connect( action, SIGNAL( triggered() ), this, SLOT( addMember() ) );
    setAction( "addMember", action );

    action = new QAction( IconLoader::icon( "edit-access" ), tr( "&Change Access..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( changeAccess() ) );
    setAction( "changeAccess", action );

    action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Remove Members" ), this );
    action->setShortcut( QKeySequence::Delete );
    connect( action, SIGNAL( triggered() ), this, SLOT( removeMember() ) );
    setAction( "removeMember", action );

    setDefaultMenuAction( "menuMember", "changeAccess" );

    loadXmlUiFile( ":/resources/membersdialog.xml" );

    XmlUi::Builder* builder = new XmlUi::Builder( this );
    builder->addClient( this );

    setWindowTitle( tr( "Manage Permissions" ) );
    setPromptPixmap( IconLoader::pixmap( "edit-access", 22 ) );
    setPrompt( tr( "Edit permissions of project <b>%1</b>:" ).arg( project.name() ) );

    QVBoxLayout* layout = new QVBoxLayout();

    QGroupBox* globalGroup = new QGroupBox( tr( "Global Access" ), this );
    layout->addWidget( globalGroup );

    QHBoxLayout* globalLayout = new QHBoxLayout( globalGroup );

    m_globalEdit = new QLineEdit( globalGroup );
    m_globalEdit->setReadOnly( true );
    globalLayout->addWidget( m_globalEdit );

    QPushButton* globalButton = new QPushButton( tr( "Change..." ), globalGroup );
    globalButton->setIcon( IconLoader::icon( "edit-modify" ) );
    globalButton->setIconSize( QSize( 16, 16 ) );
    globalLayout->addWidget( globalButton );

    connect( globalButton, SIGNAL( clicked() ), this, SLOT( changeGlobalAccess() ) );

    layout->addSpacing( 5 );

    QVBoxLayout* membersLayout = new QVBoxLayout();
    membersLayout->setSpacing( 4 );
    layout->addLayout( membersLayout );

    XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this );
    builder->registerToolStrip( "stripMembers", strip );
    membersLayout->addWidget( strip );

    m_list = new QTreeView( this );
    membersLayout->addWidget( m_list );

    TreeViewHelper helper( m_list );
    helper.initializeView( TreeViewHelper::MultiSelect );

    m_list->sortByColumn( 0, Qt::AscendingOrder );

    m_model = new MembersModel( projectId, this );
    m_list->setModel( m_model );

    helper.loadColumnWidths( "MembersDialogWidths", QList<int>() << 150 << 150 );

    connect( m_list->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ),
        this, SLOT( updateActions() ) );
    connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ),
        this, SLOT( doubleClicked( const QModelIndex& ) ) );
    connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( listContextMenu( const QPoint& ) ) );

    connect( m_model, SIGNAL( layoutChanged() ), this, SLOT( updateActions() ) );
    connect( m_model, SIGNAL( modelReset() ), this, SLOT( updateActions() ) );

    setContentLayout( layout, false );

    resize( 350, 450 );

    dataManager->addObserver( this );

    updateGlobalAccess();
    updateActions();
}
示例#5
0
ReportDialog::ReportDialog( SourceType source, ReportMode mode, QWidget* parent ) : CommandDialog( parent ),
    m_source( source ),
    m_mode( mode ),
    m_folderId( 0 ),
    m_typeId( 0 ),
    m_projectId( 0 ),
    m_history( IssueDetailsGenerator::NoHistory ),
    m_tableButton( NULL ),
    m_fullTableButton( NULL ),
    m_summaryButton( NULL ),
    m_fullReportButton( NULL ),
    m_page( NULL ),
    m_pdfPrinter( NULL )
{
    if ( source == FolderSource ) {
        m_tableButton = new QRadioButton( tr( "Table with visible columns only" ), this );
        m_fullTableButton = new QRadioButton( tr( "Table with all system and user columns" ), this );
    }

    if ( mode != ExportCsv ) {
        if ( source == FolderSource )
            m_summaryButton = new QRadioButton( tr( "Summary report including issue details" ), this );
        if ( source == IssueSource ) {
            m_summaryButton = new QRadioButton( tr( "Summary report without issue history" ), this );
            m_fullReportButton = new QRadioButton( tr( "Full report including issue history" ), this );
        }
    }

    QVBoxLayout* optionsLayout = NULL;

    if ( m_tableButton || m_fullTableButton || m_summaryButton || m_fullReportButton ) {
        optionsLayout = new QVBoxLayout();
        if ( m_tableButton )
            optionsLayout->addWidget( m_tableButton );
        if ( m_fullTableButton )
            optionsLayout->addWidget( m_fullTableButton );
        if ( m_summaryButton )
            optionsLayout->addWidget( m_summaryButton );
        if ( m_fullReportButton )
            optionsLayout->addWidget( m_fullReportButton );
    }

    if ( optionsLayout || mode == Print ) {
        QHBoxLayout* layout = new QHBoxLayout();

        if ( optionsLayout )
            layout->addLayout( optionsLayout );

        if ( mode == Print ) {
            QPushButton* previewButton = new QPushButton( tr( "&Print Preview..." ), this );
            previewButton->setIcon( IconLoader::icon( "print-preview" ) );
            previewButton->setIconSize( QSize( 16, 16 ) );
            layout->addWidget( previewButton, 0, Qt::AlignBottom | Qt::AlignRight );

            connect( previewButton, SIGNAL( clicked() ), this, SLOT( showPreview() ) );
        }

        setContentLayout( layout, true );
    }

    if ( m_tableButton )
        m_tableButton->setChecked( true );
    else if ( m_summaryButton )
        m_summaryButton->setChecked( true );

    QString sourceName;
    switch ( source ) {
        case FolderSource:
            sourceName = tr( "list of issues" );
            break;
        case IssueSource:
            sourceName = tr( "issue details" );
            break;
        case ProjectSource:
            sourceName = tr( "project summary" );
            break;
    }

    switch ( mode ) {
        case Print:
            setWindowTitle( tr( "Print" ) );
            setPromptPixmap( IconLoader::pixmap( "file-print", 22 ) );
            setPrompt( tr( "Print %1:" ).arg( sourceName ) );
            break;
        case ExportCsv:
            setWindowTitle( tr( "Export To CSV" ) );
            setPromptPixmap( IconLoader::pixmap( "export-csv", 22 ) );
            setPrompt( tr( "Export %1 to CSV file:" ).arg( sourceName ) );
            break;
        case ExportHtml:
            setWindowTitle( tr( "Export To HTML" ) );
            setPromptPixmap( IconLoader::pixmap( "export-html", 22 ) );
            setPrompt( tr( "Export %1 to HTML file:" ).arg( sourceName ) );
            break;
        case ExportPdf:
            setWindowTitle( tr( "Export To PDF" ) );
            setPromptPixmap( IconLoader::pixmap( "export-pdf", 22 ) );
            setPrompt( tr( "Export %1 to PDF file:" ).arg( sourceName ) );
            break;
    }

    showInfo( tr( "Create the report." ) );
}
ManageAlertsDialog::ManageAlertsDialog( int folderId ) : InformationDialog( NULL, Qt::Window ),
    m_model( NULL ),
    m_selectedAlertId( 0 ),
    m_selectedEditable( false )
{
    m_emailEnabled = dataManager->setting( "email_enabled" ).toInt();

    if ( folderId != 0 )
        m_canEditPublic = FolderEntity::isAdmin( folderId );
    else
        m_canEditPublic = dataManager->currentUserAccess() == AdminAccess;

    QAction* action;

    action = new QAction( IconLoader::icon( "alert-new" ), tr( "&Add Alert..." ), this );
    action->setShortcut( QKeySequence::New );
    connect( action, SIGNAL( triggered() ), this, SLOT( addAlert() ) );
    setAction( "addAlert", action );

    if ( m_canEditPublic ) {
        action = new QAction( IconLoader::overlayedIcon( "alert-new", "overlay-public" ), tr( "Add &Public Alert..." ), this );
        connect( action, SIGNAL( triggered() ), this, SLOT( addPublicAlert() ) );
        setAction( "addPublicAlert", action );
    }

    action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Alert" ), this );
    action->setShortcut( QKeySequence::Delete );
    connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ) );
    setAction( "editDelete", action );

    if ( m_emailEnabled ) {
        action = new QAction( IconLoader::icon( "edit-modify" ), tr( "&Modify Alert..." ), this );
        connect( action, SIGNAL( triggered() ), this, SLOT( editModify() ) );
        setAction( "editModify", action );

        setDefaultMenuAction( "menuAlert", "editModify" );
    }

    loadXmlUiFile( ":/resources/managealertsdialog.xml" );

    XmlUi::Builder* builder = new XmlUi::Builder( this );
    builder->addClient( this );

    setWindowTitle( tr( "Manage Alerts" ) );
    setPromptPixmap( IconLoader::pixmap( "configure-alerts", 22 ) );

    QVBoxLayout* layout = new QVBoxLayout();
    layout->setSpacing( 4 );

    XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this );
    builder->registerToolStrip( "stripAlerts", strip );
    layout->addWidget( strip );

    m_list = new QTreeView( this );
    layout->addWidget( m_list );

    TreeViewHelper helper( m_list );
    helper.initializeView( TreeViewHelper::NotSortable );

    connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ),
        this, SLOT( doubleClicked( const QModelIndex& ) ) );
    connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( listContextMenu( const QPoint& ) ) );

    setContentLayout( layout, false );

    setDialogSizeKey( "ManageAlertsDialog" );

    resize( 680, 400 );

    updateActions();
}