Skip to content

Commit

Permalink
Merge pull request #1781 from rstudio/feature/open-license-overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
gtritchie committed Nov 22, 2017
2 parents 6ece4b1 + 4c584c6 commit 1b5767d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
2 changes: 0 additions & 2 deletions src/cpp/desktop/DesktopActivationOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ using namespace rstudio::core;

namespace rstudio {
namespace desktop {
namespace activation {

DesktopActivation& activation()
{
Expand Down Expand Up @@ -72,6 +71,5 @@ void DesktopActivation::emitLaunchError(QString message)
emit launchError(message);
}

} // namespace activation
} // namespace desktop
} // namespace rstudio
4 changes: 1 addition & 3 deletions src/cpp/desktop/DesktopActivationOverlay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace core {

namespace rstudio {
namespace desktop {
namespace activation {

class DesktopActivation;
DesktopActivation& activation();
Expand Down Expand Up @@ -58,14 +57,13 @@ class DesktopActivation : public QObject
void licenseLost(QString licenseMessage);
void launchFirstSession();
void launchError(QString message);

public:
void emitLicenseLostSignal();
void emitLaunchFirstSession();
void emitLaunchError(QString message);
};

} // namespace activation
} // namespace desktop
} // namespace rstudio

Expand Down
8 changes: 4 additions & 4 deletions src/cpp/desktop/DesktopGwtCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,24 +1132,24 @@ void GwtCallback::setZoomLevel(double zoomLevel)

void GwtCallback::showLicenseDialog()
{
activation::activation().showLicenseDialog();
activation().showLicenseDialog();
}

QString GwtCallback::getInitMessages()
{
std::string message = activation::activation().currentLicenseStateMessage();
std::string message = activation().currentLicenseStateMessage();
return QString::fromStdString(message);
}

QString GwtCallback::getLicenseStatusMessage()
{
std::string message = activation::activation().licenseStatus();
std::string message = activation().licenseStatus();
return QString::fromStdString(message);
}

bool GwtCallback::allowProductUsage()
{
return activation::activation().allowProductUsage();
return activation().allowProductUsage();
}

void GwtCallback::macZoomActualSize()
Expand Down
26 changes: 13 additions & 13 deletions src/cpp/desktop/DesktopSessionLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ void SessionLauncher::launchFirstSession(const core::FilePath& installPath,
bool devMode,
const QStringList& arguments)
{
connect(&desktop::activation::activation(), SIGNAL(launchFirstSession()),
SLOT(onLaunchFirstSession()), Qt::QueuedConnection);
connect(&desktop::activation::activation(), SIGNAL(launchError(QString)),
SLOT(onLaunchError(QString)), Qt::QueuedConnection);
desktop::activation::activation().getInitialLicense(arguments, installPath, devMode);
connect(&activation(), &DesktopActivation::launchFirstSession,
this, &SessionLauncher::onLaunchFirstSession, Qt::QueuedConnection);
connect(&activation(), &DesktopActivation::launchError,
this, &SessionLauncher::onLaunchError, Qt::QueuedConnection);
activation().getInitialLicense(arguments, installPath, devMode);
}

Error SessionLauncher::launchFirstSession()
Expand Down Expand Up @@ -132,7 +132,7 @@ Error SessionLauncher::launchFirstSession()

RUN_DIAGNOSTICS_LOG("\nConnected to R session, attempting to initialize...\n");

// one-time workbench intiailized hook for startup file association
// one-time workbench initialized hook for startup file association
if (!filename_.isNull() && !filename_.isEmpty())
{
StringSlotBinder* filenameBinder = new StringSlotBinder(filename_);
Expand All @@ -155,7 +155,7 @@ Error SessionLauncher::launchFirstSession()
SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(onRSessionExited(int,QProcess::ExitStatus)));

pMainWindow_->connect(&activation::activation(),
pMainWindow_->connect(&activation(),
SIGNAL(licenseLost(QString)),
pMainWindow_,
SLOT(onLicenseLost(QString)));
Expand Down Expand Up @@ -220,10 +220,10 @@ void SessionLauncher::onRSessionExited(int, QProcess::ExitStatus)
// otherwise this is a restart so we need to launch the next session
else
{
if (!activation::activation().allowProductUsage())
if (!activation().allowProductUsage())
{
std::string message = "Unable to obtain a license. Please restart RStudio to try again.";
std::string licenseMessage = activation::activation().currentLicenseStateMessage();
std::string licenseMessage = activation().currentLicenseStateMessage();
if (licenseMessage.empty())
licenseMessage = "None Available";
message += "\n\nDetails: ";
Expand Down Expand Up @@ -261,7 +261,7 @@ void SessionLauncher::onRSessionExited(int, QProcess::ExitStatus)
Error SessionLauncher::launchNextSession(bool reload)
{
// unset the initial project environment variable it this doesn't
// polute future sessions
// pollute future sessions
core::system::unsetenv(kRStudioInitialProject);

// disconnect the firstWorkbenchInitialized event so it doesn't occur
Expand Down Expand Up @@ -298,7 +298,7 @@ Error SessionLauncher::launchNextSession(bool reload)

if (reload)
{
// load url -- use a delay because on occation we've seen the
// load url -- use a delay because on occasion we've seen the
// mac client crash during switching of projects and this could
// be some type of timing related issue
nextSessionUrl_ = url;
Expand All @@ -320,7 +320,7 @@ void SessionLauncher::onLaunchFirstSession()
if (error)
{
LOG_ERROR(error);
activation::activation().emitLaunchError(launchFailedErrorMessage());
activation().emitLaunchError(launchFailedErrorMessage());
}
}

Expand Down Expand Up @@ -433,7 +433,7 @@ void SessionLauncher::buildLaunchContext(QString* pHost,
{
// explicitly pass "none" so that rsession doesn't read an
// /etc/rstudio/rsession.conf file which may be sitting around
// from a previous configuratin or install
// from a previous configuration or install
*pArgList << QString::fromUtf8("--config-file") <<
QString::fromUtf8("none");
}
Expand Down

0 comments on commit 1b5767d

Please sign in to comment.