BearerMonitor::BearerMonitor(QWidget *parent)
:   QWidget(parent)
{
    setupUi(this);
#ifdef MAEMO_UI
    newSessionButton->hide();
    deleteSessionButton->hide();
#else
    delete tabWidget->currentWidget();
    sessionGroup->hide();
#endif
    updateConfigurations();
    onlineStateChanged(!manager.allConfigurations(QNetworkConfiguration::Active).isEmpty());
    QNetworkConfiguration defaultConfiguration = manager.defaultConfiguration();
    for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) {
        QTreeWidgetItem *item = treeWidget->topLevelItem(i);

        if (item->data(0, Qt::UserRole).toString() == defaultConfiguration.identifier()) {
            treeWidget->setCurrentItem(item);
            showConfigurationFor(item);
            break;
        }
    }
    connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
    connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
            this, SLOT(configurationAdded(const QNetworkConfiguration&)));
    connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
            this, SLOT(configurationRemoved(const QNetworkConfiguration&)));
    connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
            this, SLOT(configurationChanged(const QNetworkConfiguration)));
    connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));

#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
    connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
    connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork()));
#else // Q_OS_WIN && !Q_OS_WINRT
    nlaGroup->hide();
#endif

    connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
            this, SLOT(createSessionFor(QTreeWidgetItem*)));

    connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            this, SLOT(showConfigurationFor(QTreeWidgetItem*)));

    connect(newSessionButton, SIGNAL(clicked()),
            this, SLOT(createNewSession()));
#ifndef MAEMO_UI
    connect(deleteSessionButton, SIGNAL(clicked()),
            this, SLOT(deleteSession()));
