Example #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    // Creazione finestra
    ui->setupUi(this);
    mDialogSendIp = NULL;
    mDialogText = NULL;
    mNetworkSession = NULL;

    // Creazione menu'
    mSendFileAction = new QAction("Send a file", this);
    menuBar()->addAction(mSendFileAction);
    connect(mSendFileAction, SIGNAL(triggered()), this, SLOT(selectFileToSend()));

    mSendTextAction = new QAction("Send text message", this);
    menuBar()->addAction(mSendTextAction);
    connect(mSendTextAction, SIGNAL(triggered()), this, SLOT(showSendTextDialog()));

    mSendToIPAction = new QAction("Send by IP", this);
    menuBar()->addAction(mSendToIPAction);
    connect(mSendToIPAction, SIGNAL(triggered()), this, SLOT(sendToIp()));

    mCurrentIPAction = new QAction("Current IP address", this);
    menuBar()->addAction(mCurrentIPAction);
    connect(mCurrentIPAction, SIGNAL(triggered()), this, SLOT(showCurrentIP()));

    mChangeFolderAction = new QAction("Change folder", this);
    menuBar()->addAction(mChangeFolderAction);
    connect(mChangeFolderAction, SIGNAL(triggered()), this, SLOT(changeFolder()));

    mChangeNameAction = new QAction("Change user name", this);
    menuBar()->addAction(mChangeNameAction);
    connect(mChangeNameAction, SIGNAL(triggered()), this, SLOT(changeName()));

    // Progress dialog per operazioni
    mProgressDialog = new QProgressDialog("", "", 0, 100);
    mProgressDialog->setWindowModality(Qt::WindowModal);

    // Connecting dialog
    mConnectingDialog = new QProgressDialog("\nConnecting...", "", 0, 0);
    mConnectingDialog->setCancelButton(NULL);
    mConnectingDialog->setAutoClose(false);
    mConnectingDialog->setMinimumDuration(0);
    mConnectingDialog->setWindowModality(Qt::WindowModal);

    // Percorso di default
    QDir d;
    if (d.mkpath("E:\\Dukto\\"))
    {
        QDir::setCurrent("E:\\Dukto\\");
        ui->labelDest->setText("Folder: E:\\Dukto");
    }
    else
    {
        d.mkpath("C:\\Dukto\\");
        QDir::setCurrent("C:\\Dukto\\");
        ui->labelDest->setText("Folder: C:\\Dukto");
    }

}
/** Initializes the view. */
void CBookmarkIndex::initView()
{
	//qDebug("CBookmarkIndex::initView");

	header()->hide();

	setFocusPolicy(Qt::WheelFocus);

	//d'n'd related settings
	setDragEnabled( true );
	setAcceptDrops( true );
	setDragDropMode(QAbstractItemView::DragDrop);
	viewport()->setAcceptDrops(true);
	setAutoScroll(true);
	setAutoExpandDelay(800);

	setItemsExpandable(true);
	setRootIsDecorated(true);
	setAllColumnsShowFocus(true);
	setSelectionMode(QAbstractItemView::ExtendedSelection);

	//setup the popup menu
	m_popup = new QMenu(viewport());
	m_popup->setTitle(tr("Bookmarks"));

	m_actions.newFolder = newQAction(tr("New folder"), CResMgr::mainIndex::newFolder::icon, 0, this, SLOT(createNewFolder()), this);
	m_actions.changeFolder = newQAction(tr("Rename folder"),CResMgr::mainIndex::changeFolder::icon, 0, this, SLOT(changeFolder()), this);

	m_actions.changeBookmark = newQAction(tr("Change bookmark description..."), CResMgr::mainIndex::changeBookmark::icon, 0, this, SLOT(changeBookmark()), this);
	m_actions.importBookmarks = newQAction(tr("Import to folder..."), CResMgr::mainIndex::importBookmarks::icon, 0, this, SLOT(importBookmarks()), this);
	m_actions.exportBookmarks = newQAction(tr("Export from folder..."), CResMgr::mainIndex::exportBookmarks::icon, 0, this, SLOT(exportBookmarks()), this);
	m_actions.printBookmarks = newQAction(tr("Print bookmarks..."), CResMgr::mainIndex::printBookmarks::icon, 0, this, SLOT(printBookmarks()), this);

	m_actions.deleteEntries = newQAction(tr("Remove selected items..."), CResMgr::mainIndex::deleteItems::icon, 0, this, SLOT(deleteEntries()), this);


	//fill the popup menu itself
	m_popup->addAction(m_actions.newFolder);
	m_popup->addAction(m_actions.changeFolder);
	QAction* separator = new QAction(this);
	separator->setSeparator(true);
	m_popup->addAction(separator);
	m_popup->addAction(m_actions.changeBookmark);
	m_popup->addAction(m_actions.importBookmarks);
	m_popup->addAction(m_actions.exportBookmarks);
	m_popup->addAction(m_actions.printBookmarks);
	separator = new QAction(this);
	separator->setSeparator(true);
	m_popup->addAction(separator);
	m_popup->addAction(m_actions.deleteEntries);

	//qDebug("CBookmarkIndex::initView end");
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    // Creazione finestra
    ui->setupUi(this);
    mDialogSendIp = NULL;
    mDialogText = NULL;
    mDialogAbout = NULL;
    mNetworkSession = NULL;

    // Creazione menu'
    mSendFileAction = new QAction("Send a file", this);
    menuBar()->addAction(mSendFileAction);
    connect(mSendFileAction, SIGNAL(triggered()), this, SLOT(selectFileToSend()));

    mSendTextAction = new QAction("Send text message", this);
    menuBar()->addAction(mSendTextAction);
    connect(mSendTextAction, SIGNAL(triggered()), this, SLOT(showSendTextDialog()));

    mSendToIPAction = new QAction("Send by IP", this);
    menuBar()->addAction(mSendToIPAction);
    connect(mSendToIPAction, SIGNAL(triggered()), this, SLOT(sendToIp()));

    mCurrentIPAction = new QAction("Current IP address", this);
    menuBar()->addAction(mCurrentIPAction);
    connect(mCurrentIPAction, SIGNAL(triggered()), this, SLOT(showCurrentIP()));

    mChangeFolderAction = new QAction("Change folder", this);
    menuBar()->addAction(mChangeFolderAction);
    connect(mChangeFolderAction, SIGNAL(triggered()), this, SLOT(changeFolder()));

    mChangeNameAction = new QAction("Change user name", this);
    menuBar()->addAction(mChangeNameAction);
    connect(mChangeNameAction, SIGNAL(triggered()), this, SLOT(changeName()));

    mAboutAction = new QAction("About Dukto", this);
    menuBar()->addAction(mAboutAction);
    connect(mAboutAction, SIGNAL(triggered()), this, SLOT(showAbout()));

    // Progress dialog per operazioni
    mProgressDialog = new QProgressDialog("", "", 0, 100);
    mProgressDialog->setWindowModality(Qt::WindowModal);

    // Connecting dialog
    mConnectingDialog = new QProgressDialog("\nConnecting...", "", 0, 0);
    mConnectingDialog->setCancelButton(NULL);
    mConnectingDialog->setAutoClose(false);
    mConnectingDialog->setMinimumDuration(0);
    mConnectingDialog->setWindowModality(Qt::WindowModal);

    // Percorso salvato
    QSettings settings("msec.it", "Dukto");
    QString path = settings.value("dukto/currentpath", "C:/Dukto").toString();
    QDir d;
    if (d.mkpath(path))
    {
        QDir::setCurrent(path);
        ui->labelDest->setText("Folder: " + path.replace('/', "\\"));
    }

    // Percorso di default
    else
    {
        path = "C:/Dukto";
        d.mkpath(path);
        QDir::setCurrent(path);
        ui->labelDest->setText("Folder: " + path.replace('/', "\\"));
        settings.setValue("dukto/currentpath", path);
    }

    // Inizialmente nascondo la lista
    ui->listWidget->setVisible(false);

}