コード例 #1
0
void UbuntuOneService::Connect() {
  if (has_credentials()) {
    RequestVolumeList();
  } else {
    ShowSettingsDialog();
  }
}
コード例 #2
0
void GoogleDriveService::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    open_in_drive_action_ = context_menu_->addAction(
        QIcon(":/providers/googledrive.png"), tr("Open in Google Drive"), this,
        SLOT(OpenWithDrive()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"),
                             this, SLOT(ShowCoverManager()));
    context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."),
                             this, SLOT(ShowSettingsDialog()));
  }

  // Only show some actions if there are real songs selected
  bool songs_selected = false;
  for (const QModelIndex& index : model()->selected_indexes()) {
    const int type = index.data(LibraryModel::Role_Type).toInt();
    if (type == LibraryItem::Type_Song || type == LibraryItem::Type_Container) {
      songs_selected = true;
      break;
    }
  }

  open_in_drive_action_->setEnabled(songs_selected);

  context_menu_->popup(global_pos);
}
コード例 #3
0
void SongInfoTextView::contextMenuEvent(QContextMenuEvent* e) {
  QMenu* menu = createStandardContextMenu(e->pos());
  menu->setAttribute(Qt::WA_DeleteOnClose);

  menu->addAction(tr("Change font size..."), this, SIGNAL(ShowSettingsDialog()));

  menu->popup(e->globalPos());
}
コード例 #4
0
void CloudFileService::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    context_menu_->addAction(IconLoader::Load("download"), tr("Cover Manager"),
                             this, SLOT(ShowCoverManager()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."),
                             this, SLOT(ShowSettingsDialog()));
  }
  context_menu_->popup(global_pos);
}
コード例 #5
0
MainButton::MainButton(MainWindow* main_window)
  : main_window_(main_window), settings_(0) {
  button()->setText("Main");
  button()->setObjectName("MainButton");

  // set icon
  button()->setIcon(QIcon(":/icons/Setting.ico"));
  button()->setIconSize(QSize(30, 30));

  // set menu
  QMenu* menu = new QMenu;
  QAction* settings = menu->addAction("Settings");
  menu->addSeparator();
  QAction* quit = menu->addAction("Quit");
  button()->setMenu(menu);
  button()->setPopupMode(QToolButton::DelayedPopup);

  // bind signal and slots
  connect(quit, SIGNAL(triggered()), main_window_, SLOT(close()));
  connect(settings, SIGNAL(triggered()), this, SLOT(ShowSettingsDialog()));
  connect(button(), SIGNAL(clicked()), this, SLOT(ShowSettingsDialog()));
}
コード例 #6
0
void CloudFileService::LazyPopulate(QStandardItem* item) {
  switch (item->data(InternetModel::Role_Type).toInt()) {
    case InternetModel::Type_Service:
      if (!has_credentials()) {
        ShowSettingsDialog();
      } else {
        Connect();
      }
      library_model_->Init();
      model()->merged_model()->AddSubModel(item->index(), library_sort_model_);
      break;

    default:
      break;
  }
}
コード例 #7
0
void DigitallyImportedServiceBase::ShowContextMenu(const QPoint& global_pos) {
  if (!context_menu_) {
    context_menu_.reset(new QMenu);
    context_menu_->addActions(GetPlaylistActions());
    context_menu_->addAction(IconLoader::Load("download"),
                             tr("Open %1 in browser").arg(homepage_url_.host()),
                             this, SLOT(Homepage()));
    context_menu_->addAction(IconLoader::Load("view-refresh"),
                             tr("Refresh streams"), this,
                             SLOT(ForceRefreshStreams()));
    context_menu_->addSeparator();
    context_menu_->addAction(IconLoader::Load("configure"), tr("Configure..."),
                             this, SLOT(ShowSettingsDialog()));
  }

  context_menu_->popup(global_pos);
}
コード例 #8
0
void DigitallyImportedServiceBase::PopulateStreams() {
  if (root_->hasChildren()) root_->removeRows(0, root_->rowCount());

  if (!is_premium_account()) {
    ShowSettingsDialog();
    return;
  }

  // Add each stream to the model
  for (const DigitallyImportedClient::Channel& channel : saved_channels_) {
    Song song;
    SongFromChannel(channel, &song);

    QStandardItem* item = new QStandardItem(
        IconLoader::Load("icon_radio", IconLoader::Lastfm), song.title());
    item->setData(channel.description_, Qt::ToolTipRole);
    item->setData(InternetModel::PlayBehaviour_SingleItem,
                  InternetModel::Role_PlayBehaviour);
    item->setData(QVariant::fromValue(song), InternetModel::Role_SongMetadata);
    root_->appendRow(item);
  }
}
コード例 #9
0
ファイル: main.c プロジェクト: TheFighter/openvpn-gui
/*  This function is called by the Windows function DispatchMessage()  */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  static UINT s_uTaskbarRestart;
  int i;

  switch (message) {
    case WM_CREATE:       

      /* Save Window Handle */
      o.hWnd = hwnd;

      s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));

      WTSRegisterSessionNotification(hwnd, NOTIFY_FOR_THIS_SESSION);

      /* Load application icon */
      HICON hIcon = LoadLocalizedIcon(ID_ICO_APP);
      if (hIcon) {
        SendMessage(hwnd, WM_SETICON, (WPARAM) (ICON_SMALL), (LPARAM) (hIcon));
        SendMessage(hwnd, WM_SETICON, (WPARAM) (ICON_BIG), (LPARAM) (hIcon));
      }

      CreatePopupMenus();	/* Create popup menus */  
      ShowTrayIcon();
      if (o.allow_service[0]=='1' || o.service_only[0]=='1')
        CheckServiceStatus();	// Check if service is running or not
      if (!AutoStartConnections()) {
        SendMessage(hwnd, WM_CLOSE, 0, 0);
        break;
      }
      break;
    	
    case WM_NOTIFYICONTRAY:
      OnNotifyTray(lParam); 	// Manages message from tray
      break;

    case WM_COMMAND:
      if ( (LOWORD(wParam) >= IDM_CONNECTMENU) && (LOWORD(wParam) < IDM_CONNECTMENU + MAX_CONFIGS) ) {
        StartOpenVPN(&o.conn[LOWORD(wParam) - IDM_CONNECTMENU]);
      }
      if ( (LOWORD(wParam) >= IDM_DISCONNECTMENU) && (LOWORD(wParam) < IDM_DISCONNECTMENU + MAX_CONFIGS) ) {
        StopOpenVPN(&o.conn[LOWORD(wParam) - IDM_DISCONNECTMENU]);
      }
      if ( (LOWORD(wParam) >= IDM_STATUSMENU) && (LOWORD(wParam) < IDM_STATUSMENU + MAX_CONFIGS) ) {
        ShowWindow(o.conn[LOWORD(wParam) - IDM_STATUSMENU].hwndStatus, SW_SHOW);
      }
      if ( (LOWORD(wParam) >= IDM_VIEWLOGMENU) && (LOWORD(wParam) < IDM_VIEWLOGMENU + MAX_CONFIGS) ) {
        ViewLog(LOWORD(wParam) - IDM_VIEWLOGMENU);
      }
      if ( (LOWORD(wParam) >= IDM_EDITMENU) && (LOWORD(wParam) < IDM_EDITMENU + MAX_CONFIGS) ) {
        EditConfig(LOWORD(wParam) - IDM_EDITMENU);
      }