#endif
    connect(scanButton, SIGNAL(clicked()),
            this, SLOT(performScan()));

    // Just in case update all configurations so that all
    // configurations are up to date.
    manager.updateConfigurations();
}
SessionManager::SessionManager(Window* parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint),
	m_session(0),
	m_window(parent)
{
	setWindowTitle(tr("Manage Sessions"));

	// Create session lists
	m_sessions_menu = new QMenu(this);
	m_sessions_menu->setTitle(tr("S&essions"));
	m_sessions_actions = new QActionGroup(this);
	connect(m_sessions_actions, SIGNAL(triggered(QAction*)), this, SLOT(switchSession(QAction*)));

	m_sessions_list = new QListWidget(this);
	m_sessions_list->setIconSize(QSize(16,16));
	m_sessions_list->setMovement(QListWidget::Static);
	m_sessions_list->setResizeMode(QListWidget::Adjust);
	m_sessions_list->setSelectionMode(QListWidget::SingleSelection);
	connect(m_sessions_list, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(selectedSessionChanged(QListWidgetItem*)));
	connect(m_sessions_list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(switchSession()));

	// Create buttons
	QPushButton* new_button = new QPushButton(tr("New"), this);
	connect(new_button, SIGNAL(clicked()), this, SLOT(newSession()));

	m_rename_button = new QPushButton(tr("Rename"), this);
	connect(m_rename_button, SIGNAL(clicked()), this, SLOT(renameSession()));

	QPushButton* clone_button = new QPushButton(tr("Clone"), this);
	connect(clone_button, SIGNAL(clicked()), this, SLOT(cloneSession()));

	m_delete_button = new QPushButton(tr("Delete"), this);
	connect(m_delete_button, SIGNAL(clicked()), this, SLOT(deleteSession()));

	m_switch_button = new QPushButton(tr("Switch To"), this);
	connect(m_switch_button, SIGNAL(clicked()), this, SLOT(switchSession()));

	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));

	// Lay out window
	QGridLayout* layout = new QGridLayout(this);
	layout->setColumnStretch(0, 1);
	layout->setRowStretch(5, 1);

	layout->addWidget(m_sessions_list, 0, 0, 6, 1);

	layout->addWidget(new_button, 0, 1);
	layout->addWidget(m_rename_button, 1, 1);
	layout->addWidget(clone_button, 2, 1);
	layout->addWidget(m_delete_button, 3, 1);
	layout->addWidget(m_switch_button, 4, 1);

	layout->addWidget(buttons, 7, 1);

	// Restore size
	resize(QSettings().value("SessionManager/Size", sizeHint()).toSize());
}
Beispiel #3
0
SessionsManagerDialog::SessionsManagerDialog(QWidget *parent) : Dialog(parent),
	m_ui(new Ui::SessionsManagerDialog)
{
	m_ui->setupUi(this);
	m_ui->openInExistingWindowCheckBox->setChecked(SettingsManager::getValue(SettingsManager::Sessions_OpenInExistingWindowOption).toBool());

	const QStringList sessions(SessionsManager::getSessions());
	QMultiHash<QString, SessionInformation> information;

	for (int i = 0; i < sessions.count(); ++i)
	{
		const SessionInformation session(SessionsManager::getSession(sessions.at(i)));

		information.insert((session.title.isEmpty() ? tr("(Untitled)") : session.title), session);
	}

	QStandardItemModel *model(new QStandardItemModel(this));
	model->setHorizontalHeaderLabels(QStringList({tr("Title"), tr("Identifier"), tr("Windows")}));

	const QList<SessionInformation> sorted(information.values());
	const QString currentSession(SessionsManager::getCurrentSession());
	int row(0);

	for (int i = 0; i < sorted.count(); ++i)
	{
		int windows(0);

		for (int j = 0; j < sorted.at(i).windows.count(); ++j)
		{
			windows += sorted.at(i).windows.at(j).windows.count();
		}

		if (sorted.at(i).path == currentSession)
		{
			row = i;
		}

		QList<QStandardItem*> items({new QStandardItem(sorted.at(i).title.isEmpty() ? tr("(Untitled)") : sorted.at(i).title), new QStandardItem(sorted.at(i).path), new QStandardItem(tr("%n window(s) (%1)", "", sorted.at(i).windows.count()).arg(tr("%n tab(s)", "", windows)))});
		items[0]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		items[1]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		items[2]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

		model->appendRow(items);
	}

	m_ui->sessionsViewWidget->setModel(model);

	connect(m_ui->openButton, SIGNAL(clicked()), this, SLOT(openSession()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteSession()));
	connect(m_ui->sessionsViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions()));

	m_ui->sessionsViewWidget->setCurrentIndex(m_ui->sessionsViewWidget->getIndex(row, 0));
}
void MainWindow::setupClassViewer()
{
    tbtnAdd_class->setAction(actionAdd_class, true);
    tbtnAdd_class->setText(tr("Add"));
    tbtnAdd_class->setIconSize(QSize(16, 16));
    tbtnDelete_class->setAction(actionDelete_class, true);
    tbtnDelete_class->setText(tr("Delete"));
    tbtnDelete_class->setIconSize(QSize(16, 16));
    tbtnAdd_student->setAction(actionAdd_student, true);
    tbtnAdd_student->setText(tr("Add"));
    tbtnAdd_student->setIconSize(QSize(16, 16));
    tbtnDelete_student->setAction(actionDelete_student, true);
    tbtnDelete_student->setText(tr("Delete"));
    tbtnDelete_student->setIconSize(QSize(16, 16));
    tbtnAdd_session->setAction(actionAdd_session, true);
    tbtnAdd_session->setText(tr("Add"));
    tbtnAdd_session->setIconSize(QSize(16, 16));
    tbtnDelete_session->setAction(actionDelete_session, true);
    tbtnDelete_session->setText(tr("Delete"));
    tbtnDelete_session->setIconSize(QSize(16, 16));
    QObject::connect(actionAdd_class, SIGNAL(triggered()), this, SLOT(addClass()));
    QObject::connect(actionDelete_class, SIGNAL(triggered()), this, SLOT(deleteClass()));
    QObject::connect(actionPrint_class_summary, SIGNAL(triggered()), this, SLOT(printClassSummary()));
    QObject::connect(actionAdd_student, SIGNAL(triggered()), this, SLOT(addStudent()));
    QObject::connect(actionDelete_student, SIGNAL(triggered()), this, SLOT(deleteStudent()));
    QObject::connect(actionAdd_session, SIGNAL(triggered()), this, SLOT(addSession()));
    QObject::connect(actionDelete_session, SIGNAL(triggered()), this, SLOT(deleteSession()));
    QObject::connect(CLSCFirstYearSpinBox, SIGNAL(valueChanged(int)), CLSCLastYearSpinBox, SLOT(setMinimum(int)));
    QObject::connect(CLLCListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(setCurrentClass(QListWidgetItem *)));
    QObject::connect(CLLSListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(setCurrentClassMember(QListWidgetItem *)));
    QObject::connect(CLLSSListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(viewSession(QListWidgetItem *)));
    QObject::connect(CLLSSListWidget, SIGNAL(currentIndexAvailabilityChanged(bool)), actionDelete_session, SLOT(setEnabled(bool)));
    QObject::connect(CLLSSListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(toggleAddSessionToMemberEnabled()));
    QObject::connect(CLSSResultsTableWidget, SIGNAL(currentIndexAvailabilityChanged(bool)), tbtnRemoveSession, SLOT(setEnabled(bool)));
    QObject::connect(CLSSResultsTableWidget, SIGNAL(itemDoubleClicked(QTableWidgetItem *)), this, SLOT(viewSessionAndStudent(QTableWidgetItem *)));
    QObject::connect(CLLCSearchLineEdit, SIGNAL(textChanged(QLineEdit *, const QString &)), CLLCListWidget, SLOT(filterItems(QLineEdit *, const QString &)));
    QObject::connect(CLLSSearchLineEdit, SIGNAL(textChanged(QLineEdit *, const QString &)), CLLSListWidget, SLOT(filterItems(QLineEdit *, const QString &)));
    QObject::connect(CLLSSSearchLineEdit, SIGNAL(textChanged(QLineEdit *, const QString &)), CLLSSListWidget, SLOT(filterItems(QLineEdit *, const QString &)));
    QObject::connect(tbtnApplyClassChanges, SIGNAL(released()), this, SLOT(updateClassProperties()));
    QObject::connect(tbtnSaveMemberName, SIGNAL(released()), this, SLOT(updateClassMemberName()));
    QObject::connect(tbtnAddSession, SIGNAL(released()), this, SLOT(addSessionToMember()));
    QObject::connect(tbtnRemoveSession, SIGNAL(released()), this, SLOT(removeSessionFromMember()));
    CLLCListWidget->setSortingEnabled(true);
    CLLSSListWidget->setSortingEnabled(true);
    CLSSResultsTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    CLSSResultsTableWidget->verticalHeader()->hide();
    CLSSResultsTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    setCLSCEnabled(false);
}
SessionsManagerDialog::SessionsManagerDialog(QWidget *parent) : Dialog(parent),
	m_ui(new Ui::SessionsManagerDialog)
{
	m_ui->setupUi(this);
	m_ui->openInExistingWindowCheckBox->setChecked(SettingsManager::getValue(QLatin1String("Sessions/OpenInExistingWindow")).toBool());

	const QStringList sessions = SessionsManager::getSessions();
	QMultiHash<QString, SessionInformation> information;

	for (int i = 0; i < sessions.count(); ++i)
	{
		const SessionInformation session = SessionsManager::getSession(sessions.at(i));

		information.insert((session.title.isEmpty() ? tr("(Untitled)") : session.title), session);
	}

	const QList<SessionInformation> sorted = information.values();
	const QString currentSession = SessionsManager::getCurrentSession();
	int index = 0;

	m_ui->sessionsWidget->setRowCount(sorted.count());

	for (int i = 0; i < sorted.count(); ++i)
	{
		int windows = 0;

		for (int j = 0; j < sorted.at(i).windows.count(); ++j)
		{
			windows += sorted.at(i).windows.at(j).windows.count();
		}

		if (sorted.at(i).path == currentSession)
		{
			index = i;
		}

		m_ui->sessionsWidget->setItem(i, 0, new QTableWidgetItem(sorted.at(i).title.isEmpty() ? tr("(Untitled)") : sorted.at(i).title));
		m_ui->sessionsWidget->setItem(i, 1, new QTableWidgetItem(sorted.at(i).path));
		m_ui->sessionsWidget->setItem(i, 2, new QTableWidgetItem(QStringLiteral("%1 (%2)").arg(sorted.at(i).windows.count()).arg(windows)));
	}

	connect(m_ui->openButton, SIGNAL(clicked()), this, SLOT(openSession()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteSession()));
	connect(m_ui->sessionsWidget, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(currentChanged(int)));

	m_ui->sessionsWidget->setCurrentCell(index, 0);
}
Beispiel #6
0
// 
// Removes the session for the given procid from the list of interested
// sessions in this file. This method also invokes an rpc on the server
// session to remove this file from the patterns registered by this
// procid. The rpc call to the session will return a special status code
// TT_WRN_STALE_OBJID if this method is to actually remove the session
// from the file property of interested sessions. This is because the
// server session keeps a counter of how many procids are interested in
// each file.
// 
Tt_status
_Tt_c_file::c_quit(
	_Tt_procid_ptr &p
)
{
	_Tt_file_join_args		args;
	Tt_status			rs;
	Tt_status			status;
	_Tt_session_ptr			d_session;
		
	if (p.is_null()) {
		return(TT_ERR_PROCID);
	}
	d_session = ((_Tt_c_procid *)p.c_pointer())->default_session();
	if (d_session.is_null()) {
		return(TT_ERR_SESSION);
	}
	args.procid = p;
	args.path = getNetworkPath();
	rs = d_session->call(TT_RPC_QUIT_FILE,
			     (xdrproc_t)tt_xdr_file_join_args,
			     (char *)&args,
			     (xdrproc_t)xdr_int,
			     (char *)&status);
	if (status == TT_WRN_NOTFOUND) {
		status = TT_OK; 
	} else if (status == TT_WRN_STALE_OBJID) {
		_Tt_db_results dbStatus;
		dbStatus = deleteSession( d_session->process_tree_id() );
		if (dbStatus == TT_DB_ERR_NO_SUCH_PROPERTY) {
			status = TT_OK;
		} else {
			status = _tt_get_api_error( dbStatus, _TT_API_FILE );
		}
		if (status == TT_ERR_INTERNAL) {
			_tt_syslog( 0, LOG_WARNING,
				    "_Tt_db_file::deleteSession(): %d",
				    dbStatus );
			status = TT_ERR_INTERNAL;
		}
	}
	p->del_joined_file(getNetworkPath());
	return((status == TT_OK) ? rs : status);
}
Beispiel #7
0
void 
complete_T5(ThreadData * data){

  data->generator.transactions[4].stopLatency();
  data->generator.transactions[4].count++;

  if(data->transactionData.branchExecuted)
    data->generator.transactions[4].branchExecuted++;
  if(data->transactionData.do_rollback)
    data->generator.transactions[4].rollbackExecuted++;
  
  if(data->transactionData.sessionElement && 
     !data->transactionData.do_rollback){
    deleteSession(&data->generator.activeSessions);
  }
  
  data->runState = Runnable;
  data->generator.totalTransactions++;
}
SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent)
:   QWidget(parent), statsTimer(-1)
{
    setupUi(this);

#ifdef QT_NO_NETWORKINTERFACE
    interfaceName->setVisible(false);
    interfaceNameLabel->setVisible(false);
    interfaceGuid->setVisible(false);
    interfaceGuidLabel->setVisible(false);
#endif

    session = new QNetworkSession(config, this);

    connect(session, SIGNAL(stateChanged(QNetworkSession::State)),
            this, SLOT(updateSession()));
    connect(session, SIGNAL(error(QNetworkSession::SessionError)),
            this, SLOT(updateSessionError(QNetworkSession::SessionError)));

    updateSession();

    sessionId->setText(QString("0x%1").arg(qulonglong(session), 8, 16, QChar('0')));

    configuration->setText(session->configuration().name());

    connect(openSessionButton, SIGNAL(clicked()),
            this, SLOT(openSession()));
    connect(openSyncSessionButton, SIGNAL(clicked()),
            this, SLOT(openSyncSession()));
    connect(closeSessionButton, SIGNAL(clicked()),
            this, SLOT(closeSession()));
    connect(stopSessionButton, SIGNAL(clicked()),
            this, SLOT(stopSession()));
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    connect(deleteSessionButton, SIGNAL(clicked()),
            this, SLOT(deleteSession()));
#endif
}
Beispiel #9
0
// Constructor
MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine)
    :
      QMainWindow(parent),
      m_posInitialized(false),
      force_exit(false),
      icon_TrayConn(res::trayConnected()),
      icon_TrayDisconn(res::trayDisconnected()),
      icon_CurTray(icon_TrayDisconn)
{
    setupUi(this);
    stackedWidget->addWidget(new transfers_widget(this));
    stackedWidget->addWidget(new search_widget(this));
    stackedWidget->addWidget(new preferences_widget(this));
    stackedWidget->setCurrentIndex(0);
    setWindowTitle(tr("qDonkey %1").arg(misc::versionString()));
    QCoreApplication::instance()->installEventFilter(this);

    //QApplication::setOverrideCursor(Qt::WaitCursor);
    m_last_file_error = QDateTime::currentDateTime().addSecs(-1); // imagine last file error event was 1 seconds in past

#ifdef Q_WS_WIN
    m_nTaskbarButtonCreated = RegisterWindowMessage(L"TaskbarButtonCreated");
#else
    m_nTaskbarButtonCreated = 0;
#endif

    Preferences pref;

    // Clean exit on log out
    connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteSession()));

    this->setWindowIcon(QIcon(res::favicon()));

