示例#1
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    accountComboBox = new CComboBox(ui->centralWidget);
    accountComboBox->setGeometry(10, 10, 200, 25);

    listWidget = new QListWidget();
    accountComboBox->setModel(listWidget->model());
    accountComboBox->setView(listWidget);
    accountComboBox->setEditable(true); //ÉèÖÃQComboBox¿É±à¼­


    for(int i = 0; i < 3; i++)
    {
        AccountItem *accountItem = new AccountItem();
        accountItem->setAccountNumber(QString("safe_") + QString::number(i, 10) + QString("@sina.com"));
        connect(accountItem, SIGNAL(showAccount(QString)), this, SLOT(showAccount(QString)));
        connect(accountItem, SIGNAL(removeAccount(QString)), this, SLOT(removeAccount(QString)));
        QListWidgetItem* listItem = new QListWidgetItem(listWidget);
        listWidget->setItemWidget(listItem, accountItem);
    }

    accountComboBox->setItemEnable(listWidget, 2, true);
}
示例#2
0
void PCloudApp::createMenus(){
    notloggedmenu=new QMenu();

    registerAction=new QAction(tr ("Register"), this);
    connect(registerAction, SIGNAL(triggered()), this, SLOT(showRegister()));
    loginAction=new QAction(tr("Login"), this);
    connect(loginAction, SIGNAL(triggered()), this, SLOT(showLogin()));
    settingsAction=new QAction(tr("Settings"), this);
    connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettings()));
    helpAction = new QAction(tr("Help"),this);
    connect(helpAction, SIGNAL(triggered()), this, SLOT(showpcloudHelp()));
    aboutPCloudAction = new QAction(tr("About"), this);
    connect(aboutPCloudAction, SIGNAL(triggered()), this, SLOT(showpCloudAbout()));
    exitAction=new QAction(tr("Exit"), this); // to be hidden in account tab
    connect(exitAction, SIGNAL(triggered()), this, SLOT(doExit()));

    notloggedmenu->addAction(registerAction);
    notloggedmenu->addAction(loginAction);
    notloggedmenu->addAction(settingsAction);
    notloggedmenu->addAction(helpAction);
    notloggedmenu->addAction(aboutPCloudAction);
    notloggedmenu->addSeparator();
    notloggedmenu->addAction(exitAction); // to be hidden in account tab or settings


    accountAction = new QAction(tr("Account"), this); // Account tab // to remove username from menu
    connect(accountAction, SIGNAL(triggered()),this, SLOT(showAccount()));
    openAction=new QAction("Open pCloud folder", this);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openCloudDir()));
    //shareFolderAction=new QAction("Share folder", this); //to del
    //connect(shareFolderAction, SIGNAL(triggered()), this, SLOT(shareFolder()));
    outgoingSharesAction=new QAction("My Shares", this); //to del
    connect(outgoingSharesAction, SIGNAL(triggered()), this, SLOT(outgoingShares()));
    incomingSharesAction=new QAction("Shared with Me", this); //to del
    connect(incomingSharesAction, SIGNAL(triggered()), this, SLOT(incomingShares()));

    sharesAction = new QAction(tr("Shares"),this);
    connect(sharesAction, SIGNAL(triggered()), this, SLOT(showShares()));


    logoutAction=new QAction("Logout", this);
    connect(logoutAction, SIGNAL(triggered()), this, SLOT(logOut()));

    openPCloudWinAction = new QAction("Open PCloud Window", this); // to del
    connect(openPCloudWinAction, SIGNAL(triggered()), this, SLOT(openpCloudWindow()));

    loggedmenu = new QMenu();
    loggedmenu->addAction(openAction);
    loggedmenu->addAction(accountAction);
    // loggedmenu->addSeparator();
    //loggedmenu->addAction(shareFolderAction); // to del
    // loggedmenu->addAction(outgoingSharesAction);
    //loggedmenu->addAction(incomingSharesAction);
    loggedmenu->addAction(sharesAction);
    loggedmenu->addAction(settingsAction);
    loggedmenu->addAction(helpAction);
    loggedmenu->addAction(aboutPCloudAction);
    loggedmenu->addSeparator();
    loggedmenu->addAction(logoutAction); // to hide in acc tab
    loggedmenu->addAction(exitAction);
    // loggedmenu->addAction(openpCloudFormAction); // first form

}