#ifndef DISABLE_CHANGE_PASSWORD
      if ( (LOWORD(wParam) >= IDM_PASSPHRASEMENU) && (LOWORD(wParam) < IDM_PASSPHRASEMENU + MAX_CONFIGS) ) {
        ShowChangePassphraseDialog(&o.conn[LOWORD(wParam) - IDM_PASSPHRASEMENU]);
      }
#endif
      if (LOWORD(wParam) == IDM_SETTINGS) {
        ShowSettingsDialog();
      }
      if (LOWORD(wParam) == IDM_CLOSE) {
        CloseApplication(hwnd);
      }
      if (LOWORD(wParam) == IDM_SERVICE_START) {
        MyStartService();
      }
      if (LOWORD(wParam) == IDM_SERVICE_STOP) {
        MyStopService();
      }     
      if (LOWORD(wParam) == IDM_SERVICE_RESTART) MyReStartService();
      break;
	    
    case WM_CLOSE:
      CloseApplication(hwnd);
      break;

    case WM_DESTROY:
      WTSUnRegisterSessionNotification(hwnd);
      StopAllOpenVPN();	
      OnDestroyTray();          /* Remove Tray Icon and destroy menus */
      PostQuitMessage (0);	/* Send a WM_QUIT to the message queue */
      break;

    case WM_QUERYENDSESSION:
      return(TRUE);

    case WM_ENDSESSION:
      StopAllOpenVPN();
      OnDestroyTray();
      break;

    case WM_WTSSESSION_CHANGE:
      switch (wParam) {
        case WTS_SESSION_LOCK:
          o.session_locked = TRUE;
          break;
        case WTS_SESSION_UNLOCK:
          o.session_locked = FALSE;
          if (CountConnState(suspended) != 0)
            ResumeConnections();
          break;
      }
      break;

    case WM_POWERBROADCAST:
      switch (wParam) {
        case PBT_APMSUSPEND:
          if (o.disconnect_on_suspend[0] == '1')
            {
              /* Suspend running connections */
              for (i=0; i<o.num_configs; i++)
                {
                  if (o.conn[i].state == connected)
                SuspendOpenVPN(i);
                }

              /* Wait for all connections to suspend */
              for (i=0; i<10; i++, Sleep(500))
                if (CountConnState(suspending) == 0) break;
            }
          return FALSE;

        case PBT_APMRESUMESUSPEND:
        case PBT_APMRESUMECRITICAL:
          if (CountConnState(suspended) != 0 && !o.session_locked)
            ResumeConnections();
          return FALSE;
      }

    default:			/* for messages that we don't deal with */
      if (message == s_uTaskbarRestart)
        {
          /* Explorer has restarted, re-register the tray icon. */
          ShowTrayIcon();
          CheckAndSetTrayIcon();
          break;
        }      
      return DefWindowProc (hwnd, message, wParam, lParam);
  }

  return 0;
}
コード例 #10
0
ファイル: MainWindow.cpp プロジェクト: dona12345/Play-
void CMainWindow::ShowControllerSettings()
{
	if(!m_virtualMachine.m_pad) return;
	ShowSettingsDialog(dynamic_cast<CSettingsDialogProvider*>(m_virtualMachine.m_pad));
}
コード例 #11
0
ファイル: MainWindow.cpp プロジェクト: dona12345/Play-
void CMainWindow::ShowRendererSettings()
{
	ShowSettingsDialog(dynamic_cast<CSettingsDialogProvider*>(m_virtualMachine.GetGSHandler()));
}
コード例 #12
0
LRESULT MainWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_NCHITTEST:
		return HTCAPTION;
	case WM_CTLCOLORSTATIC:
		SetTextColor(reinterpret_cast<HDC>(wParam), theme::color(theme::WINDOW_TITLE));
		SetBkColor(reinterpret_cast<HDC>(wParam), theme::color(theme::BACKGROUND));
		return (LRESULT)GetStockObject(NULL_BRUSH);
	case WM_CTLCOLORBTN:
		return (LRESULT)theme::brush(theme::BACKGROUND);
	case WM_ERASEBKGND:
	{
		HDC dc = HDC(wParam);
		RECT r;
		GetClientRect(m_wnd, &r);
		SelectObject(dc, theme::brush(theme::BACKGROUND));
		SelectObject(dc, theme::pen(theme::LINE));
		Rectangle(dc, r.left, r.top, r.right, r.bottom);
		return 1;
	}
	case WM_MENUCOMMAND:
	{
		HMENU menu = (HMENU)lParam;
		int idx = wParam;
		switch (GetMenuItemID(menu, idx))
		{
		case ID_USER_MENU:
		{
			MENUITEMINFO info;
			info.cbSize = sizeof(info);
			info.fMask = MIIM_DATA;
			GetMenuItemInfo(menu, idx, TRUE, &info);
			auto& item = m_menuItems[info.dwItemData];
			Table* table = nullptr;
			for (auto t : m_tables)
			{
				if (t->isVisible())
				{
					table = t;
					break;
				}
			}
			table->launch(item.verb.c_str(), item.path.c_str(), item.args.c_str(), false);
			break;
		}
		case ID_MENU_REFRESH:
			refresh();
			break;
		case IDM_ABOUT:
			m_inDialog = true;
			DialogBox(m_instance, MAKEINTRESOURCE(IDD_ABOUTBOX), m_wnd, about);
			m_inDialog = false;
			break;
		case IDM_EXIT:
			PostQuitMessage(0);
			break;
		case IDM_SETTINGS:
		{
			m_inDialog = true;
			auto ok = ShowSettingsDialog(m_wnd);
			if (ok)
			{
				applySettings();
			}
			m_inDialog = false;
			break;
		}
		}
		break;
	}
	case WM_COMMAND:
	{
		int wmId = LOWORD(wParam);
		switch (wmId)
		{
		case IDC_MENU:
		{
			HMENU menu = createMenu(); 
			RECT rect;
			GetWindowRect(GetDlgItem(m_wnd, IDC_MENU), &rect);
			TrackPopupMenu(menu, TPM_RIGHTALIGN | TPM_TOPALIGN, rect.right, rect.bottom, 0, m_wnd, NULL);
			break;
		}
		case IDC_TAB:
			switchTab();
			return 0;
		case IDC_EMPTY_LINK:
		{
			m_inDialog = true;
			auto ok = ShowSettingsDialog(m_wnd, SETTINGS_CONTENT);
			if (ok)
			{
				applySettings();
			}
			m_inDialog = false;
			break;
		}
		default:
			return DefWindowProc(m_wnd, message, wParam, lParam);
		}
	}
	break;
	case WM_DRAWITEM:
	{
		auto draw = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
		FillRect(draw->hDC, &draw->rcItem, theme::brush(theme::BACKGROUND));
		SelectPen(draw->hDC, theme::pen(theme::TEXT));
		SelectBrush(draw->hDC, theme::brush(theme::TEXT));
		const int radius = 4;
		Ellipse(draw->hDC, 0, 12, radius, 12 + radius);
		Ellipse(draw->hDC, 8, 12, radius + 8, 12 + radius);
		Ellipse(draw->hDC, 16, 12, radius + 16, 12 + radius);
		break;
	}
	case WM_ACTIVATEAPP:
		if (!m_inDialog && wParam == FALSE && settings::settings()[L"general"][L"bottomWindow"].asNumber() == 0)
		{
			PostQuitMessage(0);
		}
		break;
	case WM_MOVE:
	{
		RECT r;
		GetWindowRect(m_wnd, &r);
		settings::cache()[L"left"] = simplejson::Value::number(r.left);
		settings::cache()[L"top"] = simplejson::Value::number(r.top);
		settings::saveCache();
		break;
	}
	default:
		return DefWindowProc(m_wnd, message, wParam, lParam);
	}
	return 0;
}