#ifdef Q_WS_MAC
    connect(static_cast<QMacApplication*>(qApp), SIGNAL(newFileOpenMacEvent(QString)), this, SLOT(processParams(QString)));
#endif

    statusBar = new status_bar(this, QMainWindow::statusBar());
    m_pwr = new PowerManagement(this);

    // Configure session according to options
    loadPreferences(false);

    // Start connection checking timer
    guiUpdater = new QTimer(this);
    connect(guiUpdater, SIGNAL(timeout()), this, SLOT(updateGUI()));
    guiUpdater->start(2000);

    // Accept drag 'n drops
    //setAcceptDrops(true);
    createKeyboardShortcuts();

#ifdef Q_WS_MAC
    setUnifiedTitleAndToolBarOnMac(true);
#endif

    // View settings



    // Auto shutdown actions
/*    QActionGroup * autoShutdownGroup = new QActionGroup(this);
    autoShutdownGroup->setExclusive(true);
    autoShutdownGroup->addAction(actionAutoShutdown_Disabled);
    autoShutdownGroup->addAction(actionAutoExit_mule);
    autoShutdownGroup->addAction(actionAutoShutdown_system);
    autoShutdownGroup->addAction(actionAutoSuspend_system);

#if !defined(Q_WS_X11) || defined(QT_DBUS_LIB)
    actionAutoShutdown_system->setChecked(pref.shutdownWhenDownloadsComplete());
    actionAutoSuspend_system->setChecked(pref.suspendWhenDownloadsComplete());
#else
    actionAutoShutdown_system->setDisabled(true);
    actionAutoSuspend_system->setDisabled(true);
#endif

    actionAutoExit_mule->setChecked(pref.shutdownqBTWhenDownloadsComplete());

    if (!autoShutdownGroup->checkedAction())
        actionAutoShutdown_Disabled->setChecked(true);
*/

    readSettings();

    show();
    activateWindow();
    raise();

    // Start watching the executable for updates
    executable_watcher = new QFileSystemWatcher();
    connect(executable_watcher, SIGNAL(fileChanged(QString)), this, SLOT(notifyOfUpdate(QString)));
    executable_watcher->addPath(qApp->applicationFilePath());

    // Add torrent given on command line
    processParams(torrentCmdLine);
