/** Default constructor */
ShareManager::ShareManager()
  : QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
{
    /* Invoke Qt Designer generated QObject setup routine */
    ui.setupUi(this);

    ui.headerFrame->setHeaderImage(QPixmap(":/images/fileshare64.png"));
    ui.headerFrame->setHeaderText(tr("Share Manager"));

    isLoading = false;
    load();

    Settings->loadWidgetInformation(this);

    connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( showShareDialog() ) );
    connect(ui.editButton, SIGNAL(clicked( bool ) ), this , SLOT( editShareDirectory() ) );
    connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) );
    connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(applyAndClose()));

    connect(ui.shareddirList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(shareddirListCostumPopupMenu(QPoint)));
    connect(ui.shareddirList, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(shareddirListCurrentCellChanged(int,int,int,int)));

    connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(updateGroups()));

    ui.editButton->setEnabled(false);
    ui.removeButton->setEnabled(false);

    QHeaderView* header = ui.shareddirList->horizontalHeader();
    QHeaderView_setSectionResizeModeColumn(header, COLUMN_PATH, QHeaderView::Stretch);

    //header->setResizeMode(COLUMN_NETWORKWIDE, QHeaderView::Fixed);
    //header->setResizeMode(COLUMN_BROWSABLE, QHeaderView::Fixed);

    header->setHighlightSections(false);

    setAcceptDrops(true);
    setAttribute(Qt::WA_DeleteOnClose, true);
}
Exemple #2
0
QWidget *MainWindow::initContent()
{
    /* Popup dialogs */
    MenuDialog *dlg_menu = new MenuDialog(settings, this);

    /* Main window content */
    //main.db path section
    cb_maindb = new QComboBox;
    cb_maindb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    connect(cb_maindb, SIGNAL(currentIndexChanged(int)), this, SLOT(onMaindbSelected(int)));
    QPushButton *btn_maindb = new QPushButton(tr("Manual selection"));
    connect(btn_maindb, SIGNAL(clicked()), this, SLOT(browseMaindb()));

    QHBoxLayout *layout_maindb = new QHBoxLayout;
    layout_maindb->addWidget(new QLabel(tr("Skype account :")));
    layout_maindb->addWidget(cb_maindb);
    layout_maindb->addWidget(btn_maindb);

    //Mood message section
    pte_mood = new TagsPlainTextEdit;
    pte_mood->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
    connect(pte_mood, SIGNAL(textChanged()), this, SLOT(onMoodTextChanged()));

    lab_mood_preview = new QLabel;
    lab_mood_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    lab_mood_preview->setWordWrap(true);
    lab_mood_preview->setOpenExternalLinks(true);
    lab_mood_preview->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    contact_preview = new SkypeContactPreview;

    QVBoxLayout *layout_preview = new QVBoxLayout;
    layout_preview->setContentsMargins(0, 0, 0, 0);
    layout_preview->addWidget(lab_mood_preview);
    layout_preview->addWidget(contact_preview);

    QHBoxLayout *layout_mood = new QHBoxLayout;
    layout_mood->addWidget(pte_mood, 56);
    layout_mood->addLayout(layout_preview, 44);

    btn_apply = new QPushButton(tr("Apply"));
    connect(btn_apply, SIGNAL(clicked()), this, SLOT(applyAndClose()));

    //History section
    history_view = new QListView;
    history_view->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
    history_view->setModel(history_model);
    history_view->setItemDelegate(new HtmlDelegate(this));

    btn_history_push = new QToolButton;
    btn_history_push->setToolTip(tr("Use as mood message"));
    btn_history_push->setAutoRaise(true);
    btn_history_push->setIconSize(QSize(24, 24));
    btn_history_push->setIcon(QIcon(":img/push.png"));
    connect(btn_history_push, SIGNAL(clicked()), this, SLOT(historyPushToMood()));
    QToolButton *btn_history_rm = new QToolButton;
    btn_history_rm->setAutoRaise(true);
    btn_history_rm->setToolTip(tr("Remove from history"));
    btn_history_rm->setIconSize(QSize(24, 24));
    btn_history_rm->setIcon(QIcon(":img/rm.png"));
    connect(btn_history_rm, SIGNAL(clicked()), this, SLOT(historyRemove()));
    QToolButton *btn_history_clear = new QToolButton;
    btn_history_clear->setToolTip(tr("Clear history"));
    btn_history_clear->setAutoRaise(true);
    btn_history_clear->setIconSize(QSize(24, 24));
    btn_history_clear->setIcon(QIcon(":img/clear.png"));
    connect(btn_history_clear, SIGNAL(clicked()), this, SLOT(historyClear()));

    QPushButton *btn_menu = new QPushButton;
    btn_menu->setIconSize(QSize(24, 24));
    btn_menu->setIcon(QIcon(":img/gear.png"));
    connect(btn_menu, SIGNAL(clicked()), dlg_menu, SLOT(open()));

    QVBoxLayout *layout_history_btn = new QVBoxLayout;
    layout_history_btn->setContentsMargins(0, 0, 0, 0);
    layout_history_btn->addWidget(btn_history_push, 0, Qt::AlignCenter);
    layout_history_btn->addWidget(btn_history_rm, 0, Qt::AlignCenter);
    layout_history_btn->addWidget(btn_history_clear, 0, Qt::AlignCenter);
    layout_history_btn->addStretch();
    layout_history_btn->addWidget(btn_menu, 0, Qt::AlignCenter);

    QHBoxLayout *layout_history = new QHBoxLayout;
    layout_history->addWidget(history_view);
    layout_history->addLayout(layout_history_btn);

    //Filling the window
    QVBoxLayout *layout_main = new QVBoxLayout;
    layout_main->addLayout(layout_maindb, 1);
    layout_main->addWidget(new EntitledSeparator(tr("Mood message")), 0);
    layout_main->addLayout(layout_mood, 35);
    layout_main->addWidget(btn_apply, 0);
    layout_main->addWidget(new EntitledSeparator(tr("History")), 0);
    layout_main->addLayout(layout_history, 44);

    QWidget *container = new QWidget;
    container->setLayout(layout_main);
    return container;
}