Example #1
0
void ImportMusicDialog::addAllNewPressed()
{
    if (m_tracks->size() == 0)
        return;

    m_currentTrack = 0;
    int newCount = 0;

    while (m_currentTrack < (int) m_tracks->size())
    {
        fillWidgets();
        qApp->processEvents();

        if (m_tracks->at(m_currentTrack)->isNewTune)
        {
            addPressed();
            newCount++;
        }

        qApp->processEvents();

        m_currentTrack++;
    }

    m_currentTrack--;

    ShowOkPopup(tr("%1 new tracks were added to the database").arg(newCount));
}
Example #2
0
 ScanFolderPrefPage::ScanFolderPrefPage(ScanFolderPlugin* plugin, QWidget* parent)
     : PrefPageInterface(ScanFolderPluginSettings::self(), i18nc("plugin name", "Scan Folder"), "folder-open", parent), m_plugin(plugin)
 {
     setupUi(this);
     connect(kcfg_actionDelete, SIGNAL(toggled(bool)), kcfg_actionMove, SLOT(setDisabled(bool)));
     connect(m_add, SIGNAL(clicked()), this, SLOT(addPressed()));
     connect(m_remove, SIGNAL(clicked()), this, SLOT(removePressed()));
     connect(m_folders, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
     connect(m_group, SIGNAL(currentIndexChanged(int)), this, SLOT(currentGroupChanged(int)));
 }
Example #3
0
DomainListView::DomainListView(KConfig *config,const QString &title,
		QWidget *parent,const char *name) :
	QGroupBox(title, parent, name), config(config) {
  setColumnLayout(0, Qt::Vertical);
  layout()->setSpacing(0);
  layout()->setMargin(0);
  QGridLayout* thisLayout = new QGridLayout(layout());
  thisLayout->setAlignment(Qt::AlignTop);
  thisLayout->setSpacing(KDialog::spacingHint());
  thisLayout->setMargin(KDialog::marginHint());

  domainSpecificLV = new KListView(this);
  domainSpecificLV->addColumn(i18n("Host/Domain"));
  domainSpecificLV->addColumn(i18n("Policy"), 100);
  connect(domainSpecificLV,SIGNAL(doubleClicked(QListViewItem *)), SLOT(changePressed()));
  connect(domainSpecificLV,SIGNAL(returnPressed(QListViewItem *)), SLOT(changePressed()));
  connect(domainSpecificLV, SIGNAL( executed( QListViewItem *)), SLOT( updateButton()));
  connect(domainSpecificLV, SIGNAL(selectionChanged()), SLOT(updateButton()));
  thisLayout->addMultiCellWidget(domainSpecificLV, 0, 5, 0, 0);

  addDomainPB = new QPushButton(i18n("&New..."), this);
  thisLayout->addWidget(addDomainPB, 0, 1);
  connect(addDomainPB, SIGNAL(clicked()), SLOT(addPressed()));

  changeDomainPB = new QPushButton( i18n("Chan&ge..."), this);
  thisLayout->addWidget(changeDomainPB, 1, 1);
  connect(changeDomainPB, SIGNAL(clicked()), this, SLOT(changePressed()));

  deleteDomainPB = new QPushButton(i18n("De&lete"), this);
  thisLayout->addWidget(deleteDomainPB, 2, 1);
  connect(deleteDomainPB, SIGNAL(clicked()), this, SLOT(deletePressed()));

  importDomainPB = new QPushButton(i18n("&Import..."), this);
  thisLayout->addWidget(importDomainPB, 3, 1);
  connect(importDomainPB, SIGNAL(clicked()), this, SLOT(importPressed()));
  importDomainPB->setEnabled(false);
  importDomainPB->hide();

  exportDomainPB = new QPushButton(i18n("&Export..."), this);
  thisLayout->addWidget(exportDomainPB, 4, 1);
  connect(exportDomainPB, SIGNAL(clicked()), this, SLOT(exportPressed()));
  exportDomainPB->setEnabled(false);
  exportDomainPB->hide();

  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
  thisLayout->addItem(spacer, 5, 1);

  QWhatsThis::add( addDomainPB, i18n("Click on this button to manually add a host or domain "
                                       "specific policy.") );
  QWhatsThis::add( changeDomainPB, i18n("Click on this button to change the policy for the "
                                          "host or domain selected in the list box.") );
  QWhatsThis::add( deleteDomainPB, i18n("Click on this button to delete the policy for the "
                                          "host or domain selected in the list box.") );
  updateButton();
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setListFile();
    model = new TableModel(this);
    model->setSettings(&settings);
    model->readFromFile(listfile);
    ui->tableView->setModel(model);
    readSettings();

    if (settings.trayicon)
    {
        trayicon = new QSystemTrayIcon(this->windowIcon(), this);
        connect(trayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                    this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));

        traymenu = new QMenu(this);
        traymenu->addAction(ui->actionStart);
        traymenu->addAction(ui->actionStop);
        traymenu->addAction(ui->actionExit);

        trayicon->setContextMenu(traymenu);
        trayicon->setToolTip(tr("Upcoder"));
        trayicon->show();
    } else
    {
        trayicon = 0;
        traymenu = 0;
    }

    time = new QTime();

    settingsdialog = 0;
    resdialog = 0;

    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settingsPressed()));
    connect(ui->actionAdd, SIGNAL(triggered()), this, SLOT(addPressed()));
    connect(ui->actionDelete, SIGNAL(triggered()), this, SLOT(deletePressed()));
    connect(ui->actionClear, SIGNAL(triggered()), model, SLOT(clear()));
    connect(ui->actionStart, SIGNAL(triggered()), model, SLOT(startUploading()));
    connect(ui->actionStop, SIGNAL(triggered()), model, SLOT(stopUploading()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exitApplication()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->actionShow_links_to_files, SIGNAL(triggered()), this, SLOT(showLinks()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPressed()));
    connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showLinks()));

    connect(model, SIGNAL(statusChanged(QString)), ui->statusBar, SLOT(showMessage(QString)));
    connect(model, SIGNAL(progress(qint64,qint64)), this, SLOT(uploadProgress(qint64,qint64)));
    connect(model, SIGNAL(uploadingStarted()), this, SLOT(uploadingStarted()));
    connect(model, SIGNAL(allUploadsStarted()), this, SLOT(allUploadsStarted()));
    connect(model, SIGNAL(allUploadsFinished()), this, SLOT(allUploadsFinished()));
}
Example #5
0
bool ImportMusicDialog::Create()
{
    if (!LoadWindowFromXML("music-ui.xml", "import_music", this))
        return false;

    bool err = false;
    UIUtilE::Assign(this, m_locationEdit,    "location", &err);
    UIUtilE::Assign(this, m_locationButton,  "directoryfinder", &err);
    UIUtilE::Assign(this, m_scanButton,      "scan", &err);
    UIUtilE::Assign(this, m_coverartButton,  "coverart", &err);
    UIUtilE::Assign(this, m_filenameText,    "filename", &err);
    UIUtilE::Assign(this, m_compartistText,  "compartist", &err);
    UIUtilE::Assign(this, m_artistText,      "artist", &err);
    UIUtilE::Assign(this, m_albumText,       "album", &err);
    UIUtilE::Assign(this, m_titleText,       "title", &err);
    UIUtilE::Assign(this, m_genreText,       "genre", &err);
    UIUtilE::Assign(this, m_yearText,        "year", &err);
    UIUtilE::Assign(this, m_trackText,       "track", &err);
    UIUtilE::Assign(this, m_currentText,     "position", &err);
    UIUtilE::Assign(this, m_statusText,      "status", &err);
    UIUtilE::Assign(this, m_compilationCheck,"compilation", &err);
    UIUtilE::Assign(this, m_playButton,      "play", &err);
    UIUtilE::Assign(this, m_nextnewButton,   "nextnew", &err);
    UIUtilE::Assign(this, m_addButton,       "add", &err);
    UIUtilE::Assign(this, m_addallnewButton, "addallnew", &err);
    UIUtilE::Assign(this, m_nextButton,      "next", &err);
    UIUtilE::Assign(this, m_prevButton,      "prev", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_music'");
        return false;
    }

    connect(m_prevButton, SIGNAL(Clicked()), SLOT(prevPressed()));
    connect(m_locationButton, SIGNAL(Clicked()), SLOT(locationPressed()));
    connect(m_scanButton, SIGNAL(Clicked()), SLOT(startScan()));
    connect(m_coverartButton, SIGNAL(Clicked()), SLOT(coverArtPressed()));
    connect(m_playButton, SIGNAL(Clicked()), SLOT(playPressed()));
    connect(m_nextnewButton, SIGNAL(Clicked()), SLOT(nextNewPressed()));
    connect(m_addButton, SIGNAL(Clicked()), SLOT(addPressed()));
    connect(m_addallnewButton, SIGNAL(Clicked()), SLOT(addAllNewPressed()));
    connect(m_nextButton, SIGNAL(Clicked()), SLOT(nextPressed()));

    fillWidgets();

    BuildFocusList();

    m_locationEdit->SetText(gCoreContext->GetSetting("MythMusicLastImportDir", "/"));

    return true;
}
Example #6
0
UserAgentDlg::UserAgentDlg(QWidget *parent) : KCModule(parent, "kcmkio")
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());

    dlg = new UserAgentDlgUI(this);
    mainLayout->addWidget(dlg);

    dlg->lvDomainPolicyList->setSorting(0);

    connect(dlg->cbSendUAString, SIGNAL(clicked()), SLOT(configChanged()));

    connect(dlg->gbDefaultId, SIGNAL(clicked(int)), SLOT(changeDefaultUAModifiers(int)));

    connect(dlg->lvDomainPolicyList, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
    connect(dlg->lvDomainPolicyList, SIGNAL(doubleClicked(QListViewItem *)), SLOT(changePressed()));
    connect(dlg->lvDomainPolicyList, SIGNAL(returnPressed(QListViewItem *)), SLOT(changePressed()));

    connect(dlg->pbNew, SIGNAL(clicked()), SLOT(addPressed()));
    connect(dlg->pbChange, SIGNAL(clicked()), SLOT(changePressed()));
    connect(dlg->pbDelete, SIGNAL(clicked()), SLOT(deletePressed()));
    connect(dlg->pbDeleteAll, SIGNAL(clicked()), SLOT(deleteAllPressed()));

    load();
}
Example #7
0
int
main(int argc, char** argv)
{
    QApplication app(argc, argv);
    /*if(argc == 1)
    {
	return();
	}*/
    //NOTE(hugo): Creating Window
    QMainWindow window(0, Qt::Window);
    window.setWindowTitle("QTODO");
    window.resize(400,500);
    window.setWindowIcon(QIcon("2048.jpg"));
    
    //NOTE(hugo): Creating main layout
    //IMPORTANT(hugo): Should we set the parent of mainLayout to window ?
    QVBoxLayout mainLayout;
    
    //NOTE(hugo): Just a token to have a control structure.
    QWidget* centralWidget = new QWidget(&window);
    centralWidget->setLayout(&mainLayout);
    
    ToDoWidget* mainWidget = new ToDoWidget(QString(), &window); 
    
    window.setCentralWidget(centralWidget);

    //NOTE(hugo): Creating the Menu Bar
    //TODO(hugo): Make a more beautiful bar
    QMenuBar* menuBar = window.menuBar();
    QMenu* FileMenu = menuBar->addMenu("File");
    QMenu* ToDoMenu = menuBar->addMenu("ToDoS");
    QMenu* CatMenu = menuBar->addMenu("Category");


    FileMenu->addAction("New File...", mainWidget,
			SLOT(newFilePressed()),
			QKeySequence("Ctrl+N"));
    FileMenu->addAction("Open File...", mainWidget,
			SLOT(openFilePressed()),
			QKeySequence("Ctrl+O"));
    FileMenu->addAction("Save As...", mainWidget,
			SLOT(saveAsPressed()),
			QKeySequence("Ctrl+S"));
    
    ToDoMenu->addAction("Add ToDo", mainWidget,
			SLOT(addPressed()),
			QKeySequence("Ctrl+A"));
    ToDoMenu->addAction("Delete ToDo", mainWidget,
		    SLOT(delPressed()));
    

    CatMenu->addAction("Add Category", mainWidget,
		       SLOT(addCatPressed()));
    CatMenu->addAction("Delete Category", mainWidget,
		       SLOT(delCatPressed()));
    
    //NOTE(hugo): Adding it all to the layout
    mainLayout.addWidget(mainWidget->GetMainGroupBox());

        
    //NOTE(hugo): Setting the layout and displaying the window
    //window.setLayout(&mainLayout);
    window.show();

    
    return(app.exec());
}
void TabbedTableItem::createDataModel()
{
 if (manager!=nullptr)
  tableAction->setManager(manager);
 dataModel = (BeanTableDataModel*)tableAction->getTableDataModel();
 //        dataModel->updateNameList();
//        TableSorter sorter = new TableSorter(dataModel);
 MySortFilterProxyModel* sorter = new MySortFilterProxyModel();
 sorter->setSourceModel(dataModel);
 dataTable = dataModel->makeJTable(dataModel->getMasterClassName() + ":" + getItemString(), dataModel, sorter);

 tableAction->table = dataTable;
 //sorter->setSourceModel(dataModel);
 dataTable->setSortingEnabled(true);
 //sorter.setTableHeader(dataTable.getTableHeader());
 //dataScroll	= new JScrollPane(dataTable);

//        try {
//            TableSorter tmodel = ((TableSorter)dataTable.getModel());
//            tmodel.setColumnComparator(String.class, new jmri.util.SystemNameComparator());
//            tmodel.setSortingStatus(BeanTableDataModel.SYSNAMECOL, TableSorter.ASCENDING);
//        } catch (java.lang.ClassCastException e) {}  // happens if not sortable table

 dataModel->configureTable(dataTable);
 dataModel->loadTableColumnDetails(dataTable, dataModel->getMasterClassName()+":"+getItemString());
 //dataModel->setPersistentButtons();


 QSize dataTableSize = dataTable->sizeHint();
 // width is right, but if table is empty, it's not high
 // enough to reserve much space.
 dataTableSize.setHeight(qMax(dataTableSize.height(), 400));
 //dataScroll.getViewport().setPreferredSize(dataTableSize);

 // set preferred scrolling options
 // dataScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
 //dataScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

 //dataPanel.setLayout(new BoxLayout(dataPanel, BoxLayout.Y_AXIS));
 dataPanel->resize(600,290);
 //QGridLayout* dataPanelLayout;
// if(dataPanel->layout() != NULL)
//  dataPanelLayout = (QGridLayout*)dataPanel->layout();
// else
  //dataPanel->setLayout(dataPanelLayout= new QGridLayout);
 //dataPanel.add(dataScroll, BorderLayout.CENTER);
 dataPanelLayout->addWidget(dataTable,0,0); //, 0, Qt::AlignCenter);

 dataPanelLayout->addWidget(bottomBox,1,0); //, /*BorderLayout.SOUTH*/0, Qt::AlignBottom);
 if(tableAction->includeAddButton())
 {
  QPushButton* addButton = new QPushButton(tr("Add"));
  addToBottomBox(addButton);
//            addButton.addActionListener(new ActionListener() {
//                /*public*/ void actionPerformed(ActionEvent e) {
//                    tableAction.addPressed(e);
//                }
//            });
  QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  sizePolicy.setHorizontalStretch(0);
  sizePolicy.setVerticalStretch(0);
  sizePolicy.setHeightForWidth(addButton->sizePolicy().hasHeightForWidth());
  addButton->setSizePolicy(sizePolicy);
  connect(addButton, SIGNAL(clicked()), tableAction, SLOT(addPressed()));
 }
}