#ifdef Q_WS_MAC
    //qt_mac_set_dock_menu(icon_CurTray);
#endif

    // Make sure the Window is visible if we don't have a tray icon
    if (!systrayIcon && isHidden())  {
        show();
        activateWindow();
        raise();
    }

    connect(Session::instance(), SIGNAL(serverNameResolved(QString)), this, SLOT(handleServerNameResolved(QString)));
    connect(Session::instance(), SIGNAL(serverConnectionInitialized(quint32,quint32,quint32)), this, SLOT(handleServerConnectionInitialized(quint32,quint32,quint32)));
    connect(Session::instance(), SIGNAL(serverConnectionClosed(QString)), this, SLOT(handleServerConnectionClosed(QString)));
    connect(Session::instance(), SIGNAL(serverStatus(int,int)), this, SLOT(handleServerStatus(int,int)));
    connect(Session::instance(), SIGNAL(serverMessage(QString)), this, SLOT(handleServerMessage(QString)));
    connect(Session::instance(), SIGNAL(serverIdentity(QString,QString)), this, SLOT(handleServerIdentity(QString,QString)));

    connect(Session::instance(), SIGNAL(transferAdded(QED2KHandle)), SLOT(addedTransfer(QED2KHandle)));
    connect(Session::instance(), SIGNAL(transferFinished(QED2KHandle)), SLOT(finishedTransfer(QED2KHandle)));

    //Tray actions.
    //connect(actionToggleVisibility, SIGNAL(triggered()), this, SLOT(toggleVisibility()));
    //connect(actionStart_All, SIGNAL(triggered()), Session::instance(), SLOT(resumeAllTransfers()));
    //connect(actionPause_All, SIGNAL(triggered()), Session::instance(), SLOT(pauseAllTransfers()));

    actionConnect->trigger();
    Session::instance()->loadDirectory(pref.inputDir());
}